@based/db 0.1.0 → 0.1.1
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-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/libnode-v22.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v23.node +0 -0
- package/dist/lib/linux_aarch64/libnode-v24.node +0 -0
- package/dist/lib/linux_aarch64/libselva.so +0 -0
- package/dist/lib/linux_x86_64/libnode-v22.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v23.node +0 -0
- package/dist/lib/linux_x86_64/libnode-v24.node +0 -0
- package/dist/lib/linux_x86_64/libselva.so +0 -0
- package/dist/src/client/modify/props/vector.js +25 -7
- package/dist/src/server/migrate/index.js +3 -2
- package/package.json +4 -4
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -2,7 +2,7 @@ import { deleteProp } from './delete.js';
|
|
|
2
2
|
import { validate } from '../validate.js';
|
|
3
3
|
import { PROP_CURSOR_SIZE, writePropCursor } from '../cursor.js';
|
|
4
4
|
import { reserve } from '../resize.js';
|
|
5
|
-
import {
|
|
5
|
+
import { writeU8 } from '../uint.js';
|
|
6
6
|
export const writeVector = (ctx, def, val) => {
|
|
7
7
|
if (val === null) {
|
|
8
8
|
deleteProp(ctx, def);
|
|
@@ -18,13 +18,31 @@ export const writeVector = (ctx, def, val) => {
|
|
|
18
18
|
writeU8(ctx, ctx.operation);
|
|
19
19
|
let size = Math.min(val.byteLength, def.len);
|
|
20
20
|
let padding = 0;
|
|
21
|
-
if (ctx.index % 4
|
|
21
|
+
if (ctx.index % 4 != 0) {
|
|
22
22
|
padding = ctx.index % 4;
|
|
23
|
-
size -= padding;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
size -= padding;
|
|
25
|
+
let tmp = size + 4;
|
|
26
|
+
// 16-bits would be enough but the zig expects 32-bits
|
|
27
|
+
ctx.array[ctx.index++] = tmp;
|
|
28
|
+
ctx.array[ctx.index++] = tmp >>>= 8;
|
|
29
|
+
ctx.array[ctx.index++] = tmp >>>= 8;
|
|
30
|
+
ctx.array[ctx.index++] = tmp >>>= 8;
|
|
31
|
+
ctx.array[ctx.index++] = padding;
|
|
32
|
+
ctx.array[ctx.index++] = 0;
|
|
33
|
+
ctx.array[ctx.index++] = 0;
|
|
34
|
+
ctx.array[ctx.index++] = 0;
|
|
35
|
+
ctx.array.set(new Uint8Array(val.buffer).subarray(0, size), ctx.index - padding);
|
|
36
|
+
ctx.index += size;
|
|
37
|
+
// let size = Math.min(val.byteLength, def.len)
|
|
38
|
+
// let padding = 0
|
|
39
|
+
// if (ctx.index % 4 !== 0) {
|
|
40
|
+
// padding = ctx.index % 4
|
|
41
|
+
// size -= padding
|
|
42
|
+
// }
|
|
43
|
+
// writeU32(ctx, size + 4)
|
|
44
|
+
// writeU8(ctx, padding)
|
|
45
|
+
// writePadding(ctx, 3 - padding)
|
|
46
|
+
// writeU8Array(ctx, new Uint8Array(val.buffer).subarray(0, size))
|
|
29
47
|
};
|
|
30
48
|
//# sourceMappingURL=vector.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BasedDb, save } from '../../index.js';
|
|
2
2
|
import { dirname, join } from 'path';
|
|
3
|
-
import { Worker, MessageChannel
|
|
3
|
+
import { Worker, MessageChannel } from 'node:worker_threads';
|
|
4
4
|
import native from '../../native.js';
|
|
5
5
|
import { destructureTreeKey } from '../tree.js';
|
|
6
6
|
import { foreachDirtyBlock } from '../blocks.js';
|
|
@@ -8,7 +8,8 @@ import { fileURLToPath } from 'url';
|
|
|
8
8
|
import { setNativeSchema, setSchemaOnServer, writeSchemaFile, } from '../schema.js';
|
|
9
9
|
import { setToAwake, waitUntilSleeping } from './utils.js';
|
|
10
10
|
import { serialize } from '@based/schema';
|
|
11
|
-
import {
|
|
11
|
+
import { semver } from '@based/schema';
|
|
12
|
+
const { satisfies, parseRange, parse } = semver;
|
|
12
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
14
|
const __dirname = dirname(__filename);
|
|
14
15
|
const workerPath = join(__dirname, 'worker.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@based/db",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"test-fast-linux_aarch64": "podman run --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; npm run test-fast'",
|
|
24
24
|
"test-fast-linux_aarch64-gdb": "podman run --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; LOCPATH=../locale/locale-x86_64-gnu/locale gdb -ex run --args node ./scripts/test.js'",
|
|
25
25
|
"test-fast-linux_aarch64-valgrind": "podman run --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; LOCPATH=../locale/locale-aarch64-gnu/locale valgrind --leak-check=full node ./scripts/test.js references:update2'",
|
|
26
|
+
"test-vector": "podman run --rm -v \"$PWD/../..:/usr/src/based-db\" based-db-clibs-build-linux_aarch64 sh -c '\\. \"/usr/local/nvm/nvm.sh\"; cd /usr/src/based-db/packages/db; npm run test-fast -- mem.js'",
|
|
26
27
|
"test-zig": "npm run build-zig && tsc && npm run test-fast",
|
|
27
28
|
"test-zig-debug": "npm run build-zig -- debug && tsc && LOCPATH=../locale/locale-x86_64-gnu/locale ./scripts/lldb-node ./scripts/test.js",
|
|
28
29
|
"test-ts": "tsc && node ./scripts/test.js",
|
|
@@ -41,10 +42,9 @@
|
|
|
41
42
|
],
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"@based/hash": "1.0.0",
|
|
44
|
-
"@based/schema": "^5.0.
|
|
45
|
+
"@based/schema": "^5.0.2",
|
|
45
46
|
"@based/utils": "^1.0.0",
|
|
46
|
-
"@based/protocol": "0.0.
|
|
47
|
-
"@std/semver": "npm:@jsr/std__semver@^1.0.5",
|
|
47
|
+
"@based/protocol": "^0.0.3",
|
|
48
48
|
"exit-hook": "^4.0.0",
|
|
49
49
|
"picocolors": "^1.1.0"
|
|
50
50
|
},
|