@based/db 0.0.63 → 0.0.64
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/dist/lib/darwin_aarch64/libnode-v20.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v21.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v22.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v23.node +0 -0
- package/dist/lib/darwin_aarch64/libnode-v24.node +0 -0
- package/dist/lib/darwin_aarch64/libselva.dylib +0 -0
- package/dist/lib/linux_aarch64/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libselva.so +0 -0
- package/dist/src/client/flushModify.js +2 -2
- package/dist/src/client/modify/create.js +1 -1
- package/dist/src/client/modify/delete.js +2 -2
- package/dist/src/client/modify/expire.js +1 -1
- package/dist/src/client/modify/update.js +1 -1
- package/dist/src/client/query/BasedDbQuery.js +12 -7
- package/dist/src/client/query/subscription/index.js +6 -1
- package/dist/src/hooks.js +1 -1
- package/dist/src/server/DbWorker.js +3 -1
- package/dist/src/server/index.js +0 -1
- package/dist/src/server/migrate/index.js +1 -1
- package/dist/src/server/save.js +1 -1
- package/dist/src/server/start.js +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -169,12 +169,12 @@ export const startDrain = (db) => {
|
|
|
169
169
|
db.isDraining = true;
|
|
170
170
|
if (db.flushTime === 0) {
|
|
171
171
|
process.nextTick(() => {
|
|
172
|
-
flushBuffer(db);
|
|
172
|
+
void flushBuffer(db);
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
176
176
|
setTimeout(() => {
|
|
177
|
-
flushBuffer(db);
|
|
177
|
+
void flushBuffer(db);
|
|
178
178
|
}, db.flushTime);
|
|
179
179
|
}
|
|
180
180
|
};
|
|
@@ -15,7 +15,7 @@ export const deleteFn = (db, type, id, opts) => {
|
|
|
15
15
|
if (separate) {
|
|
16
16
|
const size = 11 /* SIZE.DEFAULT_CURSOR */ + 2 + separate.length * 12;
|
|
17
17
|
if (ctx.len + size > ctx.max) {
|
|
18
|
-
flushBuffer(db);
|
|
18
|
+
void flushBuffer(db);
|
|
19
19
|
return deleteFn(db, type, id);
|
|
20
20
|
}
|
|
21
21
|
setCursor(ctx, schema, 0, MICRO_BUFFER, id, UPDATE);
|
|
@@ -28,7 +28,7 @@ export const deleteFn = (db, type, id, opts) => {
|
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
if (ctx.len + 11 /* SIZE.DEFAULT_CURSOR */ + 2 > ctx.max) {
|
|
31
|
-
flushBuffer(db);
|
|
31
|
+
void flushBuffer(db);
|
|
32
32
|
return deleteFn(db, type, id);
|
|
33
33
|
}
|
|
34
34
|
setCursor(ctx, schema, 0, MICRO_BUFFER, id, UPDATE);
|
|
@@ -9,7 +9,7 @@ export function expire(db, type, id, seconds) {
|
|
|
9
9
|
}
|
|
10
10
|
const ctx = db.modifyCtx;
|
|
11
11
|
if (ctx.len + 11 /* SIZE.DEFAULT_CURSOR */ + 5 > ctx.max) {
|
|
12
|
-
flushBuffer(db);
|
|
12
|
+
void flushBuffer(db);
|
|
13
13
|
return expire(db, type, id, seconds);
|
|
14
14
|
}
|
|
15
15
|
setCursor(ctx, def, 0, MICRO_BUFFER, id, EXPIRE);
|
|
@@ -11,7 +11,6 @@ import { langCodesMap } from '@based/schema';
|
|
|
11
11
|
import { convertFilter } from './filter/convertFilter.js';
|
|
12
12
|
import { validateLocale, validateRange } from './validation.js';
|
|
13
13
|
import { DEF_RANGE_PROP_LIMIT } from './thresholds.js';
|
|
14
|
-
import { wait } from '@saulx/utils';
|
|
15
14
|
import { displayTarget } from './display.js';
|
|
16
15
|
import picocolors from 'picocolors';
|
|
17
16
|
export class QueryBranch {
|
|
@@ -338,13 +337,19 @@ export class BasedDbQuery extends QueryBranch {
|
|
|
338
337
|
const res = await this.db.hooks.getQueryBuf(buf);
|
|
339
338
|
if (res.byteLength === 1) {
|
|
340
339
|
if (res[0] === 0) {
|
|
341
|
-
this.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
340
|
+
if (this.def && this.def.schemaChecksum === this.db.schema?.hash) {
|
|
341
|
+
// my schema did not change since last time, wait for the schema to change
|
|
342
|
+
this.reset();
|
|
343
|
+
this.db.emit('info', 'query get schema mismatch - awaiting new schema');
|
|
344
|
+
await this.db.once('schema');
|
|
345
|
+
return this.#getInternal(resolve, reject);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
// its changed so lets send again
|
|
349
|
+
this.db.emit('info', 'query get schema mismatch - got the same already');
|
|
350
|
+
this.reset();
|
|
351
|
+
return this.#getInternal(resolve, reject);
|
|
346
352
|
}
|
|
347
|
-
return this.#getInternal(resolve, reject);
|
|
348
353
|
}
|
|
349
354
|
else {
|
|
350
355
|
reject(new Error('unexpected error'));
|
|
@@ -32,7 +32,9 @@ export class SubStore {
|
|
|
32
32
|
};
|
|
33
33
|
let killed = false;
|
|
34
34
|
if (!q.db.schema) {
|
|
35
|
-
q.db
|
|
35
|
+
q.db
|
|
36
|
+
.schemaIsSet()
|
|
37
|
+
.then(() => {
|
|
36
38
|
if (!killed) {
|
|
37
39
|
try {
|
|
38
40
|
registerQuery(q);
|
|
@@ -42,6 +44,9 @@ export class SubStore {
|
|
|
42
44
|
onError(err);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
})
|
|
48
|
+
.catch((err) => {
|
|
49
|
+
onError(err);
|
|
45
50
|
});
|
|
46
51
|
this.onClose = () => {
|
|
47
52
|
killed = true;
|
package/dist/src/hooks.js
CHANGED
|
@@ -29,7 +29,9 @@ export class DbWorker {
|
|
|
29
29
|
});
|
|
30
30
|
this.worker.on('error', (err) => {
|
|
31
31
|
console.error('error in query worker:', err);
|
|
32
|
-
this.worker.terminate()
|
|
32
|
+
this.worker.terminate().catch((err) => {
|
|
33
|
+
console.error('error terminating query worker:', err);
|
|
34
|
+
});
|
|
33
35
|
});
|
|
34
36
|
this.worker.on('exit', (code) => {
|
|
35
37
|
if (!this.db.stopped) {
|
package/dist/src/server/index.js
CHANGED
|
@@ -333,7 +333,6 @@ export class DbServer extends DbShared {
|
|
|
333
333
|
resolve(new Error('Query queue exceeded'));
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
// TODO should we check here as well? Already will check in DbWorker
|
|
337
336
|
const schemaChecksum = readUint64(buf, buf.byteLength - 8);
|
|
338
337
|
if (schemaChecksum !== this.schema?.hash) {
|
|
339
338
|
return Promise.resolve(new Uint8Array(1));
|
|
@@ -113,7 +113,7 @@ export const migrate = async (server, fromSchema, toSchema, transform) => {
|
|
|
113
113
|
if (server.dirtyRanges.size) {
|
|
114
114
|
rangesToMigrate = [];
|
|
115
115
|
i = 0;
|
|
116
|
-
foreachDirtyBlock(server, (_mtKey, typeId, start, end) => {
|
|
116
|
+
void foreachDirtyBlock(server, (_mtKey, typeId, start, end) => {
|
|
117
117
|
rangesToMigrate.push({
|
|
118
118
|
typeId,
|
|
119
119
|
start,
|
package/dist/src/server/save.js
CHANGED
|
@@ -69,7 +69,7 @@ export function save(db, sync = false, forceFullDump = false, skipMigrationCheck
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
foreachDirtyBlock(db, (mtKey, typeId, start, end) => {
|
|
72
|
+
void foreachDirtyBlock(db, (mtKey, typeId, start, end) => {
|
|
73
73
|
const hash = new Uint8Array(16);
|
|
74
74
|
const file = saveRange(db, typeId, start, end, hash);
|
|
75
75
|
if (file === null) {
|
package/dist/src/server/start.js
CHANGED