@duckedup/nidus 0.84.0 → 0.85.0
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.
|
@@ -14,15 +14,29 @@ export class NidusHandle {
|
|
|
14
14
|
* trivial always-held guard on OPFS), and the JS wrapper is invalidated with it.
|
|
15
15
|
*/
|
|
16
16
|
close(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Drop a collection's rows. The terminal's `clear` — dropping rather than deleting
|
|
19
|
+
* OPFS files underneath the pool's open handles.
|
|
20
|
+
*/
|
|
21
|
+
drop_collection(collection: string): void;
|
|
17
22
|
/**
|
|
18
23
|
* fsync both files.
|
|
19
24
|
*/
|
|
20
25
|
flush(): void;
|
|
26
|
+
/**
|
|
27
|
+
* A RAM/disk footprint snapshot, shaped like `FootprintDto`. The terminal's `stats`.
|
|
28
|
+
*/
|
|
29
|
+
footprint(): any;
|
|
21
30
|
/**
|
|
22
31
|
* Open (creating if absent) a store at `location` — `opfs://name` (needs
|
|
23
32
|
* `init_opfs_pool` first, same thread) or `file://…`/a bare path.
|
|
24
33
|
*/
|
|
25
34
|
static open(location: string, dimension: number): NidusHandle;
|
|
35
|
+
/**
|
|
36
|
+
* Open a RAM-only store, no persistence config. The terminal's fallback when the
|
|
37
|
+
* worker/OPFS handshake fails.
|
|
38
|
+
*/
|
|
39
|
+
static open_in_memory(dimension: number): NidusHandle;
|
|
26
40
|
/**
|
|
27
41
|
* Nearest-neighbour search in `collection`, returning a JS array of hits shaped like
|
|
28
42
|
* `server::dto::HitDto`: `{collection, id, score, attrs}`.
|
|
@@ -56,8 +70,11 @@ export interface InitOutput {
|
|
|
56
70
|
readonly grow_opfs_pool: (a: number, b: number) => void;
|
|
57
71
|
readonly init_opfs_pool: (a: number, b: number) => void;
|
|
58
72
|
readonly nidushandle_close: (a: number) => void;
|
|
73
|
+
readonly nidushandle_drop_collection: (a: number, b: number, c: number, d: number) => void;
|
|
59
74
|
readonly nidushandle_flush: (a: number, b: number) => void;
|
|
75
|
+
readonly nidushandle_footprint: (a: number, b: number) => void;
|
|
60
76
|
readonly nidushandle_open: (a: number, b: number, c: number, d: number) => void;
|
|
77
|
+
readonly nidushandle_open_in_memory: (a: number, b: number) => void;
|
|
61
78
|
readonly nidushandle_search: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
62
79
|
readonly nidushandle_upsert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
63
80
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
package/dist/wasm/nidus_wasm.js
CHANGED
|
@@ -29,6 +29,26 @@ export class NidusHandle {
|
|
|
29
29
|
const ptr = this.__destroy_into_raw();
|
|
30
30
|
wasm.nidushandle_close(ptr);
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Drop a collection's rows. The terminal's `clear` — dropping rather than deleting
|
|
34
|
+
* OPFS files underneath the pool's open handles.
|
|
35
|
+
* @param {string} collection
|
|
36
|
+
*/
|
|
37
|
+
drop_collection(collection) {
|
|
38
|
+
try {
|
|
39
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
40
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
41
|
+
const len0 = WASM_VECTOR_LEN;
|
|
42
|
+
wasm.nidushandle_drop_collection(retptr, this.__wbg_ptr, ptr0, len0);
|
|
43
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
44
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
45
|
+
if (r1) {
|
|
46
|
+
throw takeObject(r0);
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
32
52
|
/**
|
|
33
53
|
* fsync both files.
|
|
34
54
|
*/
|
|
@@ -45,6 +65,25 @@ export class NidusHandle {
|
|
|
45
65
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
46
66
|
}
|
|
47
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* A RAM/disk footprint snapshot, shaped like `FootprintDto`. The terminal's `stats`.
|
|
70
|
+
* @returns {any}
|
|
71
|
+
*/
|
|
72
|
+
footprint() {
|
|
73
|
+
try {
|
|
74
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
75
|
+
wasm.nidushandle_footprint(retptr, this.__wbg_ptr);
|
|
76
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
77
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
78
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
79
|
+
if (r2) {
|
|
80
|
+
throw takeObject(r1);
|
|
81
|
+
}
|
|
82
|
+
return takeObject(r0);
|
|
83
|
+
} finally {
|
|
84
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
48
87
|
/**
|
|
49
88
|
* Open (creating if absent) a store at `location` — `opfs://name` (needs
|
|
50
89
|
* `init_opfs_pool` first, same thread) or `file://…`/a bare path.
|
|
@@ -69,6 +108,27 @@ export class NidusHandle {
|
|
|
69
108
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
70
109
|
}
|
|
71
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Open a RAM-only store, no persistence config. The terminal's fallback when the
|
|
113
|
+
* worker/OPFS handshake fails.
|
|
114
|
+
* @param {number} dimension
|
|
115
|
+
* @returns {NidusHandle}
|
|
116
|
+
*/
|
|
117
|
+
static open_in_memory(dimension) {
|
|
118
|
+
try {
|
|
119
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
120
|
+
wasm.nidushandle_open_in_memory(retptr, dimension);
|
|
121
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
122
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
123
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
124
|
+
if (r2) {
|
|
125
|
+
throw takeObject(r1);
|
|
126
|
+
}
|
|
127
|
+
return NidusHandle.__wrap(r0);
|
|
128
|
+
} finally {
|
|
129
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
72
132
|
/**
|
|
73
133
|
* Nearest-neighbour search in `collection`, returning a JS array of hits shaped like
|
|
74
134
|
* `server::dto::HitDto`: `{collection, id, score, attrs}`.
|
|
@@ -414,6 +474,11 @@ function __wbg_get_imports() {
|
|
|
414
474
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
415
475
|
return addHeapObject(ret);
|
|
416
476
|
},
|
|
477
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
478
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
479
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
480
|
+
return addHeapObject(ret);
|
|
481
|
+
},
|
|
417
482
|
__wbindgen_object_clone_ref: function(arg0) {
|
|
418
483
|
const ret = getObject(arg0);
|
|
419
484
|
return addHeapObject(ret);
|
|
Binary file
|
|
@@ -5,8 +5,11 @@ export const __wbg_nidushandle_free: (a: number, b: number) => void;
|
|
|
5
5
|
export const grow_opfs_pool: (a: number, b: number) => void;
|
|
6
6
|
export const init_opfs_pool: (a: number, b: number) => void;
|
|
7
7
|
export const nidushandle_close: (a: number) => void;
|
|
8
|
+
export const nidushandle_drop_collection: (a: number, b: number, c: number, d: number) => void;
|
|
8
9
|
export const nidushandle_flush: (a: number, b: number) => void;
|
|
10
|
+
export const nidushandle_footprint: (a: number, b: number) => void;
|
|
9
11
|
export const nidushandle_open: (a: number, b: number, c: number, d: number) => void;
|
|
12
|
+
export const nidushandle_open_in_memory: (a: number, b: number) => void;
|
|
10
13
|
export const nidushandle_search: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
11
14
|
export const nidushandle_upsert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
15
|
export const __wbindgen_export: (a: number, b: number) => number;
|
package/package.json
CHANGED