redmine

cluster support started

/*
clsync - file tree sync utility based on fanotify and inotify
Copyright (C) 2013 Dmitry Yu Okunev <xai@mephi.ru> 0x8E30679C
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
int cluster_init() {
return 0;
}
int cluster_deinit() {
return 0;
}
... ...
/*
clsync - file tree sync utility based on fanotify and inotify
Copyright (C) 2013 Dmitry Yu Okunev <xai@mephi.ru> 0x8E30679C
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
extern int cluster_init();
extern int cluster_deinit();
... ...
... ... @@ -83,6 +83,8 @@
enum flags_enum {
BACKGROUND = 'b',
PTHREAD = 'p',
CLUSTERIFACE = 'c',
CLUSTERMCASTIPADDR = 'm',
HELP = 'h',
DELAY = 't',
BFILEDELAY = 'T',
... ... @@ -151,6 +153,8 @@ struct options {
char *destdir;
char *watchdirwslash;
char *destdirwslash;
char *cluster_iface;
char *cluster_mcastipaddr;
size_t watchdirlen;
size_t destdirlen;
size_t watchdirsize;
... ...
... ... @@ -29,7 +29,9 @@
static struct option long_options[] =
{
{"background", no_argument, NULL, BACKGROUND},
{"pthread", no_argument, NULL, PTHREAD}, // Not implemented, yet
{"pthread", no_argument, NULL, PTHREAD},
{"cluster-iface", required_argument, NULL, CLUSTERIFACE}, // Not implemented, yet
{"cluster-ip", required_argument, NULL, CLUSTERMCASTIPADDR}, // Not implemented, yet
{"collectdelay", required_argument, NULL, DELAY},
{"syncdelay", required_argument, NULL, SYNCDELAY},
{"outlistsdir", required_argument, NULL, OUTLISTSDIR},
... ... @@ -85,6 +87,12 @@ int parse_arguments(int argc, char *argv[], struct options *options_p) {
case 'h':
syntax();
break;
case 'c':
options_p->cluster_iface = optarg;
break;
case 'm':
options_p->cluster_mcastipaddr = optarg;
break;
case 'd':
options_p->listoutdir = optarg;
break;
... ... @@ -312,6 +320,11 @@ int main(int argc, char *argv[]) {
ret = EINVAL;
}
if((options.cluster_iface == NULL) && (options.cluster_mcastipaddr != NULL)) {
printf_e("Error: Option \"--cluster-ip\" cannot be used without \"--cluster-iface\".\n");
ret = EINVAL;
}
{
size_t size = options.watchdirlen + 2;
char *newwatchdir = xmalloc(size);
... ...
... ... @@ -79,6 +79,40 @@ with option
.RE
.PP
.B \-c, \-\-cluster\-iface
.I interface\-ip
.RS 8
Enables inter-node notifing subsystem to prevent sync looping between nodes.
This's very useful features that provides ability of birectional sync of the
same directory between two or more nodes.
.I interface-ip
is an IP-address already assigned to the interface that will be used for
multicast notifing.
Not enabled by default.
To find out the IP-address on interface "eth0", you can use for example next
command:
ip a s eth0 | awk '{if($1=="inet") {gsub("/.*", "", $2); print $2}}'
.RE
.PP
.B \-c, \-\-cluster\-ip
.I multicast\-ip
.RS 8
Sets IP-address for multicast group.
This option can be used only in conjuction with
.B \-\-cluster\-interface
\*S.
Use IP-addresses from 224.0.0.0/4 for this option.
Default value is "227.108.115.121". [(128+"c")."l"."s"."y"]
.RE
.PP
.B \-t, \-\-collectdelay
.I ordinary\-delay
.RS 8
... ...