datafolder 1.0.10 → 1.0.12

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.
Files changed (72) hide show
  1. package/{internal.md → Internal.md} +8 -1
  2. package/README.md +15 -1
  3. package/SKILL.md +191 -0
  4. package/SSD.md +3 -3
  5. package/package.json +2 -2
  6. package/scripts/flights2.js +2 -0
  7. package/src/QyAcl.d.ts +13 -7
  8. package/src/QyAcl.js +122 -138
  9. package/src/QyAclSaver.js +2 -2
  10. package/src/QyAclSaver_Worker.d.ts +2 -2
  11. package/src/QyAclWriter.d.ts +1 -1
  12. package/src/QyBatch.d.ts +8 -11
  13. package/src/QyBatch.js +239 -211
  14. package/src/QyBinWriter.d.ts +2 -2
  15. package/src/QyBinWriter.js +15 -15
  16. package/src/QyCD.d.ts +2 -2
  17. package/src/QyCD.js +29 -29
  18. package/src/QyCache.d.ts +6 -1
  19. package/src/QyCache.js +72 -53
  20. package/src/QyCompressor.d.ts +2 -2
  21. package/src/QyCompressor.js +13 -13
  22. package/src/QyDB.d.ts +1 -22
  23. package/src/QyDB.js +23 -78
  24. package/src/QyDefaultOptions.js +5 -0
  25. package/src/QyDir.js +26 -27
  26. package/src/QyExpire.d.ts +21 -0
  27. package/src/QyExpire.js +113 -0
  28. package/src/QyExpireClock.d.ts +15 -0
  29. package/src/QyExpireClock.js +53 -0
  30. package/src/QyExpire_Worker.d.ts +20 -0
  31. package/src/QyExpire_Worker.js +127 -0
  32. package/src/QyFile.js +36 -25
  33. package/src/QyFileContentUtils.js +21 -21
  34. package/src/QyItem.d.ts +1 -0
  35. package/src/QyItem.js +15 -9
  36. package/src/QyJsonSaver.d.ts +1 -1
  37. package/src/QyJsonSaver.js +1 -1
  38. package/src/QyKVData.d.ts +5 -2
  39. package/src/QyKVData.js +126 -114
  40. package/src/QyKVDataCleaner.js +2 -2
  41. package/src/QyKVDataCleaner_Worker.js +37 -37
  42. package/src/QyKVDataSaver.js +2 -2
  43. package/src/QyKVDataSaver_Worker.d.ts +2 -2
  44. package/src/QyKVDataSaver_Worker.js +5 -5
  45. package/src/QyLogFileSaver.js +2 -2
  46. package/src/QyLogger.d.ts +1 -0
  47. package/src/QyLogger.js +1 -0
  48. package/src/QyMessageWorker.d.ts +1 -1
  49. package/src/QyMessageWorker.js +10 -10
  50. package/src/QyMessager.d.ts +1 -1
  51. package/src/QyMessager.js +37 -36
  52. package/src/QyMessager_Run.js +12 -8
  53. package/src/QyQueue.js +8 -12
  54. package/src/QySaver.d.ts +1 -1
  55. package/src/QySaver.js +1 -1
  56. package/src/QySnapshotCompactor.js +2 -2
  57. package/src/QySnapshotCompactor_Worker.d.ts +1 -1
  58. package/src/QySnapshotCompactor_Worker.js +5 -5
  59. package/src/QySnapshotSaver.js +2 -2
  60. package/src/QySnapshotSaver_Worker.js +4 -4
  61. package/src/QySnapshots.d.ts +2 -2
  62. package/src/QySnapshots.js +38 -38
  63. package/src/QyTrigger.d.ts +1 -1
  64. package/src/QyTrigger.js +20 -21
  65. package/src/QyUtils.d.ts +3 -2
  66. package/src/QyUtils.js +93 -86
  67. package/src/hackernews.js +1 -1
  68. package/src/simulate.js +6 -6
  69. package/src/simulate2.js +5 -5
  70. package/src/soc_pokec.js +1 -1
  71. package/static/codemirror.bundle/editor.bundle.js +43 -9
  72. package/static/datafolderui/QyUIFolderViewer.js +1 -5
package/src/QyLogger.js CHANGED
@@ -126,5 +126,6 @@ function p(o) {
126
126
  var f = new h();
127
127
 
128
128
  export {
129
+ a as ThreadMark,
129
130
  f as logger
130
131
  };
@@ -1,5 +1,5 @@
1
1
  import { QyOpRunner } from "./QyOpRunner.ts";
2
2
  export declare class QyMessageWorker extends QyOpRunner {
3
3
  constructor(options: any, callOpNameList?: any[], castOpNameList?: any[]);
4
- castParent(opName: any, ...args: any[]): void;
4
+ postParent(opName: any, ...args: any[]): void;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import {
2
- parentPort as o
2
+ parentPort as t
3
3
  } from "node:worker_threads";
4
4
 
5
5
  import {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./QyDefaultOptions.js";
8
8
 
9
9
  import {
10
- logger as n
10
+ logger as p
11
11
  } from "./QyLogger.js";
12
12
 
13
13
  import {
@@ -19,7 +19,7 @@ class e extends s {
19
19
  super(s = {
20
20
  ...a("QyMessageWorker"),
21
21
  ...s
22
- }, e, r), o?.on("message", async s => {
22
+ }, e, r), t?.on("message", async s => {
23
23
  var {
24
24
  opName: e,
25
25
  _cast: r
@@ -27,22 +27,22 @@ class e extends s {
27
27
  if (e) {
28
28
  var a = s.args || [];
29
29
  try {
30
- var t = await this[e](...a);
31
- r || o?.postMessage({
30
+ var o = await this[e](...a);
31
+ r || t?.postMessage({
32
32
  ack: e,
33
- result: t
33
+ result: o
34
34
  }), "stop" == e && process.exit();
35
35
  } catch (s) {
36
- n.error(`Running ${e} failed:`, s), r || o?.postMessage({
36
+ p.error(`Running ${e} failed:`, s), r || t?.postMessage({
37
37
  ack: e,
38
38
  exception: s
39
39
  });
40
40
  }
41
- } else n.warn("Msg ignored:", s);
41
+ } else p.warn("Msg ignored:", s);
42
42
  });
43
43
  }
44
- castParent(s, ...e) {
45
- o?.postMessage({
44
+ postParent(s, ...e) {
45
+ t?.postMessage({
46
46
  opName: s,
47
47
  args: e,
48
48
  _cast: !0
@@ -3,7 +3,7 @@ export declare class QyMessager {
3
3
  worker: any;
4
4
  receiverQueueMap: any;
5
5
  options: any;
6
- constructor(parent: any, workerTypeFileName: any, initArgMap: any, options: any, callOpNameList?: any[], castOpNameList?: any[]);
6
+ constructor(workerTypeFileName: any, initArgMap: any, options: any, callOpNameList?: any[], castOpNameList?: any[], workerMsgProcessor?: this);
7
7
  start(...args: any[]): any;
8
8
  stop(...args: any[]): any;
9
9
  castWorker(opName: any, args: any): void;
package/src/QyMessager.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
- join as t,
2
+ join as s,
3
3
  extname as e
4
4
  } from "node:path";
5
5
 
6
6
  import {
7
- Worker as p,
8
- setEnvironmentData as s
7
+ Worker as l,
8
+ setEnvironmentData as o
9
9
  } from "node:worker_threads";
10
10
 
11
11
  import {
@@ -17,7 +17,7 @@ import {
17
17
  } from "./QyLogger.js";
18
18
 
19
19
  import {
20
- setPromise as l,
20
+ setPromise as p,
21
21
  __dirname as m
22
22
  } from "./QyUtils.js";
23
23
 
@@ -32,50 +32,51 @@ class r {
32
32
  worker;
33
33
  receiverQueueMap;
34
34
  options;
35
- constructor(e, r, t, s, o = [], a = []) {
35
+ constructor(e, r, s, o = [], t = [], a = this) {
36
36
  s = {
37
37
  ...i("QyMessager"),
38
38
  ...s
39
- }, r += k, Object.assign(this, {
40
- parent: e,
41
- workerTypeFileName: r,
42
- initArgMap: t,
39
+ }, Object.assign(this, {
40
+ workerMsgProcessor: a,
41
+ workerTypeFileName: e,
42
+ initArgMap: r,
43
43
  options: s,
44
44
  receiverQueueMap: {}
45
45
  });
46
46
  for (let r of o) this[r] || (this[r] = (...e) => this.callWorker(r, e));
47
- for (let r of a) this[r] || (this[r] = (...e) => this.castWorker(r, e));
47
+ for (let r of t) this[r] || (this[r] = (...e) => this.castWorker(r, e));
48
48
  }
49
49
  start(...e) {
50
- this.started = !0, s("logLevel", n.level);
51
- var i = this;
52
- if (!i.worker) {
50
+ this.started = !0, o("logLevel", n.level);
51
+ var p = this;
52
+ if (!p.worker) {
53
53
  let {
54
- workerTypeFileName: s,
54
+ workerMsgProcessor: t,
55
+ workerTypeFileName: o,
55
56
  initArgMap: e,
56
- receiverQueueMap: o
57
- } = i;
57
+ receiverQueueMap: a
58
+ } = p;
58
59
  var r = {
59
- workerTypeFileName: s,
60
+ workerTypeFileName: o,
60
61
  initArgMap: e
61
62
  };
62
- let a = i.worker = new p(t(m, "QyMessager_Run" + k), {
63
+ let i = p.worker = new l(s(m, "QyMessager_Run" + k), {
63
64
  workerData: r
64
65
  });
65
- a.on("error", e => {
66
- n.error(`Worker ${s} error:`, e);
67
- }), a.on("message", e => {
66
+ i.on("error", e => {
67
+ n.error(`Worker ${o} error:`, e);
68
+ }), i.on("message", e => {
68
69
  var {
69
70
  opName: r,
70
- ack: t,
71
- result: s
71
+ ack: s,
72
+ result: o
72
73
  } = e;
73
74
  r ? "%o_" == r ? n.handleOutMsg(e) : "%e_" == r ? n.handleErrMsg(e) : (e = e.args || [],
74
- (i.parent || i)[r](...e)) : o[t]?.shift().resolve(s);
75
- }), a.on("exit", e => {
76
- for (var r in a.removeAllListeners(), 0 != e ? n.warn(`Worker ${s} stopped with exitCode ` + e) : n.info(`Worker ${s} stopped.`),
77
- o) for (var t = o[r]; !t.isEmpty; ) t.shift()?.resolve();
78
- i.worker = void 0;
75
+ t[r](...e)) : a[s]?.shift().resolve(o);
76
+ }), i.on("exit", e => {
77
+ for (var r in i.removeAllListeners(), 0 != e ? n.warn(`Worker ${o} stopped with exitCode ` + e) : n.info(`Worker ${o} stopped.`),
78
+ a) for (var s = a[r]; !s.isEmpty; ) s.shift()?.resolve();
79
+ p.worker = void 0;
79
80
  });
80
81
  }
81
82
  return this.callWorker("start", e);
@@ -92,18 +93,18 @@ class r {
92
93
  }
93
94
  callWorker(e, r) {
94
95
  var {
95
- worker: t,
96
- receiverQueueMap: s,
97
- options: o
96
+ worker: s,
97
+ receiverQueueMap: o,
98
+ options: t
98
99
  } = this;
99
- t.postMessage({
100
+ s.postMessage({
100
101
  opName: e,
101
102
  args: r
102
103
  });
103
- let a = s[e];
104
- a = a || (s[e] = new h(o));
105
- t = l({});
106
- return a.push(t), t.promise;
104
+ let a = o[e];
105
+ a = a || (o[e] = new h(t));
106
+ s = p({});
107
+ return a.push(s), s.promise;
107
108
  }
108
109
  }
109
110
 
@@ -1,31 +1,35 @@
1
1
  var t = this && this.__rewriteRelativeImportExtension || function(e, i) {
2
- return "string" == typeof e && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(e, r, t, o, a) {
3
- return r ? i ? ".jsx" : ".js" : !t || o && a ? t + o + "." + a.toLowerCase() + "js" : e;
2
+ return "string" == typeof e && /^\.\.?\//.test(e) ? e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(e, r, t, a, o) {
3
+ return r ? i ? ".jsx" : ".js" : !t || a && o ? t + a + "." + o.toLowerCase() + "js" : e;
4
4
  }) : e;
5
5
  };
6
6
 
7
7
  import {
8
- join as o
8
+ extname as e,
9
+ join as a
9
10
  } from "node:path";
10
11
 
11
12
  import {
12
- getEnvironmentData as a,
13
+ getEnvironmentData as o,
13
14
  workerData as i
14
15
  } from "node:worker_threads";
15
16
 
16
17
  import {
17
- logger as s
18
+ logger as s,
19
+ ThreadMark as n
18
20
  } from "./QyLogger.js";
19
21
 
20
22
  import {
21
- __dirname as n
23
+ __dirname as m
22
24
  } from "./QyUtils.js";
23
25
 
26
+ let l = e(import.meta.filename);
27
+
24
28
  (async () => {
25
- s.level = a("logLevel");
29
+ s.level = o("logLevel");
26
30
  var {
27
31
  workerTypeFileName: e,
28
32
  initArgMap: r
29
33
  } = i;
30
- new (await import(t("file://" + o(n, e)))).default(r);
34
+ new (await import(t("file://" + a(m, e + l)))).default(r), s.log("" + n + e);
31
35
  })();
package/src/QyQueue.js CHANGED
@@ -1,12 +1,8 @@
1
- import {
2
- arrayLast as t
3
- } from "./QyUtils.js";
4
-
5
1
  import {
6
2
  getDefaultOptions as e
7
3
  } from "./QyDefaultOptions.js";
8
4
 
9
- class s {
5
+ class t {
10
6
  options;
11
7
  queue = [];
12
8
  firstIdx = 0;
@@ -21,7 +17,7 @@ class s {
21
17
  return this.queue[this.firstIdx];
22
18
  }
23
19
  get last() {
24
- return this.isEmpty ? void 0 : t(this.queue);
20
+ return this.isEmpty ? void 0 : this.queue.at(-1);
25
21
  }
26
22
  get isEmpty() {
27
23
  return this.firstIdx >= this.queue.length;
@@ -44,15 +40,15 @@ class s {
44
40
  if (!this.isEmpty) {
45
41
  var t = this.first, e = this, {
46
42
  queue: s,
47
- firstIdx: r,
48
- options: i
49
- } = e, u = s.length, h = r + 1;
43
+ firstIdx: i,
44
+ options: r
45
+ } = e, u = s.length, h = i + 1;
50
46
  if (u <= h) e.reset(); else {
51
47
  var a = u - h;
52
- if (h > i.maxLenBeforeRecycle || a <= h) {
48
+ if (h > r.maxLenBeforeRecycle || a <= h) {
53
49
  for (let t = 0; t < a; ++t) s[t] = s[t + h];
54
50
  e.firstIdx = 0, s.length = a;
55
- } else e.firstIdx = h, s[r] = void 0;
51
+ } else e.firstIdx = h, s[i] = void 0;
56
52
  }
57
53
  return t;
58
54
  }
@@ -60,5 +56,5 @@ class s {
60
56
  }
61
57
 
62
58
  export {
63
- s as QyQueue
59
+ t as QyQueue
64
60
  };
package/src/QySaver.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare class QySaver {
6
6
  processAfterLoad(data: any): any;
7
7
  processBeforeSave(data: any): Buffer<any>;
8
8
  removeFile(fileName: any): Promise<void>;
9
- loadFromFile(fileName: any, defaultValue: any): Promise<any>;
9
+ loadFromFile(fileName: any, defaultValue?: any): Promise<any>;
10
10
  saveToFile(data: any, fileName: any, override?: boolean): Promise<boolean>;
11
11
  _saveTmpFileAndRename(contentBuffer: any, tmpFilePath: any, targetFilePath: any): Promise<boolean>;
12
12
  _saveContent(filePath: any, contentBuffer: any): Promise<number | false>;
package/src/QySaver.js CHANGED
@@ -53,7 +53,7 @@ class i {
53
53
  m.warn(`Deleting ${r} failed:`, e);
54
54
  }
55
55
  }
56
- async loadFromFile(r, t) {
56
+ async loadFromFile(r, t = void 0) {
57
57
  r = f(this.dataFolder, r);
58
58
  if (null != t && !await u(r)) return t;
59
59
  try {
@@ -8,13 +8,13 @@ import {
8
8
 
9
9
  class s extends o {
10
10
  constructor(o, s, t) {
11
- super(o, "QySnapshotCompactor_Worker", {
11
+ super("QySnapshotCompactor_Worker", {
12
12
  kvFolder: s,
13
13
  options: t = {
14
14
  ...a("QySnapshotCompactor"),
15
15
  ...t
16
16
  }
17
- }, t, [], [ "compactSnapshots", "saveSnapshotInfos" ]);
17
+ }, t, [], [ "compactSnapshots", "saveSnapshotInfos" ], o);
18
18
  }
19
19
  }
20
20
 
@@ -6,7 +6,7 @@ export default class QySnapshotCompactor_Worker extends QyMessageWorker {
6
6
  qyKVDataCleaner: any;
7
7
  pMInfoMap: any;
8
8
  vLInfoMap: any;
9
- combinedSnapshotNumVersionList: any[];
9
+ combinedSnapshotNumVerList: any[];
10
10
  constructor({ kvFolder, options }: {
11
11
  kvFolder: any;
12
12
  options: any;
@@ -35,7 +35,7 @@ export default class extends a {
35
35
  qyKVDataCleaner;
36
36
  pMInfoMap = {};
37
37
  vLInfoMap = {};
38
- combinedSnapshotNumVersionList = [];
38
+ combinedSnapshotNumVerList = [];
39
39
  constructor({
40
40
  kvFolder: a,
41
41
  options: s
@@ -97,7 +97,7 @@ export default class extends a {
97
97
  let {
98
98
  qySnapshots: o,
99
99
  vLInfoMap: e,
100
- combinedSnapshotNumVersionList: p
100
+ combinedSnapshotNumVerList: p
101
101
  } = t, n = o.getMaxCombinedSnapshot(a), {
102
102
  snapshotNum: i,
103
103
  info: r,
@@ -122,17 +122,17 @@ export default class extends a {
122
122
  }
123
123
  await o.saveKeyValueMap(n), e[i] = r, s.combinationUpdate = {
124
124
  snapshotNum: i,
125
- combinedSnapshotNumVersionList: p,
125
+ combinedSnapshotNumVerList: p,
126
126
  posMap: n.posMap
127
127
  };
128
- })(this, s, t)), await Promise.all(e), this.castParent("onCompactUpdates", t);
128
+ })(this, s, t)), await Promise.all(e), this.postParent("onCompactUpdates", t);
129
129
  }
130
130
  async _op_saveSnapshotInfos() {
131
131
  var a, s, {
132
132
  qySnapshots: o,
133
133
  pMInfoMap: t,
134
134
  vLInfoMap: e,
135
- combinedSnapshotNumVersionList: p,
135
+ combinedSnapshotNumVerList: p,
136
136
  qyKVDataCleaner: n
137
137
  } = this, i = (Object.assign(this, {
138
138
  pMInfoMap: {},
@@ -8,13 +8,13 @@ import {
8
8
 
9
9
  class e extends s {
10
10
  constructor(s, e, a) {
11
- super(s, "QySnapshotSaver_Worker", {
11
+ super("QySnapshotSaver_Worker", {
12
12
  kvFolder: e,
13
13
  options: a = {
14
14
  ...o("QySnapshotSaver"),
15
15
  ...a
16
16
  }
17
- }, a, [], [ "saveSnapshot", "castSave", "releaseSnapshot" ]);
17
+ }, a, [], [ "saveSnapshot", "castSave", "releaseSnapshot" ], s);
18
18
  }
19
19
  }
20
20
 
@@ -87,7 +87,7 @@ export default class extends a {
87
87
  snapshotNum: a,
88
88
  maxChangeId: t
89
89
  } = await a, {
90
- emptySnapshotNumVersionList: s,
90
+ emptySnapshotNumVerList: s,
91
91
  pMChangeList: o,
92
92
  vLChange: n,
93
93
  snapshotInfoMap: p,
@@ -113,14 +113,14 @@ export default class extends a {
113
113
  })(this)).prefixPM, delete (u = {
114
114
  ...s
115
115
  }).keyValueMap, delete s.posMap, s.isOut = !0, m.info("Sending snapshot " + s.snapshotNum)),
116
- this.castParent("onSnapshotSavedChangeId", t, u);
116
+ this.postParent("onSnapshotSavedChangeId", t, u);
117
117
  }
118
118
  }
119
119
 
120
120
  function h(a, s, e, t) {
121
121
  var o = (a => {
122
122
  var s, e = a.qySnapshots, {
123
- emptySnapshotNumVersionList: t,
123
+ emptySnapshotNumVerList: t,
124
124
  combiningSnapshotList: a,
125
125
  pMCompactSnapshotList: o
126
126
  } = e.calOutdates(), n = {}, p = [], h = [], r = [];
@@ -155,7 +155,7 @@ function h(a, s, e, t) {
155
155
  };
156
156
  }
157
157
  return {
158
- emptySnapshotNumVersionList: t,
158
+ emptySnapshotNumVerList: t,
159
159
  pMChangeList: h,
160
160
  vLChange: r,
161
161
  snapshotInfoMap: n,
@@ -21,7 +21,7 @@ export declare class QySnapshots {
21
21
  loadPartialPosMapBuffer(snapshot: any, prefix: any, buffer: any): void;
22
22
  delSnapshot(snapshot: any): void;
23
23
  calOutdates(): {
24
- emptySnapshotNumVersionList: any[];
24
+ emptySnapshotNumVerList: any[];
25
25
  combiningSnapshotList: any[];
26
26
  pMCompactSnapshotList: any[];
27
27
  vLCompactSnapshotList: any[];
@@ -36,4 +36,4 @@ export declare class QySnapshots {
36
36
  }
37
37
  export declare function iterPMBuffer(buffer: any, fun: any): void;
38
38
  export declare function loadPrefixPMFile(prefixPMFilePath: any): Promise<{}>;
39
- export declare function getSnapshotInfoFileName(snapshotNum: any, version: any): string;
39
+ export declare function getInfoFileName(snapshotNum: any, version: any): string;
@@ -32,9 +32,9 @@ import {
32
32
  } from "./QyBinWriter.js";
33
33
 
34
34
  import {
35
- bufferToNums as g,
36
- numsToBuffer as y,
37
- applyAclChange as c,
35
+ bufferToNums as y,
36
+ numsToBuffer as c,
37
+ applyAclChange as g,
38
38
  iterCmdKeys as S
39
39
  } from "./QyAcl.js";
40
40
 
@@ -46,7 +46,7 @@ import {
46
46
  logger as P
47
47
  } from "./QyLogger.js";
48
48
 
49
- let x = Array.isArray, F = Buffer.from("\n"), L = Buffer.from("'"), O = Buffer.from("z"), V = L[0], J = O[0];
49
+ let x = Array.isArray, F = Buffer.from("\n"), L = Buffer.from("'"), O = Buffer.from("z"), j = L[0], J = O[0];
50
50
 
51
51
  class t {
52
52
  snapshotFolder;
@@ -98,7 +98,7 @@ class t {
98
98
  outdatedCount: 0
99
99
  }), t = (++this.snapshotCount, t > e && (e = t, n = a.maxChangeId),
100
100
  this), a = o;
101
- t = B(t, a), P.info("Loading " + t), a.prefixPM = await b(t);
101
+ t = N(t, a), P.info("Loading " + t), a.prefixPM = await b(t);
102
102
  })), Object.assign(this, {
103
103
  maxSnapshotNum: e,
104
104
  snapshotMaxChangeId: n
@@ -173,7 +173,7 @@ class t {
173
173
  }
174
174
  S(t, t => {
175
175
  t in o || (o[t] = this.getValueSync(t)), this.removeKey(t);
176
- }), c(o, t);
176
+ }), g(o, t);
177
177
  }
178
178
  getValueSync(t) {
179
179
  var o = ((t, o) => {
@@ -190,7 +190,7 @@ class t {
190
190
  posMap: n,
191
191
  prefixPM: s
192
192
  } = o;
193
- if (s = s[a]) return [ s, e ] = s, s = N(t, t.getPMFilePath(o), s, e),
193
+ if (s = s[a]) return [ s, e ] = s, s = T(t, t.getPMFilePath(o), s, e),
194
194
  t.loadPartialPosMapBuffer(o, a, s), n;
195
195
  })(t, n, s);
196
196
  if (i && o in i) return n;
@@ -207,7 +207,7 @@ class t {
207
207
  var [ e, a ] = a;
208
208
  if (0 != a) {
209
209
  var n = this;
210
- if (o = n.getVLFilePath(o), n = N(n, o, e, a)) return (o = n[0]) == V ? n.toString("utf8", 1) : o == J ? m.zstdDecompressSync(n.subarray(1)).toString() : (e = JSON.parse(n),
210
+ if (o = n.getVLFilePath(o), n = T(n, o, e, a)) return (o = n[0]) == j ? n.toString("utf8", 1) : o == J ? m.zstdDecompressSync(n.subarray(1)).toString() : (e = JSON.parse(n),
211
211
  I(t) ? f(e) : e);
212
212
  }
213
213
  }
@@ -218,7 +218,7 @@ class t {
218
218
  posMap: e,
219
219
  prefixPM: n
220
220
  } = a, s = (delete n[t], this).keyToSnapshotMap;
221
- j(o, (t, o) => {
221
+ V(o, (t, o) => {
222
222
  t in s ? ++a.outdatedCount : (e[t] = o, s[t] = a);
223
223
  });
224
224
  }
@@ -227,25 +227,25 @@ class t {
227
227
  o(this, this.getPMFilePath(t));
228
228
  }
229
229
  calOutdates() {
230
- var t, o = [], a = [], e = [], n = [], {
231
- options: s,
232
- numToSnapshotMap: r
230
+ var t, o, a, e = [], n = [], s = [], r = [], {
231
+ options: i,
232
+ numToSnapshotMap: p
233
233
  } = this, {
234
- pMOutdatedPercent: i,
235
- vLOutdatedPercent: p
236
- } = s;
237
- for (t in r) {
238
- var u, f = r[t];
239
- f.isOut || (100 == (u = Q(f)) ? (this.delSnapshot(f), o.push([ t, f.info.verList[0] ])) : p < u ? (T(f) ? a : n).push(f) : Math.floor(f.outdatedCount / f.info.totalCount * 100) > i ? e.push(f) : (u = this,
240
- f.info.totalCount < u.options.minSnapshotKeyCount && T(f) && a.push(f)));
234
+ pMOutdatedPercent: u,
235
+ vLOutdatedPercent: f
236
+ } = i;
237
+ for (t in p) {
238
+ var h, l = p[t];
239
+ l.isOut || (100 == (h = Q(l)) ? (this.delSnapshot(l), e.push([ t, l.info.verList[0] ])) : f < h ? (B(l) ? n : r).push(l) : Math.floor(l.outdatedCount / l.info.totalCount * 100) > u ? s.push(l) : (h = this,
240
+ l.info.totalCount < h.options.minSnapshotKeyCount && B(l) && n.push(l)));
241
241
  }
242
- return 1 == a.length && Q(a[0]) < p && (a.length = 0), 0 < e.length && P.log("pMCompacts:" + e.map(t => t.snapshotNum)),
243
- 0 < n.length && P.log("vLCompacts:" + n.map(t => t.snapshotNum)), 0 < a.length && P.log("combiningSnapshots:" + a.map(t => t.snapshotNum + "." + t.info.verList[0])),
244
- {
245
- emptySnapshotNumVersionList: o,
246
- combiningSnapshotList: a,
247
- pMCompactSnapshotList: e,
248
- vLCompactSnapshotList: n
242
+ 1 == n.length && Q(n[0]) < f && (n.length = 0);
243
+ for ([ o, a ] of [ [ "pMCompacts", s ], [ "vLCompacts", r ], [ "combiningSnapshots", n ] ]) 0 < a.length && P.log(o + ":" + a.map(t => t.snapshotNum + "." + t.info.verList[0]));
244
+ return {
245
+ emptySnapshotNumVerList: e,
246
+ combiningSnapshotList: n,
247
+ pMCompactSnapshotList: s,
248
+ vLCompactSnapshotList: r
249
249
  };
250
250
  }
251
251
  getMaxCombinedSnapshot(t) {
@@ -278,7 +278,7 @@ class t {
278
278
  outdatedCount: r,
279
279
  totalCount: i
280
280
  } = o, p = s[0], s = s[0] = e + n;
281
- return o.outdated = Math.floor(100 * r / i) + "%", P.log(`Saving snapshotInfo:${t}.${s} oldVersion:` + p),
281
+ return o.outdated = Math.floor(100 * r / i) + "%", P.log(`Saving snapshotInfo:${p ? t + `.${p}->` : ""}${t}.` + s),
282
282
  !!await a.saveToFile({
283
283
  ...o,
284
284
  verList: void 0
@@ -295,12 +295,12 @@ class t {
295
295
  for (a of o = o || Object.keys(s).sort()) {
296
296
  null == f ? f = w(a) : a.startsWith(f) || (i[f] = [ p, u ], f = w(a),
297
297
  p += u, u = 0);
298
- var h = Buffer.from(a), l = y(s[a]);
298
+ var h = Buffer.from(a), l = c(s[a]);
299
299
  r.save([ h, l ]), u += h.length + l.length;
300
300
  }
301
301
  return null != f && (i[f] = [ p, u ]), Promise.all([ r.stop(), ((t, o) => {
302
- var a, e = new M(), n = (e.start(B(t, o)), o).prefixPM;
303
- for (a in n) e.save([ Buffer.from(a), y(n[a]) ]);
302
+ var a, e = new M(), n = (e.start(N(t, o)), o).prefixPM;
303
+ for (a in n) e.save([ Buffer.from(a), c(n[a]) ]);
304
304
  return e.stop();
305
305
  })(this, t) ]);
306
306
  }
@@ -320,11 +320,11 @@ class t {
320
320
  }
321
321
  }
322
322
 
323
- function j(o, a) {
323
+ function V(o, a) {
324
324
  var e = o.length;
325
325
  for (let t = 0; t < e; ) {
326
326
  var n = t + u, s = o.toString("latin1", t, n), r = [];
327
- t = g(o, n, r), a(s, r);
327
+ t = y(o, n, r), a(s, r);
328
328
  }
329
329
  }
330
330
 
@@ -332,12 +332,12 @@ async function b(t) {
332
332
  var o = await r(t), a = o.length, e = {};
333
333
  for (let t = 0; t < a; ) {
334
334
  var n = t + k, s = e[o.toString("latin1", t, n)] = [];
335
- t = g(o, n, s);
335
+ t = y(o, n, s);
336
336
  }
337
337
  return e;
338
338
  }
339
339
 
340
- function N(t, o, a, e) {
340
+ function T(t, o, a, e) {
341
341
  var n = ((t, o) => {
342
342
  let a = t.fDMap, e = a[o];
343
343
  if (!e) {
@@ -358,7 +358,7 @@ function N(t, o, a, e) {
358
358
  return s;
359
359
  }
360
360
 
361
- function T(t) {
361
+ function B(t) {
362
362
  var {
363
363
  keyValueMap: o,
364
364
  prefixPM: a
@@ -366,7 +366,7 @@ function T(t) {
366
366
  return o || null == a || h(t.prefixPM);
367
367
  }
368
368
 
369
- function B(t, o) {
369
+ function N(t, o) {
370
370
  var {
371
371
  snapshotNum: o,
372
372
  info: a
@@ -403,7 +403,7 @@ function D(t, o) {
403
403
 
404
404
  export {
405
405
  t as QySnapshots,
406
- j as iterPMBuffer,
406
+ V as iterPMBuffer,
407
407
  b as loadPrefixPMFile,
408
- D as getSnapshotInfoFileName
408
+ D as getInfoFileName
409
409
  };
@@ -4,7 +4,7 @@ export declare class QyTriggerNode {
4
4
  children: {};
5
5
  triggerMap: {};
6
6
  constructor(name?: any, parent?: any);
7
- insertTrigger(triggerName: any, fileNamePath: any, propNamePathList: any, fun: any): void;
7
+ insertTrigger(triggerName: any, fileNamePath: any, propNamePathList: any, fun?: any): void;
8
8
  removeTrigger(triggerName: any, fileNamePath: any): boolean;
9
9
  get isEmpty(): boolean;
10
10
  removeEmptyNodes(): void;