antietcd 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -81,6 +81,9 @@ Options:
81
81
  <dt>--port 2379</dt>
82
82
  <dd>Listen port</dd>
83
83
 
84
+ <dt>--ip 192.168.0.10</dt>
85
+ <dd>Listen address (by default listen on all interfaces)</dd>
86
+
84
87
  <dt>--cert &lt;cert&gt;</dt>
85
88
  <dd>Use TLS with this certificate file (PEM format)</dd>
86
89
 
package/antietcd-app.js CHANGED
@@ -30,6 +30,8 @@ HTTP:
30
30
 
31
31
  --port 2379
32
32
  Listen port
33
+ --ip 192.168.0.10
34
+ Listen address (by default listen on all interfaces)
33
35
  --cert <cert>
34
36
  Use TLS with this certificate file (PEM format)
35
37
  --key <key>
package/antietcd.js CHANGED
@@ -75,7 +75,7 @@ class AntiEtcd extends EventEmitter
75
75
  this.wss = new ws.WebSocketServer({ server: this.server });
76
76
  // eslint-disable-next-line no-unused-vars
77
77
  this.wss.on('connection', (conn, req) => this._startWebsocket(conn, null));
78
- this.server.listen(this.cfg.port || 2379);
78
+ this.server.listen(this.cfg.port || 2379, this.cfg.ip || undefined);
79
79
  }
80
80
 
81
81
  async stop()
@@ -132,11 +132,11 @@ class AntiEtcd extends EventEmitter
132
132
  if (!this.cluster)
133
133
  {
134
134
  // Run deletion compaction without followers
135
- const mod_revision = this.antietcd.etctree.mod_revision;
136
- if (mod_revision - this.antietcd.etctree.compact_revision > (this.cfg.compact_revisions||1000)*2)
135
+ const mod_revision = this.etctree.mod_revision;
136
+ if (mod_revision - this.etctree.compact_revision > (this.cfg.compact_revisions||1000)*2)
137
137
  {
138
138
  const revision = mod_revision - (this.cfg.compact_revisions||1000);
139
- this.antietcd.etctree.compact(revision);
139
+ this.etctree.compact(revision);
140
140
  }
141
141
  }
142
142
  }
package/common.js CHANGED
@@ -1,10 +1,11 @@
1
1
  // (c) Vitaliy Filippov, 2024
2
2
  // License: Mozilla Public License 2.0 or Vitastor Network Public License 1.1
3
3
 
4
- class RequestError
4
+ class RequestError extends Error
5
5
  {
6
6
  constructor(code, text, details)
7
7
  {
8
+ super();
8
9
  this.code = code;
9
10
  this.message = text;
10
11
  this.details = details;
package/etctree.js CHANGED
@@ -444,7 +444,7 @@ class EtcTree
444
444
  }
445
445
  for (const key in this.leases[id].keys)
446
446
  {
447
- this._delete_range({ key }, next_revision, notifications);
447
+ this._delete_range({ key: this.use_base64 ? this.b64(key) : key }, next_revision, notifications);
448
448
  }
449
449
  delete this.leases[id];
450
450
  }
@@ -588,7 +588,7 @@ class EtcTree
588
588
  });
589
589
  this.active_immediate.push(imm);
590
590
  }
591
- return { watch_id, created: true };
591
+ return { header: { revision: this.mod_revision }, watch_id, created: true };
592
592
  }
593
593
 
594
594
  _get_modified(events, cur, prefix, min_rev)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antietcd",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Simplistic etcd replacement based on TinyRaft",
5
5
  "main": "antietcd.js",
6
6
  "scripts": {