Compare commits

..

4 Commits

2 changed files with 10 additions and 9 deletions

View File

@ -43,10 +43,9 @@ 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
--no_merge_watch off
--merge_watches 1
Antietcd merges all watcher events into a single websocket message to provide
more ordering guarantees. Specify 1/on/true/yes for this option to disable this
behaviour.
more ordering/transaction guarantees. Set to 0 to disable this behaviour.
Persistence:
@ -109,7 +108,6 @@ 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,6 +24,8 @@ 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);
@ -31,10 +33,6 @@ 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;
@ -522,7 +520,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.no_merge_watch ? null : 'C'+client_id)
{ ...create_request, watch_id: null }, client.send_cb, (this.cfg.merge_watches ? 'C'+client_id : null)
);
if (!watch.created)
{
@ -574,6 +572,11 @@ 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;