Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
clsync
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
redmine
2014-10-10 17:36:22 +0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dc6c721bdc98ecc1bad6be79100cef1f589c15de
dc6c721b
1 parent
e5028b9d
Continue work on the cluster code
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
31 deletions
PROTOCOL
cluster.c
cluster.h
configuration.h
indexes.h
man/man1/clsync.1
PROTOCOL
View file @
dc6c721
...
...
@@ -5,19 +5,19 @@ broadcast: dst_node_id == NOID
session example of two nodes (A and B):
A
appears (getting node_id):
"A"
appears (getting node_id):
A ->
getmyid
(serial: 0; src: NOID ; dst: NOID; name: A) | cluster_init()
A ->
hello
(serial: 0; src: NOID ; dst: NOID; name: A) | cluster_init()
A -> register (serial: 1; src: 0 ; dst: NOID; name: A) |
Trying to sync with somebody:
A -> updtree (serial: 2; src: 0 ; dst: NOID; [A modtree])
B
appears (getting node_id):
"B"
appears (getting node_id):
B ->
getmyid
(serial: 0; src: NOID ; dst: NOID; name: B) | cluster_init()
A ->
setid (serial: 3; src: 0 ; dst: NOID; name: A; updatets: 100)
B ->
hello
(serial: 0; src: NOID ; dst: NOID; name: B) | cluster_init()
A ->
welcome (serial: 3; src: 0 ; dst: NOID; my_name: A; to_name: B)
B -> register (serial: 1; src: 1 : dst: NOID; name: B) |
A -> ack (serial: 4; src: 0 ; dst: 1; ack_serial: 1)
...
...
@@ -41,11 +41,11 @@ B -> ack (serial: 6; src: 1 ; dst: 0; ack_serial: 10)
A -> unlockall (serial: 11: src: 0 ; dst: NOID)
B -> ack (serial: 7; src: 1 ; dst: 0; ack_serial: 11)
A
disappers (shutdown)
A
appears (registering with old node_id)
"A"
disappers (shutdown)
"A"
appears (registering with old node_id)
A ->
getmyid
(serial: 0; src: NOID ; dst: NOID; name: A)
B ->
setid (serial: 4; src: 1 ; dst: 0; name: A; updatets: 200
)
A ->
hello
(serial: 0; src: NOID ; dst: NOID; name: A)
B ->
welcome (serial: 4; src: 1 ; dst: 0; my_name: B; to_name: A
)
A -> register (serial: 1; src: 0 ; dst: NOID; name: A)
B -> ack (serial: 5; src: 1 ; dst: 0; ack_serial: 1)
...
...
cluster.c
View file @
dc6c721
This diff is collapsed. Click to expand it.
cluster.h
View file @
dc6c721
...
...
@@ -77,7 +77,6 @@ typedef enum adler32_calc adler32_calc_t;
enum
cluster_read_flags
{
CLREAD_NONE
=
0x00
,
CLREAD_CONTINUE
=
0x01
,
CLREAD_ALL
=
0xff
};
typedef
enum
cluster_read_flags
cluster_read_flags_t
;
...
...
@@ -112,33 +111,38 @@ struct nodeinfo {
packets_stats_t
packets_in
;
packets_stats_t
packets_out
;
uint32_t
last_serial
;
char
*
node_name
;
};
typedef
struct
nodeinfo
nodeinfo_t
;
enum
clustercmd_id
{
CLUSTERCMDID_PING
=
0
,
CLUSTERCMDID_ACK
=
1
,
CLUSTERCMDID_REG
=
2
,
CLUSTERCMDID_GETMYID
=
3
,
CLUSTERCMDID_SETID
=
4
,
CLUSTERCMDID_HT_EXCH
=
5
,
CLUSTERCMDID_PING
=
0
,
CLUSTERCMDID_ACK
=
1
,
CLUSTERCMDID_REG
=
2
,
CLUSTERCMDID_HELLO
=
3
,
CLUSTERCMDID_WELCOME
=
4
,
CLUSTERCMDID_DIE
=
5
,
CLUSTERCMDID_HT_EXCH
=
6
,
COUNT_CLUSTERCMDID
};
typedef
enum
clustercmd_id
clustercmd_id_t
;
struct
clustercmd_
getmyid
{
char
node_name
[
1
];
struct
clustercmd_
hello
{
char
node_name
[
0
];
};
typedef
struct
clustercmd_getmyid
clustercmd_getmyid_t
;
struct
clustercmd_setiddata
{
uint32_t
updatets
;
char
node_name
[
1
];
typedef
struct
clustercmd_hello
clustercmd_hello_t
;
#define welcome_to_node_name_len(cmd_p) ((cmd_p)->h.data_len-(((clustercmd_welcome_t *)&(cmd_p)->data)->from_node_name_len)-sizeof(clustercmd_welcome_t))
#define welcome_to_node_name(cmddata_p) (&cmddata_p->from_node_name[cmddata_p->from_node_name_len])
struct
clustercmd_welcome
{
size_t
from_node_name_len
;
char
from_node_name
[
0
];
// to_node_name == my_node_name+my_node_name_len
};
typedef
struct
clustercmd_
setiddata
clustercmd_setiddata
_t
;
typedef
struct
clustercmd_
welcome
clustercmd_welcome
_t
;
struct
clustercmd_reg
{
char
node_name
[
1
];
char
node_name
[
0
];
};
typedef
struct
clustercmd_reg
clustercmd_reg_t
;
...
...
@@ -162,7 +166,7 @@ typedef struct clustercmd_rej clustercmd_rej_t;
struct
clustercmd_ht_exch
{
time_t
ctime
;
size_t
path_length
;
char
path
[
1
];
char
path
[
0
];
};
typedef
struct
clustercmd_ht_exch
clustercmd_ht_exch_t
;
...
...
@@ -184,16 +188,19 @@ struct clustercmdhdr { // bits
};
typedef
struct
clustercmdhdr
clustercmdhdr_t
;
typedef
char
clustercmd_die_t
;
struct
clustercmd
{
clustercmdhdr_t
h
;
union
data
{
char
p
[
1
];
clustercmd_
setiddata_t
setid
;
char
p
[
0
];
clustercmd_
welcome_t
welcome
;
clustercmd_reg_t
reg
;
clustercmd_ack_t
ack
;
clustercmd_rej_t
rej
;
clustercmd_
getmyid_t
getmyid
;
clustercmd_
hello_t
hello
;
clustercmd_ht_exch_t
ht_exch
;
clustercmd_die_t
die
;
}
data
;
};
typedef
struct
clustercmd
clustercmd_t
;
...
...
configuration.h
View file @
dc6c721
...
...
@@ -83,7 +83,7 @@
#define ALLOC_PORTION (1<<10)
/* 1 KiX */
#define CLUSTER_WINDOW_BUFSIZE_PORTION (1<<20)
/* 1 MiB */
#define CLUSTER_PACKET_MAXSIZE (1<<2
4)
/* 16
MiB */
#define CLUSTER_PACKET_MAXSIZE (1<<2
0)
/* 1
MiB */
#define CLUSTER_WINDOW_PCKTLIMIT (1<<20)
/* 1 Ki packets */
#define CONFIG_PATHS { ".clsync.conf", "/etc/clsync/clsync.conf", "/etc/clsync.conf", "/usr/local/etc/clsync/clsync.conf", "/usr/local/etc/clsync.conf", NULL }
/* "~/.clsync.conf", "/etc/clsync/clsync.conf" ... */
...
...
indexes.h
View file @
dc6c721
...
...
@@ -36,6 +36,9 @@ struct indexes {
GHashTable
*
out_lines_aggr_ht
;
// output lines aggregation hashtable
GHashTable
*
nonthreaded_syncing_fpath2ei_ht
;
// events that are synchronized in signle-mode (non threaded)
GHashTable
*
fileinfo_ht
;
// to search "fileinfo" structures (that contains secondary sorts of things about any files/dirs)
#ifdef CLUSTER_SUPPORT
GHashTable
*
nodenames_ht
;
// node_name -> node_id
#endif
};
typedef
struct
indexes
indexes_t
;
...
...
man/man1/clsync.1
View file @
dc6c721
...
...
@@ -556,7 +556,7 @@ The default value is "1000". [1 second]
.RS
.B Not implemented yet.
Sets the name of
current
node in the cluster. It will be used in action
Sets the name of
this
node in the cluster. It will be used in action
scripts of another nodes (see
.BR "SYNC HANDLER MODES" ).
...
...
@@ -564,6 +564,20 @@ The default value is $(uname \-n).
.RE
.PP
.B \-n, \-\-cluster\-node\-id
.I cluster\-node\-id
.RS
.B Not implemented yet.
Sets an ID for this node in the cluster. It's used for messaging between
cluster nodes.
Use value "-1" to choose it automatically.
The default value is "-1".
.RE
.PP
.B \-o, \-\-cluster\-hash\-dl\-min
.I hash\-dirlevel\-min
.RS
...
...
Please
register
or
login
to post a comment