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 +3 -0
- package/antietcd-app.js +2 -0
- package/antietcd.js +4 -4
- package/common.js +2 -1
- package/etctree.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/antietcd-app.js
CHANGED
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.
|
|
136
|
-
if (mod_revision - this.
|
|
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.
|
|
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)
|