Compare commits

..

4 Commits

2 changed files with 9 additions and 10 deletions

View File

@ -43,9 +43,10 @@ HTTP:
Require TLS client certificates signed by <ca> or by default CA to connect.
--ws_keepalive_interval 30000
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
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:
@ -108,6 +109,7 @@ function parse()
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'])
{
options['persist_filter'] = require(options['persist_filter'])(options);

View File

@ -24,8 +24,6 @@ class AntiEtcd extends EventEmitter
constructor(cfg)
{
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.client_id = 1;
this.etctree = new EtcTree(true);
@ -33,6 +31,10 @@ class AntiEtcd extends EventEmitter
this.cluster = null;
this.stored_term = 0;
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.stopped = false;
this.inflight = 0;
@ -520,7 +522,7 @@ class AntiEtcd extends EventEmitter
{
client.send_cb = client.send_cb || (msg => socket.send(JSON.stringify(msg)));
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)
{
@ -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.VERSION = VERSION;