Compare commits
4 Commits
63a0891240
...
47ba983613
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 47ba983613 | |
Vitaliy Filippov | c780506dda | |
Vitaliy Filippov | d5756cb2fd | |
Vitaliy Filippov | 84d397e07b |
|
@ -43,9 +43,10 @@ HTTP:
|
||||||
Require TLS client certificates signed by <ca> or by default CA to connect.
|
Require TLS client certificates signed by <ca> or by default CA to connect.
|
||||||
--ws_keepalive_interval 30000
|
--ws_keepalive_interval 30000
|
||||||
Client websocket ping (keepalive) interval in milliseconds
|
Client websocket ping (keepalive) interval in milliseconds
|
||||||
--merge_watches 1
|
--no_merge_watch off
|
||||||
Antietcd merges all watcher events into a single websocket message to provide
|
Antietcd merges all watcher events into a single websocket message to provide
|
||||||
more ordering/transaction guarantees. Set to 0 to disable this behaviour.
|
more ordering guarantees. Specify 1/on/true/yes for this option to disable this
|
||||||
|
behaviour.
|
||||||
|
|
||||||
Persistence:
|
Persistence:
|
||||||
|
|
||||||
|
@ -108,6 +109,7 @@ function parse()
|
||||||
options[arg.substr(2)] = process.argv[++i];
|
options[arg.substr(2)] = process.argv[++i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
options['stale_read'] = options['stale_read'] === '1' || options['stale_read'] === 'yes' || options['stale_read'] === 'true';
|
||||||
if (options['persist_filter'])
|
if (options['persist_filter'])
|
||||||
{
|
{
|
||||||
options['persist_filter'] = require(options['persist_filter'])(options);
|
options['persist_filter'] = require(options['persist_filter'])(options);
|
||||||
|
|
13
antietcd.js
13
antietcd.js
|
@ -24,8 +24,6 @@ class AntiEtcd extends EventEmitter
|
||||||
constructor(cfg)
|
constructor(cfg)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
cfg['merge_watches'] = !('merge_watches' in cfg) || is_true(cfg['merge_watches']);
|
|
||||||
cfg['stale_read'] = !('stale_read' in cfg) || is_true(cfg['stale_read']);
|
|
||||||
this.clients = {};
|
this.clients = {};
|
||||||
this.client_id = 1;
|
this.client_id = 1;
|
||||||
this.etctree = new EtcTree(true);
|
this.etctree = new EtcTree(true);
|
||||||
|
@ -33,6 +31,10 @@ class AntiEtcd extends EventEmitter
|
||||||
this.cluster = null;
|
this.cluster = null;
|
||||||
this.stored_term = 0;
|
this.stored_term = 0;
|
||||||
this.cfg = cfg;
|
this.cfg = cfg;
|
||||||
|
this.cfg.no_merge_watch = this.cfg.no_merge_watch == 1 ||
|
||||||
|
this.cfg.no_merge_watch == 'on' ||
|
||||||
|
this.cfg.no_merge_watch == 'yes' ||
|
||||||
|
this.cfg.no_merge_watch == 'true';
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.stopped = false;
|
this.stopped = false;
|
||||||
this.inflight = 0;
|
this.inflight = 0;
|
||||||
|
@ -520,7 +522,7 @@ class AntiEtcd extends EventEmitter
|
||||||
{
|
{
|
||||||
client.send_cb = client.send_cb || (msg => socket.send(JSON.stringify(msg)));
|
client.send_cb = client.send_cb || (msg => socket.send(JSON.stringify(msg)));
|
||||||
const watch = this.etctree.api_create_watch(
|
const watch = this.etctree.api_create_watch(
|
||||||
{ ...create_request, watch_id: null }, client.send_cb, (this.cfg.merge_watches ? 'C'+client_id : null)
|
{ ...create_request, watch_id: null }, client.send_cb, (this.cfg.no_merge_watch ? null : 'C'+client_id)
|
||||||
);
|
);
|
||||||
if (!watch.created)
|
if (!watch.created)
|
||||||
{
|
{
|
||||||
|
@ -572,11 +574,6 @@ class AntiEtcd extends EventEmitter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_true(s)
|
|
||||||
{
|
|
||||||
return s === true || s === 1 || s === '1' || s === 'yes' || s === 'true' || s === 'on';
|
|
||||||
}
|
|
||||||
|
|
||||||
AntiEtcd.RequestError = RequestError;
|
AntiEtcd.RequestError = RequestError;
|
||||||
|
|
||||||
AntiEtcd.VERSION = VERSION;
|
AntiEtcd.VERSION = VERSION;
|
||||||
|
|
Loading…
Reference in New Issue