datafolder 1.0.43 → 1.0.44

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.
@@ -40,13 +40,13 @@ class r extends t {
40
40
  return this.dateDirPath;
41
41
  }
42
42
  async _op_start() {
43
- var t = new Date(), t = (this.timeoutRef = setTimeout(this.switch.bind(this), l(t)),
44
- this.dateDirPath = n(this, t));
45
- this.qyLogFileSaver.start(a(t, "change.txt")), await this.startFileConsole(t);
43
+ var t = new Date(), t = (this.timeoutRef = setTimeout(this.switch.bind(this), h(t)),
44
+ this.dateDirPath = l(this, t));
45
+ this.qyLogFileSaver.call_start(a(t, "change.txt")), await this.startFileConsole(t);
46
46
  }
47
47
  switch() {
48
- var t = new Date(), t = (this.timeoutRef = setTimeout(this.switch.bind(this), l(t)),
49
- n(this, t));
48
+ var t = new Date(), t = (this.timeoutRef = setTimeout(this.switch.bind(this), h(t)),
49
+ l(this, t));
50
50
  return this.dateDirPath !== t && (this.dateDirPath = t, this.qyLogFileSaver.cast_switch(a(t, "change.txt")),
51
51
  this.switchFileConsole(t)), this;
52
52
  }
@@ -55,23 +55,23 @@ class r extends t {
55
55
  }
56
56
  async _op_stop() {
57
57
  this.timeoutRef && (clearTimeout(this.timeoutRef), this.timeoutRef = void 0),
58
- o.closeFileConsole(), await this.qyLogFileSaver.stop();
58
+ o.closeFileConsole(), await this.qyLogFileSaver.call_stop();
59
59
  }
60
60
  async _op_switchFileConsole(t) {
61
61
  await e(t), o.setFileConsoleDateDirPath(t, this.options.clearLogAtStart);
62
62
  }
63
63
  }
64
64
 
65
- function n(t, e) {
65
+ function l(t, e) {
66
66
  var i = e.getUTCFullYear(), s = e.getUTCMonth() + 1, o = e.getUTCDate(), e = e.getUTCHours();
67
- return a(t.logFileFolder, i.toString(), h(s), h(o), h(e));
67
+ return a(t.logFileFolder, i.toString(), n(s), n(o), n(e));
68
68
  }
69
69
 
70
- function h(t) {
70
+ function n(t) {
71
71
  return t.toString().padStart(2, "0");
72
72
  }
73
73
 
74
- function l(t) {
74
+ function h(t) {
75
75
  return 1e3 * (60 * (60 - t.getUTCMinutes()) - t.getUTCSeconds());
76
76
  }
77
77
 
package/src/QyKVData.d.ts CHANGED
@@ -2,7 +2,7 @@ import { QyKVDataSaver } from "./QyKVDataSaver.ts";
2
2
  import { QySnapshotCompactor } from "./QySnapshotCompactor.ts";
3
3
  import { QyKVDataCleaner } from "./QyKVDataCleaner.ts";
4
4
  import { QyExpire } from "./QyExpire.ts";
5
- import type { QySnapshots } from "./QySnapshots.ts";
5
+ import { type QySnapshots } from "./QySnapshots.ts";
6
6
  export declare class QyKVData {
7
7
  kvFolder: any;
8
8
  snapshotFolder: any;
package/src/QyKVData.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- join as n
2
+ join as s
3
3
  } from "node:path";
4
4
 
5
5
  import {
@@ -7,15 +7,15 @@ import {
7
7
  } from "node:fs/promises";
8
8
 
9
9
  import {
10
- getDefaultOptions as s
10
+ getDefaultOptions as n
11
11
  } from "./QyDefaultOptions.js";
12
12
 
13
13
  import {
14
- QyKVDataSaver as i
14
+ QyKVDataSaver as r
15
15
  } from "./QyKVDataSaver.js";
16
16
 
17
17
  import {
18
- QySnapshotCompactor as r
18
+ QySnapshotCompactor as i
19
19
  } from "./QySnapshotCompactor.js";
20
20
 
21
21
  import {
@@ -28,13 +28,15 @@ import {
28
28
  } from "./QyUtils.js";
29
29
 
30
30
  import {
31
- logger as C
31
+ logger as g
32
32
  } from "./QyLogger.js";
33
33
 
34
34
  import {
35
35
  QyExpire as h
36
36
  } from "./QyExpire.js";
37
37
 
38
+ import "./QySnapshots.js";
39
+
38
40
  class t {
39
41
  kvFolder;
40
42
  snapshotFolder;
@@ -57,82 +59,82 @@ class t {
57
59
  qyExpire;
58
60
  constructor(t, a = void 0, o = void 0) {
59
61
  a = {
60
- ...s("QyKVData"),
62
+ ...n("QyKVData"),
61
63
  ...a
62
64
  };
63
- var e = n(t, "snapshot");
65
+ var e = s(t, "snapshot");
64
66
  this.qyCache = o, this.options = a, this.kvFolder = t, this.snapshotFolder = e,
65
- this.qyKVDataSaver = new i(this, t, a), this.qySnapshotCompactor = new r(this, t, a),
67
+ this.qyKVDataSaver = new r(this, t, a), this.qySnapshotCompactor = new i(this, t, a),
66
68
  this.qyKVDataCleaner = new p(this, t, a), this.qyExpire = new h(o, a);
67
69
  }
68
70
  start(t, a, o, e) {
69
71
  var {
70
- options: n,
71
- qyKVDataSaver: s,
72
- qySnapshotCompactor: i,
73
- qyKVDataCleaner: r,
72
+ options: s,
73
+ qyKVDataSaver: n,
74
+ qySnapshotCompactor: r,
75
+ qyKVDataCleaner: i,
74
76
  qyExpire: p
75
77
  } = this, {
76
78
  maxSnapshotNum: h,
77
79
  snapshotMaxChangeId: c
78
80
  } = o;
79
- return s.start(t, h, a, e), i.start(), r.start(), p.start(), this.maxChangeId = t,
80
- this.snapshotSavedChangeId = c, this.qySnapshots = o, this.aclKeyValueMap = e,
81
- this.compactInterval = setInterval(() => d(this), n.compactSnapshotsInterval),
81
+ return n.call_start(t, h, a, e), r.call_start(), i.call_start(), p.start(),
82
+ this.maxChangeId = t, this.snapshotSavedChangeId = c, this.qySnapshots = o,
83
+ this.aclKeyValueMap = e, this.compactInterval = setInterval(() => d(this), s.compactSnapshotsInterval),
82
84
  this.unloadInterval = setInterval(() => (async o => {
83
85
  if (!o.unloadingMemory) {
84
86
  o.unloadingMemory = !0;
85
87
  var {
86
88
  qyCache: e,
87
- options: n
89
+ options: s
88
90
  } = o;
89
91
  let t = 0, a = 0;
90
92
  if (e) {
91
- var s, i = n.maxFileCountToUnload, n = e.rootDir;
92
- a = m(o, n), t = a;
93
- for (s of n.allLoadedSubdirs()) if ((a += m(o, s)) > i && (t += a,
93
+ var n, r = s.maxFileCountToUnload, s = e.rootDir;
94
+ a = m(o, s), t = a;
95
+ for (n of s.allLoadedSubdirs()) if ((a += m(o, n)) > r && (t += a,
94
96
  a = 0, await l(0), o.isStopping)) break;
95
97
  }
96
98
  t += a, global.gc && global.gc(), o.unloadingMemory = !1;
97
99
  }
98
- })(this), n.unloadMemInterval), n.bgLoadPosMaps ? (async t => {
100
+ })(this), s.unloadMemInterval), s.bgLoadPosMaps ? (async t => {
99
101
  var a, {
100
102
  qySnapshots: o,
101
103
  options: e
102
104
  } = t;
103
105
  console.time("bgLoadPosMaps");
104
- for (a of Object.keys(o.numToSnapshotMap).sort((t, a) => a - t)) {
105
- if (await async function s(i, r, p = void 0, h = void 0, c = void 0, l = void 0) {
106
- if (i.isStopping) return void (l && l.close());
107
- let d = i.qySnapshots;
106
+ for (a of o.numToSnapshotMap.keys().toArray().sort((t, a) => a - t)) {
107
+ if (await async function n(r, i, p = void 0, h = void 0, c = void 0, l = void 0) {
108
+ if (r.isStopping) return void (l && l.close());
109
+ let d = r.qySnapshots;
108
110
  let m = d.numToSnapshotMap;
109
- let u = m[r];
111
+ let u = m.get(i);
110
112
  if (void 0 === u) return void (l && l.close());
111
113
  let {
112
- info: v,
113
- prefixPM: f
114
+ info: f,
115
+ prefixPM: v
114
116
  } = u;
115
- void 0 === p && (p = Object.keys(f).sort().reverse());
117
+ void 0 === p && (p = v.keys().toArray().sort().reverse());
116
118
  if (0 === p.length) return void (l && l.close());
117
- if (void 0 === h || h !== v.pMVersion) return l && l.close(),
118
- c = d.getPMFilePath(u), s(i, r, p, v.pMVersion, c, await y(c));
119
+ if (void 0 === h || h !== f.pMVersion) return l && l.close(),
120
+ c = d.getPMFilePath(u), n(r, i, p, f.pMVersion, c, await y(c));
119
121
  for (;0 < p.length; ) {
120
- let e = p.at(-1), n = f[e];
121
- if (n) {
122
- let [ t, a ] = n, o = await S(c, l, t, a);
123
- if (i.isStopping || void 0 === m[r]) return void l.close();
124
- if (h !== v.pMVersion) return l.close(), s(i, r, p);
125
- e in f && d.loadPartialPosMapBuffer(u, e, o);
122
+ let e = p.at(-1), s = v.get(e);
123
+ if (s) {
124
+ let [ t, a ] = s, o = await S(c, l, t, a);
125
+ if (r.isStopping || void 0 === m.get(i)) return void l.close();
126
+ if (h !== f.pMVersion) return l.close(), n(r, i, p);
127
+ v.has(e) && d.loadPartialPosMapBuffer(u, e, o);
126
128
  }
127
129
  p.pop();
128
130
  }
129
131
  l.close();
130
- C.info("bgLoadPosMap:" + r);
132
+ g.info("bgLoadPosMap:" + i);
131
133
  }(t, a), t.isStopping) break;
132
134
  if (await l(0), t.isStopping) break;
133
135
  }
134
136
  console.timeEnd("bgLoadPosMaps"), !t.isStopping && e.compactAtStart && d(t);
135
- })(this) : n.compactAtStart && d(this), this;
137
+ })(this) : s.compactAtStart && d(this), this;
136
138
  }
137
139
  async stop() {
138
140
  this.isStopping = !0;
@@ -141,17 +143,17 @@ class t {
141
143
  qySnapshotCompactor: a,
142
144
  qySnapshots: o,
143
145
  compactInterval: e,
144
- unloadInterval: n,
145
- qyKVDataCleaner: s,
146
- qyExpire: i
146
+ unloadInterval: s,
147
+ qyKVDataCleaner: n,
148
+ qyExpire: r
147
149
  } = this;
148
- clearInterval(e), clearInterval(n), await i.stop(), c(this, await t.stop()),
149
- o && o.closeAllFDs(), await a.stop(), await s.stop();
150
+ clearInterval(e), clearInterval(s), await r.stop(), c(this, await t.call_stop()),
151
+ o && o.closeAllFDs(), await a.call_stop(), await n.call_stop();
150
152
  }
151
153
  save(t, a, o, e) {
152
- var n = this.qyKVDataSaver;
153
- if (e) return n.call_save(t, a, o);
154
- n.cast_save(t, a, o);
154
+ var s = this.qyKVDataSaver;
155
+ if (e) return s.call_save(t, a, o);
156
+ s.cast_save(t, a, o);
155
157
  }
156
158
  increaseChangeId() {
157
159
  return ++this.maxChangeId;
@@ -164,86 +166,81 @@ class t {
164
166
  qySnapshots: a,
165
167
  aclKeyValueMap: o
166
168
  } = this;
167
- return t in o ? o[t] : a.getValueSync(t);
169
+ return o.has(t) ? o.get(t) : a.getValueSync(t);
168
170
  }
169
171
  removeKey(t) {
170
172
  var {
171
173
  qySnapshots: a,
172
174
  aclKeyValueMap: o
173
175
  } = this;
174
- if (!(t in o)) return a.removeKey(t);
175
- o[t] = void 0;
176
+ if (!o.has(t)) return a.removeKey(t);
177
+ o.set(t, void 0);
176
178
  }
177
179
  _on_snapshotSavedChangeId(t, a) {
178
180
  c(this, t, a);
179
181
  }
180
- _on_compactUpdates(t) {
182
+ _on_compactUpdates(l) {
181
183
  if (2 === this.compactState) {
182
- var l = this, [ t, d, m ] = t = t;
183
- if (t) {
184
- var a = t, o = l.qySnapshots.numToSnapshotMap;
185
- for (s in a) {
186
- var e, n = a[s], s = o[s], {
187
- prefixPM: i,
188
- info: r
184
+ var d = this, [ l, t, m ] = l = l;
185
+ if (l) {
186
+ var a, o = d.qySnapshots.numToSnapshotMap;
187
+ for ([ s, a ] of l) {
188
+ var e, s = o.get(s), {
189
+ prefixPM: n,
190
+ info: r,
191
+ compactOutedCount: i
189
192
  } = s;
190
- for (e in ++r.pMVersion, r.verList[0] = r.pMVersion + r.vLVersion,
191
- i) i[e] = n[e];
192
- (t => {
193
- var {
194
- info: a,
195
- compactOutedCount: o
196
- } = t;
197
- a.outdatedCount += o, t.outdatedCount -= o, t.compactOutedCount = 0;
198
- })(s);
193
+ ++r.pMVersion, r.verList[0] = r.pMVersion + r.vLVersion;
194
+ for ([ e ] of n.keys()) n.set(e, a.get(e));
195
+ r.outdatedCount += i, s.outdatedCount -= i, s.compactOutedCount = 0;
199
196
  }
200
197
  }
201
- if (d) {
202
- var p = d, h = (t = l).qySnapshots.numToSnapshotMap;
203
- for (y in p) {
204
- var c, u, {
205
- posMap: v,
198
+ if (t) {
199
+ var p = (l = d).qySnapshots.numToSnapshotMap;
200
+ for ([ g, v ] of t) {
201
+ var h, c, {
202
+ posMap: u,
206
203
  prefixPM: f
207
- } = p[y], y = h[y], {
208
- posMap: S,
209
- prefixPM: C,
204
+ } = v, v = p.get(g), {
205
+ posMap: y,
206
+ prefixPM: S,
210
207
  info: g
211
- } = y;
212
- for (c in ++g.pMVersion, ++g.vLVersion, g.verList[0] = g.pMVersion + g.vLVersion,
213
- S) S[c] = v[c];
214
- for (u in C) C[u] = f[u];
215
- x(y);
208
+ } = v;
209
+ ++g.pMVersion, ++g.vLVersion, g.verList[0] = g.pMVersion + g.vLVersion;
210
+ for (h of y.keys()) y.set(h, u.get(h));
211
+ for ([ c ] of S.keys()) S.set(c, f.get(c));
212
+ V(v);
216
213
  }
217
214
  }
218
215
  if (m) {
219
- var M, d = m;
220
- let e = l.qySnapshots, {
221
- numToSnapshotMap: n,
222
- keyToSnapshotMap: s
216
+ var C, l = m;
217
+ let e = d.qySnapshots, {
218
+ numToSnapshotMap: s,
219
+ keyToSnapshotMap: n
223
220
  } = e, {
224
221
  snapshotNum: t,
225
222
  combinedSnapshotNumVerList: a,
226
- posMap: i
227
- } = d, r = n[t], {
223
+ posMap: r
224
+ } = l, i = s.get(t), {
228
225
  posMap: p,
229
226
  info: o
230
- } = r;
231
- for (M in ++o.pMVersion, ++o.vLVersion, o.verList[0] = o.pMVersion + o.vLVersion,
232
- p) p[M] = i[M];
233
- x(r);
234
- let h = o.totalCount, c = r.outdatedCount;
227
+ } = i;
228
+ ++o.pMVersion, ++o.vLVersion, o.verList[0] = o.pMVersion + o.vLVersion;
229
+ for (C of p.keys()) p.set(C, r.get(C));
230
+ V(i);
231
+ let h = o.totalCount, c = i.outdatedCount;
235
232
  for (let [ o ] of a) {
236
- var q, V = n[o];
233
+ var M, q = s.get(o);
237
234
  let {
238
235
  posMap: t,
239
236
  info: a
240
- } = V;
241
- for (q in t) p[q] = i[q], s[q] = r;
242
- x(V), h += a.totalCount, c += V.outdatedCount, e.delSnapshot(V);
237
+ } = q;
238
+ for (M of t.keys()) p.set(M, r.get(M)), n.set(M, i);
239
+ V(q), h += a.totalCount, c += q.outdatedCount, e.delSnapshot(q);
243
240
  }
244
- o.totalCount = h, r.outdatedCount = c;
241
+ o.totalCount = h, i.outdatedCount = c;
245
242
  }
246
- this.snapshotSavedChangeId >= this.compactMaxChangeId ? (I(this), this.compactState = 1) : this.compactState = 3;
243
+ this.snapshotSavedChangeId >= this.compactMaxChangeId ? (x(this), this.compactState = 1) : this.compactState = 3;
247
244
  }
248
245
  }
249
246
  monitorContentExpire(t, a) {
@@ -264,21 +261,21 @@ function c(t, a, o = void 0) {
264
261
  t.snapshotSavedChangeId = a;
265
262
  var {
266
263
  compactState: e,
267
- compactMaxChangeId: n,
268
- qyKVDataSaver: s
264
+ compactMaxChangeId: s,
265
+ qyKVDataSaver: n
269
266
  } = t;
270
- if (3 === e && n <= a && (I(t), t.compactState = 1), o) {
271
- var i, e = o, r = t.qySnapshots, p = r.keyToSnapshotMap;
272
- for (i in e.posMap) {
273
- var h = p[i];
274
- h && r.removeKeyFromSnapshot(h, i);
267
+ if (3 === e && s <= a && (x(t), t.compactState = 1), o) {
268
+ var r, e = o, i = t.qySnapshots, p = i.keyToSnapshotMap;
269
+ for (r of e.posMap.keys()) {
270
+ var h = p.get(r);
271
+ h && i.removeKeyFromSnapshot(h, r);
275
272
  }
276
- r.addMaxSnapshot(e), C.info("addPMOnlySnapshot: " + r.snapshotMaxChangeId),
277
- s.cast_releaseSnapshot(o.snapshotNum);
273
+ i.addMaxSnapshot(e), g.info("addPMOnlySnapshot: " + i.snapshotMaxChangeId),
274
+ n.cast_releaseSnapshot(o.snapshotNum);
278
275
  }
279
276
  }
280
277
 
281
- function x(t) {
278
+ function V(t) {
282
279
  var {
283
280
  info: a,
284
281
  compactOutedCount: o
@@ -293,11 +290,11 @@ function d(t) {
293
290
  maxChangeId: a,
294
291
  qySnapshots: o,
295
292
  qySnapshotCompactor: e
296
- } = t, [ o, n, s, i ] = o.calOutdates();
297
- if (0 < n.length || 0 < s.length || 0 < i.length) {
293
+ } = t, [ o, s, n, r ] = o.calOutdates();
294
+ if (0 < s.length || 0 < n.length || 0 < r.length) {
298
295
  t.compactState = 2, t.compactMaxChangeId = a;
299
- for (var r of [ s, i, n ]) for (var p of r) p.compactOutedCount = p.outdatedCount;
300
- e.cast_compactSnapshots(s, i, n);
296
+ for (var i of [ n, r, s ]) for (var p of i) p.compactOutedCount = p.outdatedCount;
297
+ e.cast_compactSnapshots(n, r, s);
301
298
  }
302
299
  0 < o.length && (t.emptySnapshotNumVerList.push(...o), t.snapshotSavedChangeId >= a ? u(t) : 1 === t.compactState && (t.compactState = 3,
303
300
  t.compactMaxChangeId = a));
@@ -307,7 +304,7 @@ function d(t) {
307
304
  function m(t, a) {
308
305
  var o = t.qySnapshots.snapshotMaxChangeId;
309
306
  let e = 0;
310
- if (a.fileMapLoaded) for (var n of a.fileList) ++e, n.cChangeId <= o && (n.visited ? n.visited = !1 : n.unloadFileContent());
307
+ if (a.fileMapLoaded) for (var s of a.fileList) ++e, s.cChangeId <= o && (s.visited ? s.visited = !1 : s.unloadFileContent());
311
308
  return e;
312
309
  }
313
310
 
@@ -319,7 +316,7 @@ function u(t) {
319
316
  0 < a.length && (t.cast_removeSnapshotsFiles(a), a.length = 0);
320
317
  }
321
318
 
322
- function I(t) {
319
+ function x(t) {
323
320
  t.qySnapshotCompactor.cast_saveSnapshotInfos(), u(t);
324
321
  }
325
322
 
@@ -14,8 +14,6 @@ export default class QyKVDataCleaner_Worker extends QyMessageWorker {
14
14
  cast_cleanPMFiles(pMChangeList: any): void;
15
15
  cast_cleanVLFiles(snapshotNum: any, vLVersion: any): void;
16
16
  cast_removeSnapshotsFiles(snapshotNumVersionList: any): void;
17
- _op_start(): void;
18
- _op_stop(): void;
19
17
  _op_cleanAclFiles(maxSnapshotNum: any): Promise<void>;
20
18
  _op_cleanPMFiles(pMChangeList: any): Promise<void>;
21
19
  _op_cleanVLFiles(snapshotNum: any, vLVersion: any): Promise<void>;
@@ -65,8 +65,6 @@ export default class extends s {
65
65
  cast_removeSnapshotsFiles(s) {
66
66
  this.removeSnapshotsFiles(s);
67
67
  }
68
- _op_start() {}
69
- _op_stop() {}
70
68
  async _op_cleanAclFiles(s) {
71
69
  var e = this, a = s, s = e.aclFolder;
72
70
  if (await F(s)) {
@@ -5,9 +5,9 @@ export declare class QyKVDataLoader {
5
5
  aclFolder: any;
6
6
  snapshotFolder: any;
7
7
  loadedMaxAclNum: number;
8
- aclKeyValueMap: any;
8
+ aclKeyValueMap: Map<any, any>;
9
9
  maxChangeId: number;
10
10
  qySnapshots: QySnapshots;
11
11
  constructor(kvFolder: any, options?: any);
12
- load(): Promise<any[]>;
12
+ load(): Promise<(number | Map<any, any> | QySnapshots)[]>;
13
13
  }
@@ -8,11 +8,11 @@ import {
8
8
  } from "node:path";
9
9
 
10
10
  import {
11
- folderOrFileExists as F
11
+ folderOrFileExists as g
12
12
  } from "./QyUtils.js";
13
13
 
14
14
  import {
15
- readAclBuffer as g
15
+ readAclBuffer as F
16
16
  } from "./QyAcl.js";
17
17
 
18
18
  import {
@@ -20,7 +20,7 @@ import {
20
20
  } from "./QySnapshots.js";
21
21
 
22
22
  import {
23
- getDefaultOptions as r
23
+ getDefaultOptions as l
24
24
  } from "./QyDefaultOptions.js";
25
25
 
26
26
  class a {
@@ -29,12 +29,12 @@ class a {
29
29
  aclFolder;
30
30
  snapshotFolder;
31
31
  loadedMaxAclNum = 0;
32
- aclKeyValueMap = {};
32
+ aclKeyValueMap = new Map();
33
33
  maxChangeId = 0;
34
34
  qySnapshots;
35
35
  constructor(a, t = void 0) {
36
36
  t = {
37
- ...r("QyKVDataLoader"),
37
+ ...l("QyKVDataLoader"),
38
38
  ...t
39
39
  };
40
40
  var s = o(a, "snapshot");
@@ -43,26 +43,30 @@ class a {
43
43
  }
44
44
  async load() {
45
45
  var a = this.qySnapshots, [ t ] = await Promise.all([ (async a => {
46
- if (a = a.aclFolder, await F(a)) return (await x(a)).filter(a => /^[1-9]/.test(a)).map(a => parseInt(a));
46
+ if (a = a.aclFolder, await g(a)) return (await x(a)).filter(a => /^[1-9]/.test(a)).map(a => parseInt(a));
47
47
  })(this), a.loadSnapshotInfos() ]);
48
48
  let {
49
49
  maxSnapshotNum: s,
50
50
  snapshotMaxChangeId: o
51
51
  } = a;
52
- if (this.maxChangeId = o, t) {
53
- var e = this, r = t.filter(a => a > s), {
54
- aclKeyValueMap: l,
55
- qySnapshots: i,
56
- options: t
57
- } = (r.sort((a, t) => a - t), e), n = t.autoRepairAclFile, p = await Promise.all(r.map(async a => u(v(e, a))));
58
- for (let a = 0; a < r.length; ++a) {
59
- var d = r[a], h = v(e, d), m = await g(h, p[a], n, e.maxChangeId), c = m.length;
60
- if (0 < c) {
61
- for (let a = 0; a < c; a += 2) i.applyCmdObj(m[a + 1], l), e.maxChangeId = m[a];
62
- e.loadedMaxAclNum = d;
52
+ if (this.maxChangeId = o, void 0 !== t && 0 < t.length) {
53
+ t = t.filter(a => a > s);
54
+ if (0 < t.length) {
55
+ var e = this, l = t, {
56
+ aclKeyValueMap: r,
57
+ qySnapshots: i,
58
+ options: t
59
+ } = (l.sort((a, t) => a - t), e), n = t.autoRepairAclFile, p = await Promise.all(l.map(async a => u(v(e, a))));
60
+ for (let a = 0; a < l.length; ++a) {
61
+ var d = l[a], h = v(e, d), m = await F(h, p[a], n, e.maxChangeId), c = m.length;
62
+ if (0 < c) {
63
+ for (let a = 0; a < c; a += 2) i.applyCmdObj(m[a + 1], r),
64
+ e.maxChangeId = m[a];
65
+ e.loadedMaxAclNum = d;
66
+ }
63
67
  }
68
+ await 0;
64
69
  }
65
- await 0;
66
70
  }
67
71
  var {
68
72
  maxChangeId: t,
@@ -49,7 +49,7 @@ export default class extends a {
49
49
  qySnapshotSaver: n
50
50
  } = this;
51
51
  this.maxChangeId = a, this.snapshotMaxChangeId = a, this.currentAclNum = (t || s) + 1,
52
- o && o.start(c(this)), n.start(a, t, e);
52
+ o && o.call_start(v(this)), n.call_start(a, t, e);
53
53
  }
54
54
  async _op_stop() {
55
55
  var {
@@ -60,8 +60,8 @@ export default class extends a {
60
60
  maxChangeId: o,
61
61
  snapshotMaxChangeId: n
62
62
  } = this;
63
- return this.isStopping = !0, a && await a.stop(), s.saveSnapshotAtStop && n < o && (this.isSavingSnapshot && await new Promise(a => this.saveSnapshotResolve = a),
64
- r.log(`Saving snapshot ${e} at stop.`), t.cast_saveSnapshot(e)), t.stop();
63
+ return this.isStopping = !0, a && await a.call_stop(), s.saveSnapshotAtStop && n < o && (this.isSavingSnapshot && await new Promise(a => this.saveSnapshotResolve = a),
64
+ r.log(`Saving snapshot ${e} at stop.`), t.cast_saveSnapshot(e)), t.call_stop();
65
65
  }
66
66
  call_save(a, s, t) {
67
67
  return h(this, a, s, t, !0);
@@ -84,15 +84,15 @@ function h(a, s, t, e, o = !1) {
84
84
  options: h,
85
85
  snapshotMaxChangeId: i,
86
86
  currentAclNum: p,
87
- isSavingSnapshot: S
87
+ isSavingSnapshot: l
88
88
  } = a;
89
- let v;
90
- return n && (o ? v = n.call_save(s, t) : n.cast_save(s, t)), r.cast_save(s, t, e),
91
- a.maxChangeId = s, !S && s - i >= h.snapshotMaxChangeCount && (++a.currentAclNum,
92
- n && n.cast_switch(c(a)), r.cast_saveSnapshot(p), a.snapshotMaxChangeId = s,
93
- a.isSavingSnapshot = !0), v;
89
+ let S;
90
+ return n && (o ? S = n.call_save(s, t) : n.cast_save(s, t)), r.cast_save(s, t, e),
91
+ a.maxChangeId = s, !l && s - i >= h.snapshotMaxChangeCount && (++a.currentAclNum,
92
+ n && n.cast_switch(v(a)), r.cast_saveSnapshot(p), a.snapshotMaxChangeId = s,
93
+ a.isSavingSnapshot = !0), S;
94
94
  }
95
95
 
96
- function c(a) {
96
+ function v(a) {
97
97
  return t(a.aclFolder, a.currentAclNum + "_acl.txt");
98
98
  }
@@ -1,5 +1,7 @@
1
1
  import { QyOpRunner } from "./QyOpRunner.ts";
2
2
  export declare class QyMessageWorker extends QyOpRunner {
3
3
  constructor(options: any);
4
+ call_start(...argList: any[]): any;
5
+ call_stop(...argList: any[]): any;
4
6
  postParent(msgName: any, ...argList: any[]): void;
5
7
  }