datafolder 1.0.51 → 1.0.53
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/ChangeLog.md +4 -0
- package/package.json +1 -1
- package/scripts/airbnb1.js +80 -0
- package/scripts/convertBinFiles.js +10 -8
- package/scripts/flights2.js +1 -1
- package/src/QyAcl.d.ts +1 -1
- package/src/QyAcl.js +31 -33
- package/src/QyAclSaver.js +3 -3
- package/src/QyAclWriter.d.ts +1 -1
- package/src/QyAclWriter.js +2 -2
- package/src/QyBatch.d.ts +20 -20
- package/src/QyBatch.js +237 -237
- package/src/QyBinWriter.d.ts +2 -2
- package/src/QyBinWriter.js +2 -2
- package/src/QyBinaryHeap.js +2 -2
- package/src/QyCD.js +2 -2
- package/src/QyCache.d.ts +9 -4
- package/src/QyCache.js +186 -161
- package/src/QyDB.js +2 -2
- package/src/QyDefaultOptions.js +9 -8
- package/src/QyDir.js +14 -14
- package/src/QyEmbeddingWriter.js +2 -2
- package/src/QyEmbeddings.js +2 -2
- package/src/QyExpireInfo.js +4 -4
- package/src/QyExpireMonitor.js +2 -2
- package/src/QyExpireProcessor.js +3 -3
- package/src/QyFetch.js +2 -2
- package/src/QyFile.js +10 -10
- package/src/QyFileLogger.d.ts +5 -4
- package/src/QyFileLogger.js +26 -23
- package/src/QyHNSW.js +6 -6
- package/src/QyIndexPropTree.js +2 -2
- package/src/QyIntersectNode.js +3 -3
- package/src/QyItem.js +2 -2
- package/src/QyJsonSaver.js +2 -2
- package/src/QyKVData.d.ts +4 -3
- package/src/QyKVData.js +105 -112
- package/src/QyKVDataCleaner.js +9 -12
- package/src/QyKVDataCleaner_Worker.d.ts +1 -4
- package/src/QyKVDataCleaner_Worker.js +1 -4
- package/src/QyKVDataLoader.js +2 -2
- package/src/QyKVDataSaver.js +7 -10
- package/src/QyKVDataSaver_Worker.d.ts +1 -4
- package/src/QyKVDataSaver_Worker.js +4 -7
- package/src/QyKVDataUtils.d.ts +5 -0
- package/src/QyKVDataUtils.js +31 -0
- package/src/QyLogFileSaver.d.ts +1 -1
- package/src/QyLogFileSaver.js +9 -9
- package/src/QyLogFileSaver_Worker.d.ts +11 -5
- package/src/QyLogFileSaver_Worker.js +63 -12
- package/src/QyLogger.d.ts +12 -14
- package/src/QyLogger.js +129 -92
- package/src/QyMessageWorker.js +2 -2
- package/src/QyMessager.d.ts +5 -3
- package/src/QyMessager.js +21 -18
- package/src/QyMessager_Run.js +1 -1
- package/src/QyOpRunner.js +5 -5
- package/src/QyQueue.js +2 -2
- package/src/QySaver.js +27 -27
- package/src/QySnapshotCompactor.js +3 -6
- package/src/QySnapshotCompactor_Worker.d.ts +1 -4
- package/src/QySnapshotCompactor_Worker.js +23 -25
- package/src/QySnapshotMapSaver.d.ts +1 -1
- package/src/QySnapshotMapSaver.js +7 -10
- package/src/QySnapshotMapSaver_Worker.d.ts +1 -5
- package/src/QySnapshotMapSaver_Worker.js +22 -30
- package/src/QySnapshotSaver.js +8 -11
- package/src/QySnapshotSaver_Worker.d.ts +1 -4
- package/src/QySnapshotSaver_Worker.js +16 -18
- package/src/QySnapshots.d.ts +3 -2
- package/src/QySnapshots.js +227 -221
- package/src/QyTrigger.js +5 -5
- package/src/QyUnionNode.js +3 -3
- package/src/QyUtils.d.ts +1 -1
- package/static/datafolderui/QyStyledElement.js +2 -2
- package/static/datafolderui/QyUIFolderViewer.js +2 -2
package/src/QyBinWriter.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class QyBinWriter extends QyOpRunner {
|
|
|
6
6
|
fileHandle: FileHandle | undefined;
|
|
7
7
|
constructor(options?: any, filePath?: any);
|
|
8
8
|
save(data: any, needPromise?: any): any;
|
|
9
|
-
savev(data:
|
|
9
|
+
savev(data: Buffer[], needPromise?: any): any;
|
|
10
10
|
truncate(): any;
|
|
11
11
|
switch(newFilePath: any): any;
|
|
12
12
|
_op_start(filePath?: any): Promise<this>;
|
|
@@ -14,6 +14,6 @@ export declare class QyBinWriter extends QyOpRunner {
|
|
|
14
14
|
_op_save(dataQueue: any): Promise<void> | undefined;
|
|
15
15
|
_op_truncate(): Promise<void>;
|
|
16
16
|
_op_switch(newFilePath: any): Promise<void>;
|
|
17
|
-
_saveBinData(
|
|
17
|
+
_saveBinData(binDataList: any[]): Promise<void>;
|
|
18
18
|
_getLastSaveOp(needPromise: any): any;
|
|
19
19
|
}
|
package/src/QyBinWriter.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
logger as u
|
|
28
28
|
} from "./QyLogger.js";
|
|
29
29
|
|
|
30
|
-
class
|
|
30
|
+
class a extends t {
|
|
31
31
|
filePath;
|
|
32
32
|
totalSavedSize = 0;
|
|
33
33
|
fileHandle;
|
|
@@ -148,5 +148,5 @@ async function c(t, a) {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
export {
|
|
151
|
-
QyBinWriter
|
|
151
|
+
a as QyBinWriter
|
|
152
152
|
};
|
package/src/QyBinaryHeap.js
CHANGED
package/src/QyCD.js
CHANGED
package/src/QyCache.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EventEmitter from "node:events";
|
|
2
2
|
import { QyDir } from "./QyDir.ts";
|
|
3
|
-
import {
|
|
3
|
+
import { QyLogFileSaver } from "./QyLogFileSaver.ts";
|
|
4
4
|
import { QyKVData } from "./QyKVData.ts";
|
|
5
5
|
import { QyEmbeddings } from "./QyEmbeddings.ts";
|
|
6
6
|
import type { QyFile } from "./QyFile.ts";
|
|
@@ -21,15 +21,20 @@ export declare class QyCache extends EventEmitter {
|
|
|
21
21
|
recycleRootDir: any;
|
|
22
22
|
hnswRootDir: any;
|
|
23
23
|
exclusiveFilePath: any;
|
|
24
|
+
isStopping: boolean;
|
|
25
|
+
unloadingMemory: boolean;
|
|
26
|
+
unloadInterval: any;
|
|
24
27
|
rpcFunMap: Map<string, Function>;
|
|
25
|
-
qyKVData: QyKVData
|
|
26
|
-
|
|
27
|
-
qyEmbeddings: QyEmbeddings
|
|
28
|
+
qyKVData: QyKVData;
|
|
29
|
+
qyLogFileSaver: QyLogFileSaver;
|
|
30
|
+
qyEmbeddings: QyEmbeddings;
|
|
28
31
|
constructor(rootFolder: string, options?: any, qyDB?: any);
|
|
29
32
|
start(): Promise<this>;
|
|
30
33
|
stop(): Promise<this>;
|
|
31
34
|
increaseChangeId(): number;
|
|
32
35
|
decreaseChangeId(): void;
|
|
36
|
+
removeKey(key: any): true | undefined;
|
|
37
|
+
getValueSync(key: any): any;
|
|
33
38
|
save(changeId: any, cmdArgAsListArray: any, logText: any, syncList: any, needPromise: any): any;
|
|
34
39
|
getFile(namePath: QyFile | string | string[], parentDir?: any): QyFile | undefined;
|
|
35
40
|
getOrCreateFile(namePath: QyFile | string | string[], parentDir?: any): QyFile;
|
package/src/QyCache.js
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
|
-
join as
|
|
2
|
+
join as f
|
|
3
3
|
} from "node:path";
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import e from "node:events";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
QyDir as n
|
|
9
9
|
} from "./QyDir.js";
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./
|
|
12
|
+
QyLogFileSaver as l
|
|
13
|
+
} from "./QyLogFileSaver.js";
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
|
-
QyKVData as
|
|
16
|
+
QyKVData as d
|
|
17
17
|
} from "./QyKVData.js";
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
|
-
QyTriggerNode as
|
|
21
|
-
updateTriggerNodes as
|
|
20
|
+
QyTriggerNode as F,
|
|
21
|
+
updateTriggerNodes as s
|
|
22
22
|
} from "./QyTrigger.js";
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
|
-
isString as
|
|
26
|
-
lockExclusiveFilePath as
|
|
27
|
-
unlockExclusiveFilePath as
|
|
28
|
-
ensureDir as
|
|
29
|
-
HiddenDirName as
|
|
30
|
-
AboutFileName as
|
|
25
|
+
isString as C,
|
|
26
|
+
lockExclusiveFilePath as q,
|
|
27
|
+
unlockExclusiveFilePath as a,
|
|
28
|
+
ensureDir as R,
|
|
29
|
+
HiddenDirName as g,
|
|
30
|
+
AboutFileName as r,
|
|
31
31
|
HiddenTopDirNameList as h,
|
|
32
|
-
HiddenDirNamePathList as
|
|
32
|
+
HiddenDirNamePathList as b,
|
|
33
|
+
sleep as S
|
|
33
34
|
} from "./QyUtils.js";
|
|
34
35
|
|
|
35
36
|
import {
|
|
36
|
-
dumpStructure as
|
|
37
|
+
dumpStructure as x
|
|
37
38
|
} from "./QyStructure.js";
|
|
38
39
|
|
|
39
40
|
import {
|
|
@@ -45,26 +46,22 @@ import {
|
|
|
45
46
|
} from "./QyDefaultOptions.js";
|
|
46
47
|
|
|
47
48
|
import {
|
|
48
|
-
QueryCounter as
|
|
49
|
+
QueryCounter as c
|
|
49
50
|
} from "./QyUnionNode.js";
|
|
50
51
|
|
|
51
52
|
import {
|
|
52
|
-
|
|
53
|
-
} from "./QyKVDataLoader.js";
|
|
54
|
-
|
|
55
|
-
import {
|
|
56
|
-
requireFromModCode as c
|
|
53
|
+
requireFromModCode as D
|
|
57
54
|
} from "./QyMod.js";
|
|
58
55
|
|
|
59
56
|
import {
|
|
60
|
-
logger as
|
|
57
|
+
logger as w
|
|
61
58
|
} from "./QyLogger.js";
|
|
62
59
|
|
|
63
60
|
import {
|
|
64
61
|
QyEmbeddings as m
|
|
65
62
|
} from "./QyEmbeddings.js";
|
|
66
63
|
|
|
67
|
-
class
|
|
64
|
+
class t extends e {
|
|
68
65
|
rootFolder;
|
|
69
66
|
options;
|
|
70
67
|
qyDB;
|
|
@@ -80,90 +77,106 @@ class QyCache extends r {
|
|
|
80
77
|
recycleRootDir;
|
|
81
78
|
hnswRootDir;
|
|
82
79
|
exclusiveFilePath;
|
|
80
|
+
isStopping = !1;
|
|
81
|
+
unloadingMemory = !1;
|
|
82
|
+
unloadInterval;
|
|
83
83
|
rpcFunMap = new Map();
|
|
84
84
|
qyKVData;
|
|
85
|
-
|
|
85
|
+
qyLogFileSaver;
|
|
86
86
|
qyEmbeddings;
|
|
87
|
-
constructor(
|
|
88
|
-
super(), this.rootFolder =
|
|
87
|
+
constructor(e, r, t) {
|
|
88
|
+
super(), this.rootFolder = e, r = this.options = {
|
|
89
89
|
...p("QyCache"),
|
|
90
|
-
...
|
|
90
|
+
...r
|
|
91
91
|
}, this.qyDB = t;
|
|
92
|
-
var i, t =
|
|
93
|
-
this.exclusiveFilePath =
|
|
94
|
-
this.
|
|
95
|
-
this), t = o.rootDir = new n("", !0, void 0, o),
|
|
96
|
-
t._subdirMap = new Map([ [
|
|
92
|
+
var i, t = f(e, "qykv"), o = (this.kvFolder = t, this.rpcFolder = f(e, "rpc"),
|
|
93
|
+
this.exclusiveFilePath = f(e, ".opened"), this.qyKVData = new d(t, r, this),
|
|
94
|
+
this.qyLogFileSaver = new l(this, f(e, "qylog"), r), this.qyEmbeddings = new m(this, r),
|
|
95
|
+
this), t = o.rootDir = new n("", !0, void 0, o), a = o.hiddenDir = new n(g, !0, t);
|
|
96
|
+
t._subdirMap = new Map([ [ g, a ] ]), a._subdirMap = new Map();
|
|
97
97
|
for (i of h) {
|
|
98
|
-
var
|
|
99
|
-
|
|
98
|
+
var s = new n(i, !0, a);
|
|
99
|
+
a._subdirMap.set(i, s), o[i + "RootDir"] = s;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
async start() {
|
|
103
|
+
this.isStopping = !1;
|
|
103
104
|
var {
|
|
104
|
-
rootFolder:
|
|
105
|
-
kvFolder:
|
|
105
|
+
rootFolder: e,
|
|
106
|
+
kvFolder: r,
|
|
106
107
|
options: t,
|
|
107
108
|
qyKVData: i,
|
|
108
|
-
|
|
109
|
-
exclusiveFilePath:
|
|
110
|
-
rootDir:
|
|
109
|
+
qyLogFileSaver: o,
|
|
110
|
+
exclusiveFilePath: a,
|
|
111
|
+
rootDir: s,
|
|
111
112
|
qyEmbeddings: n
|
|
112
113
|
} = this;
|
|
113
|
-
|
|
114
|
+
w.log("Starting at " + e);
|
|
114
115
|
try {
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
throw o.stop(), n.stop(), r;
|
|
116
|
+
await R(r), await Promise.all([ i.load(), q(a) ]), o.call_start(), w.setLogWorkerId(o.workerId),
|
|
117
|
+
i.start(), await n.start();
|
|
118
|
+
} catch (e) {
|
|
119
|
+
throw o.call_stop(), n.stop(), e;
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
for (
|
|
123
|
-
t.preloadFoldersAtStart && !function r
|
|
121
|
+
var l, d = this, g = d.hiddenDir;
|
|
122
|
+
for (l of b) d[l.at(-1) + "RootDir"] = g.searchOrCreateSubdir(l);
|
|
123
|
+
t.preloadFoldersAtStart && !function e(r) {
|
|
124
124
|
let {
|
|
125
125
|
subdirList: t,
|
|
126
126
|
fileMap: i
|
|
127
|
-
} =
|
|
128
|
-
for (var o of t)
|
|
129
|
-
}(
|
|
130
|
-
var
|
|
131
|
-
rootDir:
|
|
132
|
-
triggerRootDir:
|
|
133
|
-
} =
|
|
134
|
-
|
|
135
|
-
for (
|
|
127
|
+
} = r;
|
|
128
|
+
for (var o of t) e(o);
|
|
129
|
+
}(s);
|
|
130
|
+
var h = this, {
|
|
131
|
+
rootDir: r,
|
|
132
|
+
triggerRootDir: a
|
|
133
|
+
} = h;
|
|
134
|
+
r.triggerNodes = [ new F() ];
|
|
135
|
+
for (u of a.fileList) {
|
|
136
136
|
var {
|
|
137
|
-
name:
|
|
138
|
-
fileContent:
|
|
139
|
-
} =
|
|
140
|
-
|
|
137
|
+
name: u,
|
|
138
|
+
fileContent: p
|
|
139
|
+
} = u, [ p, c, D ] = p;
|
|
140
|
+
h.insertTriggerToTree(u, p, c, D);
|
|
141
141
|
}
|
|
142
|
-
var
|
|
143
|
-
for (
|
|
142
|
+
var m = this;
|
|
143
|
+
for (y of m.rpcRootDir.fileList) {
|
|
144
144
|
var {
|
|
145
|
-
name:
|
|
146
|
-
fileContent:
|
|
147
|
-
} =
|
|
148
|
-
|
|
145
|
+
name: y,
|
|
146
|
+
fileContent: v
|
|
147
|
+
} = y;
|
|
148
|
+
C(v) && m.insertRpc(y, v);
|
|
149
149
|
}
|
|
150
|
-
return t.dumpStructureAtStart && await
|
|
151
|
-
this
|
|
150
|
+
return t.dumpStructureAtStart && await x(f(e, "qystruct"), s), w.log("Started."),
|
|
151
|
+
this.unloadInterval = setInterval(() => (async t => {
|
|
152
|
+
if (!t.unloadingMemory) {
|
|
153
|
+
t.unloadingMemory = !0;
|
|
154
|
+
var i, o = t.options, a = o.maxFileCountToUnload, o = t.rootDir;
|
|
155
|
+
let e = I(t, o), r = e;
|
|
156
|
+
for (i of o.allLoadedSubdirs()) {
|
|
157
|
+
if (e > a && (r += e, e = 0, await S(0), t.isStopping)) break;
|
|
158
|
+
e += I(i, t.qyKVData.snapshotMaxChangeId);
|
|
159
|
+
}
|
|
160
|
+
r += e, global.gc && global.gc(), t.unloadingMemory = !1;
|
|
161
|
+
}
|
|
162
|
+
})(this), t.unloadMemInterval), this;
|
|
152
163
|
}
|
|
153
164
|
async stop() {
|
|
154
|
-
|
|
165
|
+
this.isStopping = !0, w.log("Stopping...");
|
|
155
166
|
var {
|
|
156
|
-
qyKVData:
|
|
157
|
-
qyEmbeddings:
|
|
158
|
-
|
|
159
|
-
exclusiveFilePath: i
|
|
167
|
+
qyKVData: e,
|
|
168
|
+
qyEmbeddings: r,
|
|
169
|
+
qyLogFileSaver: t,
|
|
170
|
+
exclusiveFilePath: i,
|
|
171
|
+
unloadInterval: o
|
|
160
172
|
} = this;
|
|
161
|
-
return await
|
|
162
|
-
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
|
|
173
|
+
return clearInterval(o), await e.stop(), await r.stop(), w.log("qyLogFileSaver stopped."),
|
|
174
|
+
await t.call_stop(), a(i), this.rootDir = void 0, this.hiddenDir = void 0,
|
|
175
|
+
this.indexRootDir = void 0, this.triggerRootDir = void 0, this.rpcRootDir = void 0,
|
|
176
|
+
this.infoRootDir = void 0, this.embeddingRootDir = void 0, this.recycleRootDir = void 0,
|
|
177
|
+
this.hnswRootDir = void 0, this.qyKVData = void 0, this.rpcFunMap.clear(),
|
|
178
|
+
this.qyDB = void 0, this.qyLogFileSaver = void 0, this.qyEmbeddings = void 0,
|
|
179
|
+
this;
|
|
167
180
|
}
|
|
168
181
|
increaseChangeId() {
|
|
169
182
|
return this.qyKVData.increaseChangeId();
|
|
@@ -171,143 +184,155 @@ class QyCache extends r {
|
|
|
171
184
|
decreaseChangeId() {
|
|
172
185
|
this.qyKVData.decreaseChangeId();
|
|
173
186
|
}
|
|
174
|
-
|
|
187
|
+
removeKey(e) {
|
|
188
|
+
return this.qyKVData.removeKey(e);
|
|
189
|
+
}
|
|
190
|
+
getValueSync(e) {
|
|
191
|
+
return this.qyKVData.getValueSync(e);
|
|
192
|
+
}
|
|
193
|
+
save(e, r, t, i, o) {
|
|
175
194
|
var {
|
|
176
|
-
qyKVData:
|
|
177
|
-
|
|
195
|
+
qyKVData: a,
|
|
196
|
+
qyLogFileSaver: s
|
|
178
197
|
} = this;
|
|
179
|
-
return t &&
|
|
198
|
+
return t && s.cast_save(t), a.save(e, r, i, o);
|
|
180
199
|
}
|
|
181
|
-
getFile(
|
|
182
|
-
return
|
|
200
|
+
getFile(e, r = this.rootDir) {
|
|
201
|
+
return e.isFile ? e : C(e) ? r.getFile(e) : r.searchFile(e);
|
|
183
202
|
}
|
|
184
|
-
getOrCreateFile(
|
|
185
|
-
return
|
|
203
|
+
getOrCreateFile(e, r = this.rootDir) {
|
|
204
|
+
return e.isFile ? e : C(e) ? r.getOrCreateFile(e) : r.searchOrCreateFile(e);
|
|
186
205
|
}
|
|
187
|
-
getDir(
|
|
188
|
-
return
|
|
206
|
+
getDir(e, r = this.rootDir) {
|
|
207
|
+
return e.isDir ? e : C(e) ? r.getSubdir(e) : r.searchSubdir(e);
|
|
189
208
|
}
|
|
190
|
-
getOrCreateDir(
|
|
191
|
-
return
|
|
209
|
+
getOrCreateDir(e, r = this.rootDir) {
|
|
210
|
+
return e.isDir ? e : C(e) ? r.getOrCreateSubdir(e) : r.searchOrCreateSubdir(e);
|
|
192
211
|
}
|
|
193
|
-
getIndexDir(
|
|
194
|
-
return this.indexRootDir.searchSubdir(
|
|
212
|
+
getIndexDir(e) {
|
|
213
|
+
return this.indexRootDir.searchSubdir(o(e.fullPathHash));
|
|
195
214
|
}
|
|
196
|
-
getOrCreateIndexDir(
|
|
197
|
-
return this.indexRootDir.searchOrCreateSubdir(
|
|
215
|
+
getOrCreateIndexDir(e) {
|
|
216
|
+
return this.indexRootDir.searchOrCreateSubdir(o(e.fullPathHash));
|
|
198
217
|
}
|
|
199
|
-
getTriggerFile(
|
|
200
|
-
return this.triggerRootDir.getFile(
|
|
218
|
+
getTriggerFile(e) {
|
|
219
|
+
return this.triggerRootDir.getFile(e);
|
|
201
220
|
}
|
|
202
|
-
getOrCreateTriggerFile(
|
|
203
|
-
return this.triggerRootDir.getOrCreateFile(
|
|
221
|
+
getOrCreateTriggerFile(e) {
|
|
222
|
+
return this.triggerRootDir.getOrCreateFile(e);
|
|
204
223
|
}
|
|
205
|
-
getInfoFile(
|
|
206
|
-
return this.infoRootDir.searchFile(
|
|
224
|
+
getInfoFile(e) {
|
|
225
|
+
return this.infoRootDir.searchFile(i(e.fullPathHash));
|
|
207
226
|
}
|
|
208
|
-
getOrCreateInfoFile(
|
|
209
|
-
return this.infoRootDir.searchOrCreateFile(
|
|
227
|
+
getOrCreateInfoFile(e) {
|
|
228
|
+
return this.infoRootDir.searchOrCreateFile(i(e.fullPathHash));
|
|
210
229
|
}
|
|
211
|
-
hashToSrcFile(
|
|
212
|
-
|
|
213
|
-
if (void 0 !==
|
|
214
|
-
|
|
215
|
-
if (void 0 !==
|
|
230
|
+
hashToSrcFile(e) {
|
|
231
|
+
e = this.infoRootDir.searchFile(i(e));
|
|
232
|
+
if (void 0 !== e && void 0 !== e.fileContent) {
|
|
233
|
+
e = e.fileContent.namePath;
|
|
234
|
+
if (void 0 !== e) return this.getOrCreateFile(e);
|
|
216
235
|
}
|
|
217
236
|
}
|
|
218
|
-
getEmbedding(
|
|
219
|
-
var
|
|
237
|
+
getEmbedding(e) {
|
|
238
|
+
var r, t = this.getInfoFile(e);
|
|
220
239
|
if (void 0 !== t && void 0 !== t.fileContent) return {
|
|
221
240
|
embeddingLength: t,
|
|
222
|
-
embeddingIdx:
|
|
223
|
-
} = t.fileContent, this.qyEmbeddings.getEmbedding(
|
|
241
|
+
embeddingIdx: r
|
|
242
|
+
} = t.fileContent, this.qyEmbeddings.getEmbedding(e.fullPathHash, t, r);
|
|
224
243
|
}
|
|
225
|
-
getOrCreateEmbeddingRecycleFile(
|
|
226
|
-
return this.recycleRootDir.getOrCreateFile(
|
|
244
|
+
getOrCreateEmbeddingRecycleFile(e) {
|
|
245
|
+
return this.recycleRootDir.getOrCreateFile(e);
|
|
227
246
|
}
|
|
228
|
-
getEmbeddingRecycleFile(
|
|
229
|
-
return this.recycleRootDir.getFile(
|
|
247
|
+
getEmbeddingRecycleFile(e) {
|
|
248
|
+
return this.recycleRootDir.getFile(e);
|
|
230
249
|
}
|
|
231
250
|
get triggerFileList() {
|
|
232
251
|
return this.triggerRootDir.fileList;
|
|
233
252
|
}
|
|
234
|
-
getRpcFile(
|
|
235
|
-
return this.rpcRootDir.getFile(
|
|
253
|
+
getRpcFile(e) {
|
|
254
|
+
return this.rpcRootDir.getFile(e);
|
|
236
255
|
}
|
|
237
|
-
getOrCreateRpcFile(
|
|
238
|
-
return this.rpcRootDir.getOrCreateFile(
|
|
256
|
+
getOrCreateRpcFile(e) {
|
|
257
|
+
return this.rpcRootDir.getOrCreateFile(e);
|
|
239
258
|
}
|
|
240
259
|
get rpcFileList() {
|
|
241
260
|
return this.rpcRootDir.fileList;
|
|
242
261
|
}
|
|
243
262
|
get aboutFile() {
|
|
244
|
-
return this.hiddenDir.getOrCreateFile(
|
|
263
|
+
return this.hiddenDir.getOrCreateFile(r);
|
|
245
264
|
}
|
|
246
|
-
insertTriggerToTree(
|
|
265
|
+
insertTriggerToTree(e, r, t, i) {
|
|
247
266
|
var {
|
|
248
267
|
rootDir: o,
|
|
249
|
-
qyDB:
|
|
250
|
-
} = this, i =
|
|
251
|
-
o.triggerNodes[0].insertTrigger(
|
|
268
|
+
qyDB: a
|
|
269
|
+
} = this, i = D("trigger", e, i, a);
|
|
270
|
+
o.triggerNodes[0].insertTrigger(e, r, t, i), s(o, r);
|
|
252
271
|
}
|
|
253
|
-
removeTriggerFromTree(
|
|
272
|
+
removeTriggerFromTree(e, r) {
|
|
254
273
|
var t = this.rootDir;
|
|
255
|
-
t.triggerNodes[0].removeTrigger(
|
|
274
|
+
t.triggerNodes[0].removeTrigger(e, r) && s(t, r);
|
|
256
275
|
}
|
|
257
|
-
insertRpc(
|
|
276
|
+
insertRpc(e, r) {
|
|
258
277
|
var {
|
|
259
278
|
rpcFunMap: t,
|
|
260
279
|
qyDB: i
|
|
261
|
-
} = this,
|
|
262
|
-
|
|
280
|
+
} = this, r = D("rpc", e, r, i);
|
|
281
|
+
r && t?.set(e, r);
|
|
263
282
|
}
|
|
264
|
-
removeRpc(
|
|
265
|
-
this.rpcFunMap.delete(
|
|
283
|
+
removeRpc(e) {
|
|
284
|
+
this.rpcFunMap.delete(e);
|
|
266
285
|
}
|
|
267
|
-
queryFiles(
|
|
268
|
-
var
|
|
269
|
-
return y(
|
|
286
|
+
queryFiles(e, r, t, i, o = this.rootDir) {
|
|
287
|
+
var a = [], t = (C(r) && !t && (t = 1), new c(t, i)), i = this.options.queryAutoIndex;
|
|
288
|
+
return y(e, r, a, t, o, i), a;
|
|
270
289
|
}
|
|
271
|
-
queryFilesMulti(
|
|
272
|
-
var o,
|
|
273
|
-
for ([ o,
|
|
274
|
-
return
|
|
290
|
+
queryFilesMulti(e, r, t, i = this.rootDir) {
|
|
291
|
+
var o, a, s = [], n = new c(r, t), l = this.options.queryAutoIndex;
|
|
292
|
+
for ([ o, a ] of e) y(o, a, s, n, i, l);
|
|
293
|
+
return s;
|
|
275
294
|
}
|
|
276
|
-
async callRpc(
|
|
277
|
-
var i, o = this.rpcFunMap.get(
|
|
278
|
-
if (!o) return
|
|
295
|
+
async callRpc(r, e, t) {
|
|
296
|
+
var i, o = this.rpcFunMap.get(r);
|
|
297
|
+
if (!o) return w.warn(i = `RPC ${r} not implemented.`), new Error(i);
|
|
279
298
|
try {
|
|
280
|
-
return await o(
|
|
281
|
-
} catch (
|
|
282
|
-
return
|
|
299
|
+
return await o(e, t);
|
|
300
|
+
} catch (e) {
|
|
301
|
+
return w.error(`Calling RPC ${r} failed:`, e), e;
|
|
283
302
|
}
|
|
284
303
|
}
|
|
285
|
-
monitorItemExpire(
|
|
286
|
-
this.qyKVData.monitorItemExpire(
|
|
304
|
+
monitorItemExpire(e, r) {
|
|
305
|
+
this.qyKVData.monitorItemExpire(e, r);
|
|
287
306
|
}
|
|
288
|
-
unmonitorItemExpire(
|
|
289
|
-
this.qyKVData.unmonitorItemExpire(
|
|
307
|
+
unmonitorItemExpire(e) {
|
|
308
|
+
this.qyKVData.unmonitorItemExpire(e);
|
|
290
309
|
}
|
|
291
|
-
monitorContentExpire(
|
|
292
|
-
this.qyKVData.monitorContentExpire(
|
|
310
|
+
monitorContentExpire(e, r) {
|
|
311
|
+
this.qyKVData.monitorContentExpire(e, r);
|
|
293
312
|
}
|
|
294
|
-
unmonitorContentExpire(
|
|
295
|
-
this.qyKVData.unmonitorContentExpire(
|
|
313
|
+
unmonitorContentExpire(e, r = void 0) {
|
|
314
|
+
this.qyKVData.unmonitorContentExpire(e, r);
|
|
296
315
|
}
|
|
297
316
|
}
|
|
298
317
|
|
|
299
|
-
function
|
|
300
|
-
return [
|
|
318
|
+
function i(e) {
|
|
319
|
+
return [ e.substring(0, 2), e ];
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function o(e) {
|
|
323
|
+
return [ e[0], e ];
|
|
301
324
|
}
|
|
302
325
|
|
|
303
|
-
function
|
|
304
|
-
|
|
326
|
+
function y(e, r, t, i, o, a) {
|
|
327
|
+
void 0 !== r && u(e, o, a, r, t, i);
|
|
305
328
|
}
|
|
306
329
|
|
|
307
|
-
function
|
|
308
|
-
|
|
330
|
+
function I(e, r) {
|
|
331
|
+
let t = 0;
|
|
332
|
+
if (e.fileMapLoaded) for (var i of e.fileList) ++t, i.cChangeId <= r && (i.visited ? i.visited = !1 : i.unloadFileContent());
|
|
333
|
+
return t;
|
|
309
334
|
}
|
|
310
335
|
|
|
311
336
|
export {
|
|
312
|
-
QyCache
|
|
337
|
+
t as QyCache
|
|
313
338
|
};
|
package/src/QyDB.js
CHANGED
package/src/QyDefaultOptions.js
CHANGED
|
@@ -5,7 +5,7 @@ var e = {
|
|
|
5
5
|
maxRetryInterval: 60
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
let
|
|
8
|
+
let t = {
|
|
9
9
|
QyBaseWriter: e,
|
|
10
10
|
QyBinWriter: e,
|
|
11
11
|
QyBatch: {
|
|
@@ -18,16 +18,16 @@ let a = {
|
|
|
18
18
|
snapshotMaxChangeCount: 1e6,
|
|
19
19
|
compactSnapshotsInterval: 6e4,
|
|
20
20
|
bgLoadPosMaps: !0,
|
|
21
|
-
unloadMemInterval: 12e4,
|
|
22
|
-
maxFileCountToUnload: 1e5,
|
|
23
21
|
compactAtStart: !0
|
|
24
22
|
},
|
|
25
23
|
QyCache: {
|
|
26
24
|
dumpStructureAtStart: !1,
|
|
27
25
|
queryAutoIndex: !0,
|
|
28
|
-
preloadFoldersAtStart: !1
|
|
26
|
+
preloadFoldersAtStart: !1,
|
|
27
|
+
unloadMemInterval: 12e4,
|
|
28
|
+
maxFileCountToUnload: 1e5
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
QyLogFileSaver: {
|
|
31
31
|
clearLogAtStart: !1
|
|
32
32
|
},
|
|
33
33
|
QySaver: {
|
|
@@ -40,6 +40,7 @@ let a = {
|
|
|
40
40
|
},
|
|
41
41
|
QySnapshots: {
|
|
42
42
|
pMOutdatedPercent: 30,
|
|
43
|
+
vLOutdatedPercent: 60,
|
|
43
44
|
minSnapshotKeyCount: 3e3,
|
|
44
45
|
minLenToCompress: 4e3
|
|
45
46
|
},
|
|
@@ -61,10 +62,10 @@ let a = {
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
function
|
|
65
|
-
return e &&
|
|
65
|
+
function a(e) {
|
|
66
|
+
return e && t[e] || void 0;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
+
a as getDefaultOptions
|
|
70
71
|
};
|