@taladb/react-native 0.11.8 → 0.12.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/README.md +1 -1
- package/android/src/main/jniLibs/arm64-v8a/libtaladb_ffi.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libtaladb_ffi.so +0 -0
- package/android/src/main/jniLibs/x86_64/libtaladb_ffi.so +0 -0
- package/cpp/TalaDBHostObject.cpp +10 -8
- package/cpp/taladb.h +145 -21
- package/ios/TalaDBFfi.xcframework/Info.plist +9 -9
- package/ios/TalaDBFfi.xcframework/ios-arm64/Headers/TalaDBHostObject.cpp +10 -8
- package/ios/TalaDBFfi.xcframework/ios-arm64/Headers/taladb.h +145 -21
- package/ios/TalaDBFfi.xcframework/ios-arm64/libtaladb_ffi.a +2 -2
- package/ios/TalaDBFfi.xcframework/ios-arm64_x86_64-simulator/Headers/TalaDBHostObject.cpp +10 -8
- package/ios/TalaDBFfi.xcframework/ios-arm64_x86_64-simulator/Headers/taladb.h +145 -21
- package/ios/TalaDBFfi.xcframework/ios-arm64_x86_64-simulator/libtaladb_ffi_sim.a +2 -2
- package/package.json +5 -5
- package/src/index.tsx +2 -2
- package/taladb-react-native.podspec +2 -2
- package/android/src/main/jniLibs/arm64-v8a/libredb-86d97267aa016807.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libredb-1517f4c9245410e5.so +0 -0
- package/android/src/main/jniLibs/x86_64/libredb-6d972d719c632f03.so +0 -0
package/README.md
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp/TalaDBHostObject.cpp
CHANGED
|
@@ -542,10 +542,12 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
542
542
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
543
543
|
auto col = args[0].getString(rt).utf8(rt);
|
|
544
544
|
auto field = args[1].getString(rt).utf8(rt);
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
else if (name == "
|
|
548
|
-
else
|
|
545
|
+
int32_t res;
|
|
546
|
+
if (name == "createIndex") res = taladb_create_index (db_, col.c_str(), field.c_str());
|
|
547
|
+
else if (name == "dropIndex") res = taladb_drop_index (db_, col.c_str(), field.c_str());
|
|
548
|
+
else if (name == "createFtsIndex") res = taladb_create_fts_index(db_, col.c_str(), field.c_str());
|
|
549
|
+
else res = taladb_drop_fts_index (db_, col.c_str(), field.c_str());
|
|
550
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
549
551
|
return Value::undefined();
|
|
550
552
|
});
|
|
551
553
|
}
|
|
@@ -560,10 +562,10 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
560
562
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
561
563
|
auto col = args[0].getString(rt).utf8(rt);
|
|
562
564
|
auto fieldsJson = stringify(rt, args[1]); // string[] → JSON array
|
|
563
|
-
|
|
564
|
-
taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
565
|
-
|
|
566
|
-
|
|
565
|
+
int32_t res = name == "createCompoundIndex"
|
|
566
|
+
? taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
567
|
+
: taladb_drop_compound_index(db_, col.c_str(), fieldsJson.c_str());
|
|
568
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
567
569
|
return Value::undefined();
|
|
568
570
|
});
|
|
569
571
|
}
|
package/cpp/taladb.h
CHANGED
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* TalaDB C FFI header.
|
|
3
3
|
*
|
|
4
4
|
* GENERATED FILE — do not edit. Regenerate with:
|
|
5
|
-
*
|
|
6
|
-
* CI fails if this file and
|
|
5
|
+
* packages/bindings/ffi/scripts/gen-header.sh
|
|
6
|
+
* CI fails if this file and packages/bindings/ffi/src/lib.rs disagree.
|
|
7
7
|
*
|
|
8
|
-
* This is the stable C interface
|
|
9
|
-
* JSI HostObject
|
|
10
|
-
*
|
|
8
|
+
* This is the stable C interface of the Rust taladb-ffi crate. Its consumers
|
|
9
|
+
* are the React Native JSI HostObject and TurboModule in this repository and
|
|
10
|
+
* the native Swift (taladb/taladb-swift) and Kotlin (taladb/taladb-kotlin)
|
|
11
|
+
* packages, which ship as separate repositories.
|
|
12
|
+
*
|
|
13
|
+
* Compatibility
|
|
14
|
+
* -------------
|
|
15
|
+
* TALADB_FFI_ABI_VERSION changes whenever a signature in this file changes
|
|
16
|
+
* incompatibly. A wrapper compiled against this header must check that
|
|
17
|
+
* taladb_ffi_abi_version() returns the same value before calling anything
|
|
18
|
+
* else; a mismatch means the library and header came from different releases.
|
|
11
19
|
*
|
|
12
20
|
* Ownership rules
|
|
13
21
|
* ---------------
|
|
@@ -31,6 +39,18 @@
|
|
|
31
39
|
#include <stdlib.h>
|
|
32
40
|
|
|
33
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Version of the C interface in `taladb.h`. Bumped whenever an exported
|
|
44
|
+
* signature changes incompatibly, independently of the crate version.
|
|
45
|
+
*
|
|
46
|
+
* - 1 — through 0.11.8.
|
|
47
|
+
* - 2 — the six index create/drop functions return `int32_t` instead of
|
|
48
|
+
* `void`; `taladb_call`, `taladb_ffi_abi_version`, `taladb_last_error_code`
|
|
49
|
+
* and the live-query functions (`taladb_watch`, `taladb_watch_next`,
|
|
50
|
+
* `taladb_watch_close`, `taladb_watch_with_options`) added.
|
|
51
|
+
*/
|
|
52
|
+
#define TALADB_FFI_ABI_VERSION 2
|
|
53
|
+
|
|
34
54
|
typedef struct TalaDbHandle TalaDbHandle;
|
|
35
55
|
|
|
36
56
|
/**
|
|
@@ -38,6 +58,12 @@ typedef struct TalaDbHandle TalaDbHandle;
|
|
|
38
58
|
*/
|
|
39
59
|
typedef struct TalaDbJob TalaDbJob;
|
|
40
60
|
|
|
61
|
+
/**
|
|
62
|
+
* A live query: a subscription to the documents in one collection that match
|
|
63
|
+
* one filter. Opaque to the caller.
|
|
64
|
+
*/
|
|
65
|
+
typedef struct TalaDbWatch TalaDbWatch;
|
|
66
|
+
|
|
41
67
|
#ifdef __cplusplus
|
|
42
68
|
extern "C" {
|
|
43
69
|
#endif // __cplusplus
|
|
@@ -54,6 +80,30 @@ extern "C" {
|
|
|
54
80
|
*/
|
|
55
81
|
const char *taladb_last_error(void);
|
|
56
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The engine's stable code for the error [`taladb_last_error`] describes —
|
|
85
|
+
* `"Encryption"` for a wrong passphrase, `"InvalidFilter"`, `"DuplicateId"`,
|
|
86
|
+
* and the rest of `TalaDbError::code` — or NULL when the last call succeeded
|
|
87
|
+
* or failed outside the engine (a null pointer, malformed arguments).
|
|
88
|
+
*
|
|
89
|
+
* Codes are a public contract shared with the JavaScript bindings' `error.code`:
|
|
90
|
+
* new ones may be added, an existing one never changes meaning. Read it in the
|
|
91
|
+
* same native call as the message; like the message, it is thread-local.
|
|
92
|
+
* The returned string is static. Do NOT free it.
|
|
93
|
+
*/
|
|
94
|
+
const char *taladb_last_error_code(void);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The [`TALADB_FFI_ABI_VERSION`] this library was built with.
|
|
98
|
+
*
|
|
99
|
+
* The Swift and Kotlin packages live in their own repositories and load a
|
|
100
|
+
* prebuilt library, so the header they compiled against and the library they
|
|
101
|
+
* load can come from different releases. Each checks this once at load time
|
|
102
|
+
* and refuses to continue on a mismatch, because a changed signature links
|
|
103
|
+
* fine and then corrupts the stack at run time.
|
|
104
|
+
*/
|
|
105
|
+
uint32_t taladb_ffi_abi_version(void);
|
|
106
|
+
|
|
57
107
|
/**
|
|
58
108
|
* Open (or create) a TalaDB database at `path`.
|
|
59
109
|
*
|
|
@@ -205,40 +255,48 @@ int32_t taladb_set_user_version(struct TalaDbHandle *handle, uint32_t version);
|
|
|
205
255
|
int32_t taladb_flush(struct TalaDbHandle *handle);
|
|
206
256
|
|
|
207
257
|
/**
|
|
208
|
-
* Create a secondary index on `field`. No-op if already exists.
|
|
258
|
+
* Create a secondary index on `field`. No-op if it already exists.
|
|
259
|
+
* Returns 1 on success, -1 on error.
|
|
209
260
|
*/
|
|
210
|
-
|
|
261
|
+
int32_t taladb_create_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
211
262
|
|
|
212
263
|
/**
|
|
213
|
-
* Drop a secondary index on `field`.
|
|
264
|
+
* Drop a secondary index on `field`. Returns 1 on success, -1 on error
|
|
265
|
+
* (including when no such index exists).
|
|
214
266
|
*/
|
|
215
|
-
|
|
267
|
+
int32_t taladb_drop_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
216
268
|
|
|
217
269
|
/**
|
|
218
270
|
* Create a compound index over `fields_json` (a JSON array of field names).
|
|
271
|
+
* Returns 1 on success, -1 on error.
|
|
219
272
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
273
|
+
int32_t taladb_create_compound_index(struct TalaDbHandle *handle,
|
|
274
|
+
const char *collection,
|
|
275
|
+
const char *fields_json);
|
|
223
276
|
|
|
224
277
|
/**
|
|
225
278
|
* Drop a compound index by its ordered field list (`fields_json`).
|
|
279
|
+
* Returns 1 on success, -1 on error.
|
|
226
280
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
int32_t taladb_drop_compound_index(struct TalaDbHandle *handle,
|
|
282
|
+
const char *collection,
|
|
283
|
+
const char *fields_json);
|
|
230
284
|
|
|
231
285
|
/**
|
|
232
|
-
* Create a full-text search index on `field`.
|
|
286
|
+
* Create a full-text search index on `field`. No-op if it already exists.
|
|
287
|
+
* Returns 1 on success, -1 on error.
|
|
233
288
|
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
289
|
+
int32_t taladb_create_fts_index(struct TalaDbHandle *handle,
|
|
290
|
+
const char *collection,
|
|
291
|
+
const char *field);
|
|
237
292
|
|
|
238
293
|
/**
|
|
239
|
-
* Drop a full-text search index on `field`.
|
|
294
|
+
* Drop a full-text search index on `field`. Returns 1 on success, -1 on
|
|
295
|
+
* error (including when no such index exists).
|
|
240
296
|
*/
|
|
241
|
-
|
|
297
|
+
int32_t taladb_drop_fts_index(struct TalaDbHandle *handle,
|
|
298
|
+
const char *collection,
|
|
299
|
+
const char *field);
|
|
242
300
|
|
|
243
301
|
/**
|
|
244
302
|
* Rank documents against a free-text query using BM25 (OR semantics).
|
|
@@ -368,6 +426,72 @@ struct TalaDbJob *taladb_call_start(struct TalaDbHandle *handle,
|
|
|
368
426
|
const char *op,
|
|
369
427
|
const char *args_json);
|
|
370
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Run a JSON operation synchronously on the calling thread.
|
|
431
|
+
*
|
|
432
|
+
* Takes the same `op` names and `args_json` array as [`taladb_call_start`]
|
|
433
|
+
* and returns the result JSON directly, or NULL on error (see
|
|
434
|
+
* `taladb_last_error`). Caller must free the result with `taladb_free_string`.
|
|
435
|
+
*
|
|
436
|
+
* For callers that do their own threading — the Swift and Kotlin packages run
|
|
437
|
+
* it on a background executor — this reaches every operation in the dispatch
|
|
438
|
+
* table, including ones with no dedicated export (`listIndexes`,
|
|
439
|
+
* `vectorCommand`), without a job handle to poll.
|
|
440
|
+
*/
|
|
441
|
+
char *taladb_call(struct TalaDbHandle *handle, const char *op, const char *args_json);
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Subscribe to the documents in `collection` matching `filter_json` (NULL,
|
|
445
|
+
* `"{}"` or `"null"` for all).
|
|
446
|
+
*
|
|
447
|
+
* Writes made through any handle of the same database wake the watch. It
|
|
448
|
+
* delivers no initial snapshot — read the current state with `taladb_find`
|
|
449
|
+
* *after* this returns, so no write can fall between the two.
|
|
450
|
+
*
|
|
451
|
+
* The watch reads from the database it was created on and keeps its storage
|
|
452
|
+
* open until `taladb_watch_close`, even after `taladb_close`. Returns NULL on
|
|
453
|
+
* error.
|
|
454
|
+
*/
|
|
455
|
+
struct TalaDbWatch *taladb_watch(struct TalaDbHandle *handle,
|
|
456
|
+
const char *collection,
|
|
457
|
+
const char *filter_json);
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* [`taladb_watch`], with each snapshot projected like `find`'s options:
|
|
461
|
+
* `{"fields": [..]}` keeps only those fields, `{"exclude": [..]}` drops them.
|
|
462
|
+
* A NULL or `"null"` `options_json` is the same as `taladb_watch`.
|
|
463
|
+
*
|
|
464
|
+
* Every write sends a fresh snapshot across to the caller, so excluding a
|
|
465
|
+
* large field the caller does not display (an embedding) keeps each update
|
|
466
|
+
* small.
|
|
467
|
+
*
|
|
468
|
+
* # Safety
|
|
469
|
+
* As for [`taladb_watch`]; `options_json` may be NULL.
|
|
470
|
+
*/
|
|
471
|
+
struct TalaDbWatch *taladb_watch_with_options(struct TalaDbHandle *handle,
|
|
472
|
+
const char *collection,
|
|
473
|
+
const char *filter_json,
|
|
474
|
+
const char *options_json);
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Wait up to `timeout_ms` for a write to the watched collection.
|
|
478
|
+
*
|
|
479
|
+
* Returns 1 and sets `*out_json` to a JSON array of the matching documents
|
|
480
|
+
* (free with `taladb_free_string`) if a write occurred — several writes since
|
|
481
|
+
* the last call coalesce into one snapshot of the latest state. Returns 0 and
|
|
482
|
+
* sets `*out_json` to NULL on timeout, and -1 on error.
|
|
483
|
+
*
|
|
484
|
+
* The timeout is what lets a caller stop a subscription: loop on this with a
|
|
485
|
+
* short timeout and check for cancellation between calls. Do not call
|
|
486
|
+
* `taladb_watch_close` while a call on the same watch is in progress.
|
|
487
|
+
*/
|
|
488
|
+
int32_t taladb_watch_next(struct TalaDbWatch *watch, uint32_t timeout_ms, char **out_json);
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Close a watch and release the storage it holds open. NULL is a no-op.
|
|
492
|
+
*/
|
|
493
|
+
void taladb_watch_close(struct TalaDbWatch *watch);
|
|
494
|
+
|
|
371
495
|
/**
|
|
372
496
|
* Start a `find_nearest` in a background thread. Returns a job handle, or
|
|
373
497
|
* NULL on immediate error (bad args). The Float32 query vector is copied
|
|
@@ -6,38 +6,38 @@
|
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
|
-
<string>
|
|
9
|
+
<string>libtaladb_ffi.a</string>
|
|
10
10
|
<key>HeadersPath</key>
|
|
11
11
|
<string>Headers</string>
|
|
12
12
|
<key>LibraryIdentifier</key>
|
|
13
|
-
<string>ios-
|
|
13
|
+
<string>ios-arm64</string>
|
|
14
14
|
<key>LibraryPath</key>
|
|
15
|
-
<string>
|
|
15
|
+
<string>libtaladb_ffi.a</string>
|
|
16
16
|
<key>SupportedArchitectures</key>
|
|
17
17
|
<array>
|
|
18
18
|
<string>arm64</string>
|
|
19
|
-
<string>x86_64</string>
|
|
20
19
|
</array>
|
|
21
20
|
<key>SupportedPlatform</key>
|
|
22
21
|
<string>ios</string>
|
|
23
|
-
<key>SupportedPlatformVariant</key>
|
|
24
|
-
<string>simulator</string>
|
|
25
22
|
</dict>
|
|
26
23
|
<dict>
|
|
27
24
|
<key>BinaryPath</key>
|
|
28
|
-
<string>
|
|
25
|
+
<string>libtaladb_ffi_sim.a</string>
|
|
29
26
|
<key>HeadersPath</key>
|
|
30
27
|
<string>Headers</string>
|
|
31
28
|
<key>LibraryIdentifier</key>
|
|
32
|
-
<string>ios-
|
|
29
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
33
30
|
<key>LibraryPath</key>
|
|
34
|
-
<string>
|
|
31
|
+
<string>libtaladb_ffi_sim.a</string>
|
|
35
32
|
<key>SupportedArchitectures</key>
|
|
36
33
|
<array>
|
|
37
34
|
<string>arm64</string>
|
|
35
|
+
<string>x86_64</string>
|
|
38
36
|
</array>
|
|
39
37
|
<key>SupportedPlatform</key>
|
|
40
38
|
<string>ios</string>
|
|
39
|
+
<key>SupportedPlatformVariant</key>
|
|
40
|
+
<string>simulator</string>
|
|
41
41
|
</dict>
|
|
42
42
|
</array>
|
|
43
43
|
<key>CFBundlePackageType</key>
|
|
@@ -542,10 +542,12 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
542
542
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
543
543
|
auto col = args[0].getString(rt).utf8(rt);
|
|
544
544
|
auto field = args[1].getString(rt).utf8(rt);
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
else if (name == "
|
|
548
|
-
else
|
|
545
|
+
int32_t res;
|
|
546
|
+
if (name == "createIndex") res = taladb_create_index (db_, col.c_str(), field.c_str());
|
|
547
|
+
else if (name == "dropIndex") res = taladb_drop_index (db_, col.c_str(), field.c_str());
|
|
548
|
+
else if (name == "createFtsIndex") res = taladb_create_fts_index(db_, col.c_str(), field.c_str());
|
|
549
|
+
else res = taladb_drop_fts_index (db_, col.c_str(), field.c_str());
|
|
550
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
549
551
|
return Value::undefined();
|
|
550
552
|
});
|
|
551
553
|
}
|
|
@@ -560,10 +562,10 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
560
562
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
561
563
|
auto col = args[0].getString(rt).utf8(rt);
|
|
562
564
|
auto fieldsJson = stringify(rt, args[1]); // string[] → JSON array
|
|
563
|
-
|
|
564
|
-
taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
565
|
-
|
|
566
|
-
|
|
565
|
+
int32_t res = name == "createCompoundIndex"
|
|
566
|
+
? taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
567
|
+
: taladb_drop_compound_index(db_, col.c_str(), fieldsJson.c_str());
|
|
568
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
567
569
|
return Value::undefined();
|
|
568
570
|
});
|
|
569
571
|
}
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* TalaDB C FFI header.
|
|
3
3
|
*
|
|
4
4
|
* GENERATED FILE — do not edit. Regenerate with:
|
|
5
|
-
*
|
|
6
|
-
* CI fails if this file and
|
|
5
|
+
* packages/bindings/ffi/scripts/gen-header.sh
|
|
6
|
+
* CI fails if this file and packages/bindings/ffi/src/lib.rs disagree.
|
|
7
7
|
*
|
|
8
|
-
* This is the stable C interface
|
|
9
|
-
* JSI HostObject
|
|
10
|
-
*
|
|
8
|
+
* This is the stable C interface of the Rust taladb-ffi crate. Its consumers
|
|
9
|
+
* are the React Native JSI HostObject and TurboModule in this repository and
|
|
10
|
+
* the native Swift (taladb/taladb-swift) and Kotlin (taladb/taladb-kotlin)
|
|
11
|
+
* packages, which ship as separate repositories.
|
|
12
|
+
*
|
|
13
|
+
* Compatibility
|
|
14
|
+
* -------------
|
|
15
|
+
* TALADB_FFI_ABI_VERSION changes whenever a signature in this file changes
|
|
16
|
+
* incompatibly. A wrapper compiled against this header must check that
|
|
17
|
+
* taladb_ffi_abi_version() returns the same value before calling anything
|
|
18
|
+
* else; a mismatch means the library and header came from different releases.
|
|
11
19
|
*
|
|
12
20
|
* Ownership rules
|
|
13
21
|
* ---------------
|
|
@@ -31,6 +39,18 @@
|
|
|
31
39
|
#include <stdlib.h>
|
|
32
40
|
|
|
33
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Version of the C interface in `taladb.h`. Bumped whenever an exported
|
|
44
|
+
* signature changes incompatibly, independently of the crate version.
|
|
45
|
+
*
|
|
46
|
+
* - 1 — through 0.11.8.
|
|
47
|
+
* - 2 — the six index create/drop functions return `int32_t` instead of
|
|
48
|
+
* `void`; `taladb_call`, `taladb_ffi_abi_version`, `taladb_last_error_code`
|
|
49
|
+
* and the live-query functions (`taladb_watch`, `taladb_watch_next`,
|
|
50
|
+
* `taladb_watch_close`, `taladb_watch_with_options`) added.
|
|
51
|
+
*/
|
|
52
|
+
#define TALADB_FFI_ABI_VERSION 2
|
|
53
|
+
|
|
34
54
|
typedef struct TalaDbHandle TalaDbHandle;
|
|
35
55
|
|
|
36
56
|
/**
|
|
@@ -38,6 +58,12 @@ typedef struct TalaDbHandle TalaDbHandle;
|
|
|
38
58
|
*/
|
|
39
59
|
typedef struct TalaDbJob TalaDbJob;
|
|
40
60
|
|
|
61
|
+
/**
|
|
62
|
+
* A live query: a subscription to the documents in one collection that match
|
|
63
|
+
* one filter. Opaque to the caller.
|
|
64
|
+
*/
|
|
65
|
+
typedef struct TalaDbWatch TalaDbWatch;
|
|
66
|
+
|
|
41
67
|
#ifdef __cplusplus
|
|
42
68
|
extern "C" {
|
|
43
69
|
#endif // __cplusplus
|
|
@@ -54,6 +80,30 @@ extern "C" {
|
|
|
54
80
|
*/
|
|
55
81
|
const char *taladb_last_error(void);
|
|
56
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The engine's stable code for the error [`taladb_last_error`] describes —
|
|
85
|
+
* `"Encryption"` for a wrong passphrase, `"InvalidFilter"`, `"DuplicateId"`,
|
|
86
|
+
* and the rest of `TalaDbError::code` — or NULL when the last call succeeded
|
|
87
|
+
* or failed outside the engine (a null pointer, malformed arguments).
|
|
88
|
+
*
|
|
89
|
+
* Codes are a public contract shared with the JavaScript bindings' `error.code`:
|
|
90
|
+
* new ones may be added, an existing one never changes meaning. Read it in the
|
|
91
|
+
* same native call as the message; like the message, it is thread-local.
|
|
92
|
+
* The returned string is static. Do NOT free it.
|
|
93
|
+
*/
|
|
94
|
+
const char *taladb_last_error_code(void);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The [`TALADB_FFI_ABI_VERSION`] this library was built with.
|
|
98
|
+
*
|
|
99
|
+
* The Swift and Kotlin packages live in their own repositories and load a
|
|
100
|
+
* prebuilt library, so the header they compiled against and the library they
|
|
101
|
+
* load can come from different releases. Each checks this once at load time
|
|
102
|
+
* and refuses to continue on a mismatch, because a changed signature links
|
|
103
|
+
* fine and then corrupts the stack at run time.
|
|
104
|
+
*/
|
|
105
|
+
uint32_t taladb_ffi_abi_version(void);
|
|
106
|
+
|
|
57
107
|
/**
|
|
58
108
|
* Open (or create) a TalaDB database at `path`.
|
|
59
109
|
*
|
|
@@ -205,40 +255,48 @@ int32_t taladb_set_user_version(struct TalaDbHandle *handle, uint32_t version);
|
|
|
205
255
|
int32_t taladb_flush(struct TalaDbHandle *handle);
|
|
206
256
|
|
|
207
257
|
/**
|
|
208
|
-
* Create a secondary index on `field`. No-op if already exists.
|
|
258
|
+
* Create a secondary index on `field`. No-op if it already exists.
|
|
259
|
+
* Returns 1 on success, -1 on error.
|
|
209
260
|
*/
|
|
210
|
-
|
|
261
|
+
int32_t taladb_create_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
211
262
|
|
|
212
263
|
/**
|
|
213
|
-
* Drop a secondary index on `field`.
|
|
264
|
+
* Drop a secondary index on `field`. Returns 1 on success, -1 on error
|
|
265
|
+
* (including when no such index exists).
|
|
214
266
|
*/
|
|
215
|
-
|
|
267
|
+
int32_t taladb_drop_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
216
268
|
|
|
217
269
|
/**
|
|
218
270
|
* Create a compound index over `fields_json` (a JSON array of field names).
|
|
271
|
+
* Returns 1 on success, -1 on error.
|
|
219
272
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
273
|
+
int32_t taladb_create_compound_index(struct TalaDbHandle *handle,
|
|
274
|
+
const char *collection,
|
|
275
|
+
const char *fields_json);
|
|
223
276
|
|
|
224
277
|
/**
|
|
225
278
|
* Drop a compound index by its ordered field list (`fields_json`).
|
|
279
|
+
* Returns 1 on success, -1 on error.
|
|
226
280
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
int32_t taladb_drop_compound_index(struct TalaDbHandle *handle,
|
|
282
|
+
const char *collection,
|
|
283
|
+
const char *fields_json);
|
|
230
284
|
|
|
231
285
|
/**
|
|
232
|
-
* Create a full-text search index on `field`.
|
|
286
|
+
* Create a full-text search index on `field`. No-op if it already exists.
|
|
287
|
+
* Returns 1 on success, -1 on error.
|
|
233
288
|
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
289
|
+
int32_t taladb_create_fts_index(struct TalaDbHandle *handle,
|
|
290
|
+
const char *collection,
|
|
291
|
+
const char *field);
|
|
237
292
|
|
|
238
293
|
/**
|
|
239
|
-
* Drop a full-text search index on `field`.
|
|
294
|
+
* Drop a full-text search index on `field`. Returns 1 on success, -1 on
|
|
295
|
+
* error (including when no such index exists).
|
|
240
296
|
*/
|
|
241
|
-
|
|
297
|
+
int32_t taladb_drop_fts_index(struct TalaDbHandle *handle,
|
|
298
|
+
const char *collection,
|
|
299
|
+
const char *field);
|
|
242
300
|
|
|
243
301
|
/**
|
|
244
302
|
* Rank documents against a free-text query using BM25 (OR semantics).
|
|
@@ -368,6 +426,72 @@ struct TalaDbJob *taladb_call_start(struct TalaDbHandle *handle,
|
|
|
368
426
|
const char *op,
|
|
369
427
|
const char *args_json);
|
|
370
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Run a JSON operation synchronously on the calling thread.
|
|
431
|
+
*
|
|
432
|
+
* Takes the same `op` names and `args_json` array as [`taladb_call_start`]
|
|
433
|
+
* and returns the result JSON directly, or NULL on error (see
|
|
434
|
+
* `taladb_last_error`). Caller must free the result with `taladb_free_string`.
|
|
435
|
+
*
|
|
436
|
+
* For callers that do their own threading — the Swift and Kotlin packages run
|
|
437
|
+
* it on a background executor — this reaches every operation in the dispatch
|
|
438
|
+
* table, including ones with no dedicated export (`listIndexes`,
|
|
439
|
+
* `vectorCommand`), without a job handle to poll.
|
|
440
|
+
*/
|
|
441
|
+
char *taladb_call(struct TalaDbHandle *handle, const char *op, const char *args_json);
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Subscribe to the documents in `collection` matching `filter_json` (NULL,
|
|
445
|
+
* `"{}"` or `"null"` for all).
|
|
446
|
+
*
|
|
447
|
+
* Writes made through any handle of the same database wake the watch. It
|
|
448
|
+
* delivers no initial snapshot — read the current state with `taladb_find`
|
|
449
|
+
* *after* this returns, so no write can fall between the two.
|
|
450
|
+
*
|
|
451
|
+
* The watch reads from the database it was created on and keeps its storage
|
|
452
|
+
* open until `taladb_watch_close`, even after `taladb_close`. Returns NULL on
|
|
453
|
+
* error.
|
|
454
|
+
*/
|
|
455
|
+
struct TalaDbWatch *taladb_watch(struct TalaDbHandle *handle,
|
|
456
|
+
const char *collection,
|
|
457
|
+
const char *filter_json);
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* [`taladb_watch`], with each snapshot projected like `find`'s options:
|
|
461
|
+
* `{"fields": [..]}` keeps only those fields, `{"exclude": [..]}` drops them.
|
|
462
|
+
* A NULL or `"null"` `options_json` is the same as `taladb_watch`.
|
|
463
|
+
*
|
|
464
|
+
* Every write sends a fresh snapshot across to the caller, so excluding a
|
|
465
|
+
* large field the caller does not display (an embedding) keeps each update
|
|
466
|
+
* small.
|
|
467
|
+
*
|
|
468
|
+
* # Safety
|
|
469
|
+
* As for [`taladb_watch`]; `options_json` may be NULL.
|
|
470
|
+
*/
|
|
471
|
+
struct TalaDbWatch *taladb_watch_with_options(struct TalaDbHandle *handle,
|
|
472
|
+
const char *collection,
|
|
473
|
+
const char *filter_json,
|
|
474
|
+
const char *options_json);
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Wait up to `timeout_ms` for a write to the watched collection.
|
|
478
|
+
*
|
|
479
|
+
* Returns 1 and sets `*out_json` to a JSON array of the matching documents
|
|
480
|
+
* (free with `taladb_free_string`) if a write occurred — several writes since
|
|
481
|
+
* the last call coalesce into one snapshot of the latest state. Returns 0 and
|
|
482
|
+
* sets `*out_json` to NULL on timeout, and -1 on error.
|
|
483
|
+
*
|
|
484
|
+
* The timeout is what lets a caller stop a subscription: loop on this with a
|
|
485
|
+
* short timeout and check for cancellation between calls. Do not call
|
|
486
|
+
* `taladb_watch_close` while a call on the same watch is in progress.
|
|
487
|
+
*/
|
|
488
|
+
int32_t taladb_watch_next(struct TalaDbWatch *watch, uint32_t timeout_ms, char **out_json);
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Close a watch and release the storage it holds open. NULL is a no-op.
|
|
492
|
+
*/
|
|
493
|
+
void taladb_watch_close(struct TalaDbWatch *watch);
|
|
494
|
+
|
|
371
495
|
/**
|
|
372
496
|
* Start a `find_nearest` in a background thread. Returns a job handle, or
|
|
373
497
|
* NULL on immediate error (bad args). The Float32 query vector is copied
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/ios/TalaDBFfi.xcframework/ios-arm64/libtaladb_ffi.a
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 41874920 bytes
|
|
4
|
+
sha256: 084531b121f19eeb19d501b10614c45e0a42a20660b75d6d4357a43ab3b75e27
|
|
@@ -542,10 +542,12 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
542
542
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
543
543
|
auto col = args[0].getString(rt).utf8(rt);
|
|
544
544
|
auto field = args[1].getString(rt).utf8(rt);
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
else if (name == "
|
|
548
|
-
else
|
|
545
|
+
int32_t res;
|
|
546
|
+
if (name == "createIndex") res = taladb_create_index (db_, col.c_str(), field.c_str());
|
|
547
|
+
else if (name == "dropIndex") res = taladb_drop_index (db_, col.c_str(), field.c_str());
|
|
548
|
+
else if (name == "createFtsIndex") res = taladb_create_fts_index(db_, col.c_str(), field.c_str());
|
|
549
|
+
else res = taladb_drop_fts_index (db_, col.c_str(), field.c_str());
|
|
550
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
549
551
|
return Value::undefined();
|
|
550
552
|
});
|
|
551
553
|
}
|
|
@@ -560,10 +562,10 @@ Value TalaDBHostObject::get(Runtime &rt, const PropNameID &propName) {
|
|
|
560
562
|
if (count < 2) throw JSError(rt, (name + " requires 2 arguments").c_str());
|
|
561
563
|
auto col = args[0].getString(rt).utf8(rt);
|
|
562
564
|
auto fieldsJson = stringify(rt, args[1]); // string[] → JSON array
|
|
563
|
-
|
|
564
|
-
taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
565
|
-
|
|
566
|
-
|
|
565
|
+
int32_t res = name == "createCompoundIndex"
|
|
566
|
+
? taladb_create_compound_index(db_, col.c_str(), fieldsJson.c_str())
|
|
567
|
+
: taladb_drop_compound_index(db_, col.c_str(), fieldsJson.c_str());
|
|
568
|
+
if (res < 0) throw ffiError(rt, (name + " failed").c_str());
|
|
567
569
|
return Value::undefined();
|
|
568
570
|
});
|
|
569
571
|
}
|
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* TalaDB C FFI header.
|
|
3
3
|
*
|
|
4
4
|
* GENERATED FILE — do not edit. Regenerate with:
|
|
5
|
-
*
|
|
6
|
-
* CI fails if this file and
|
|
5
|
+
* packages/bindings/ffi/scripts/gen-header.sh
|
|
6
|
+
* CI fails if this file and packages/bindings/ffi/src/lib.rs disagree.
|
|
7
7
|
*
|
|
8
|
-
* This is the stable C interface
|
|
9
|
-
* JSI HostObject
|
|
10
|
-
*
|
|
8
|
+
* This is the stable C interface of the Rust taladb-ffi crate. Its consumers
|
|
9
|
+
* are the React Native JSI HostObject and TurboModule in this repository and
|
|
10
|
+
* the native Swift (taladb/taladb-swift) and Kotlin (taladb/taladb-kotlin)
|
|
11
|
+
* packages, which ship as separate repositories.
|
|
12
|
+
*
|
|
13
|
+
* Compatibility
|
|
14
|
+
* -------------
|
|
15
|
+
* TALADB_FFI_ABI_VERSION changes whenever a signature in this file changes
|
|
16
|
+
* incompatibly. A wrapper compiled against this header must check that
|
|
17
|
+
* taladb_ffi_abi_version() returns the same value before calling anything
|
|
18
|
+
* else; a mismatch means the library and header came from different releases.
|
|
11
19
|
*
|
|
12
20
|
* Ownership rules
|
|
13
21
|
* ---------------
|
|
@@ -31,6 +39,18 @@
|
|
|
31
39
|
#include <stdlib.h>
|
|
32
40
|
|
|
33
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Version of the C interface in `taladb.h`. Bumped whenever an exported
|
|
44
|
+
* signature changes incompatibly, independently of the crate version.
|
|
45
|
+
*
|
|
46
|
+
* - 1 — through 0.11.8.
|
|
47
|
+
* - 2 — the six index create/drop functions return `int32_t` instead of
|
|
48
|
+
* `void`; `taladb_call`, `taladb_ffi_abi_version`, `taladb_last_error_code`
|
|
49
|
+
* and the live-query functions (`taladb_watch`, `taladb_watch_next`,
|
|
50
|
+
* `taladb_watch_close`, `taladb_watch_with_options`) added.
|
|
51
|
+
*/
|
|
52
|
+
#define TALADB_FFI_ABI_VERSION 2
|
|
53
|
+
|
|
34
54
|
typedef struct TalaDbHandle TalaDbHandle;
|
|
35
55
|
|
|
36
56
|
/**
|
|
@@ -38,6 +58,12 @@ typedef struct TalaDbHandle TalaDbHandle;
|
|
|
38
58
|
*/
|
|
39
59
|
typedef struct TalaDbJob TalaDbJob;
|
|
40
60
|
|
|
61
|
+
/**
|
|
62
|
+
* A live query: a subscription to the documents in one collection that match
|
|
63
|
+
* one filter. Opaque to the caller.
|
|
64
|
+
*/
|
|
65
|
+
typedef struct TalaDbWatch TalaDbWatch;
|
|
66
|
+
|
|
41
67
|
#ifdef __cplusplus
|
|
42
68
|
extern "C" {
|
|
43
69
|
#endif // __cplusplus
|
|
@@ -54,6 +80,30 @@ extern "C" {
|
|
|
54
80
|
*/
|
|
55
81
|
const char *taladb_last_error(void);
|
|
56
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The engine's stable code for the error [`taladb_last_error`] describes —
|
|
85
|
+
* `"Encryption"` for a wrong passphrase, `"InvalidFilter"`, `"DuplicateId"`,
|
|
86
|
+
* and the rest of `TalaDbError::code` — or NULL when the last call succeeded
|
|
87
|
+
* or failed outside the engine (a null pointer, malformed arguments).
|
|
88
|
+
*
|
|
89
|
+
* Codes are a public contract shared with the JavaScript bindings' `error.code`:
|
|
90
|
+
* new ones may be added, an existing one never changes meaning. Read it in the
|
|
91
|
+
* same native call as the message; like the message, it is thread-local.
|
|
92
|
+
* The returned string is static. Do NOT free it.
|
|
93
|
+
*/
|
|
94
|
+
const char *taladb_last_error_code(void);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The [`TALADB_FFI_ABI_VERSION`] this library was built with.
|
|
98
|
+
*
|
|
99
|
+
* The Swift and Kotlin packages live in their own repositories and load a
|
|
100
|
+
* prebuilt library, so the header they compiled against and the library they
|
|
101
|
+
* load can come from different releases. Each checks this once at load time
|
|
102
|
+
* and refuses to continue on a mismatch, because a changed signature links
|
|
103
|
+
* fine and then corrupts the stack at run time.
|
|
104
|
+
*/
|
|
105
|
+
uint32_t taladb_ffi_abi_version(void);
|
|
106
|
+
|
|
57
107
|
/**
|
|
58
108
|
* Open (or create) a TalaDB database at `path`.
|
|
59
109
|
*
|
|
@@ -205,40 +255,48 @@ int32_t taladb_set_user_version(struct TalaDbHandle *handle, uint32_t version);
|
|
|
205
255
|
int32_t taladb_flush(struct TalaDbHandle *handle);
|
|
206
256
|
|
|
207
257
|
/**
|
|
208
|
-
* Create a secondary index on `field`. No-op if already exists.
|
|
258
|
+
* Create a secondary index on `field`. No-op if it already exists.
|
|
259
|
+
* Returns 1 on success, -1 on error.
|
|
209
260
|
*/
|
|
210
|
-
|
|
261
|
+
int32_t taladb_create_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
211
262
|
|
|
212
263
|
/**
|
|
213
|
-
* Drop a secondary index on `field`.
|
|
264
|
+
* Drop a secondary index on `field`. Returns 1 on success, -1 on error
|
|
265
|
+
* (including when no such index exists).
|
|
214
266
|
*/
|
|
215
|
-
|
|
267
|
+
int32_t taladb_drop_index(struct TalaDbHandle *handle, const char *collection, const char *field);
|
|
216
268
|
|
|
217
269
|
/**
|
|
218
270
|
* Create a compound index over `fields_json` (a JSON array of field names).
|
|
271
|
+
* Returns 1 on success, -1 on error.
|
|
219
272
|
*/
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
273
|
+
int32_t taladb_create_compound_index(struct TalaDbHandle *handle,
|
|
274
|
+
const char *collection,
|
|
275
|
+
const char *fields_json);
|
|
223
276
|
|
|
224
277
|
/**
|
|
225
278
|
* Drop a compound index by its ordered field list (`fields_json`).
|
|
279
|
+
* Returns 1 on success, -1 on error.
|
|
226
280
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
281
|
+
int32_t taladb_drop_compound_index(struct TalaDbHandle *handle,
|
|
282
|
+
const char *collection,
|
|
283
|
+
const char *fields_json);
|
|
230
284
|
|
|
231
285
|
/**
|
|
232
|
-
* Create a full-text search index on `field`.
|
|
286
|
+
* Create a full-text search index on `field`. No-op if it already exists.
|
|
287
|
+
* Returns 1 on success, -1 on error.
|
|
233
288
|
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
289
|
+
int32_t taladb_create_fts_index(struct TalaDbHandle *handle,
|
|
290
|
+
const char *collection,
|
|
291
|
+
const char *field);
|
|
237
292
|
|
|
238
293
|
/**
|
|
239
|
-
* Drop a full-text search index on `field`.
|
|
294
|
+
* Drop a full-text search index on `field`. Returns 1 on success, -1 on
|
|
295
|
+
* error (including when no such index exists).
|
|
240
296
|
*/
|
|
241
|
-
|
|
297
|
+
int32_t taladb_drop_fts_index(struct TalaDbHandle *handle,
|
|
298
|
+
const char *collection,
|
|
299
|
+
const char *field);
|
|
242
300
|
|
|
243
301
|
/**
|
|
244
302
|
* Rank documents against a free-text query using BM25 (OR semantics).
|
|
@@ -368,6 +426,72 @@ struct TalaDbJob *taladb_call_start(struct TalaDbHandle *handle,
|
|
|
368
426
|
const char *op,
|
|
369
427
|
const char *args_json);
|
|
370
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Run a JSON operation synchronously on the calling thread.
|
|
431
|
+
*
|
|
432
|
+
* Takes the same `op` names and `args_json` array as [`taladb_call_start`]
|
|
433
|
+
* and returns the result JSON directly, or NULL on error (see
|
|
434
|
+
* `taladb_last_error`). Caller must free the result with `taladb_free_string`.
|
|
435
|
+
*
|
|
436
|
+
* For callers that do their own threading — the Swift and Kotlin packages run
|
|
437
|
+
* it on a background executor — this reaches every operation in the dispatch
|
|
438
|
+
* table, including ones with no dedicated export (`listIndexes`,
|
|
439
|
+
* `vectorCommand`), without a job handle to poll.
|
|
440
|
+
*/
|
|
441
|
+
char *taladb_call(struct TalaDbHandle *handle, const char *op, const char *args_json);
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Subscribe to the documents in `collection` matching `filter_json` (NULL,
|
|
445
|
+
* `"{}"` or `"null"` for all).
|
|
446
|
+
*
|
|
447
|
+
* Writes made through any handle of the same database wake the watch. It
|
|
448
|
+
* delivers no initial snapshot — read the current state with `taladb_find`
|
|
449
|
+
* *after* this returns, so no write can fall between the two.
|
|
450
|
+
*
|
|
451
|
+
* The watch reads from the database it was created on and keeps its storage
|
|
452
|
+
* open until `taladb_watch_close`, even after `taladb_close`. Returns NULL on
|
|
453
|
+
* error.
|
|
454
|
+
*/
|
|
455
|
+
struct TalaDbWatch *taladb_watch(struct TalaDbHandle *handle,
|
|
456
|
+
const char *collection,
|
|
457
|
+
const char *filter_json);
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* [`taladb_watch`], with each snapshot projected like `find`'s options:
|
|
461
|
+
* `{"fields": [..]}` keeps only those fields, `{"exclude": [..]}` drops them.
|
|
462
|
+
* A NULL or `"null"` `options_json` is the same as `taladb_watch`.
|
|
463
|
+
*
|
|
464
|
+
* Every write sends a fresh snapshot across to the caller, so excluding a
|
|
465
|
+
* large field the caller does not display (an embedding) keeps each update
|
|
466
|
+
* small.
|
|
467
|
+
*
|
|
468
|
+
* # Safety
|
|
469
|
+
* As for [`taladb_watch`]; `options_json` may be NULL.
|
|
470
|
+
*/
|
|
471
|
+
struct TalaDbWatch *taladb_watch_with_options(struct TalaDbHandle *handle,
|
|
472
|
+
const char *collection,
|
|
473
|
+
const char *filter_json,
|
|
474
|
+
const char *options_json);
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Wait up to `timeout_ms` for a write to the watched collection.
|
|
478
|
+
*
|
|
479
|
+
* Returns 1 and sets `*out_json` to a JSON array of the matching documents
|
|
480
|
+
* (free with `taladb_free_string`) if a write occurred — several writes since
|
|
481
|
+
* the last call coalesce into one snapshot of the latest state. Returns 0 and
|
|
482
|
+
* sets `*out_json` to NULL on timeout, and -1 on error.
|
|
483
|
+
*
|
|
484
|
+
* The timeout is what lets a caller stop a subscription: loop on this with a
|
|
485
|
+
* short timeout and check for cancellation between calls. Do not call
|
|
486
|
+
* `taladb_watch_close` while a call on the same watch is in progress.
|
|
487
|
+
*/
|
|
488
|
+
int32_t taladb_watch_next(struct TalaDbWatch *watch, uint32_t timeout_ms, char **out_json);
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Close a watch and release the storage it holds open. NULL is a no-op.
|
|
492
|
+
*/
|
|
493
|
+
void taladb_watch_close(struct TalaDbWatch *watch);
|
|
494
|
+
|
|
371
495
|
/**
|
|
372
496
|
* Start a `find_nearest` in a background thread. Returns a job handle, or
|
|
373
497
|
* NULL on immediate error (bad args). The Float32 query vector is copied
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/ios/TalaDBFfi.xcframework/ios-arm64_x86_64-simulator/libtaladb_ffi_sim.a
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 83822336 bytes
|
|
4
|
+
sha256: 40b31cebfc81427edb7e969dfcd6fbffb3aa9cdc7dea25193ef66411ed1abb12
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taladb/react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "TalaDB React Native module — document and vector database via JSI HostObject",
|
|
5
5
|
"main": "src/index",
|
|
6
6
|
"types": "src/index.tsx",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
],
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/
|
|
28
|
+
"url": "https://github.com/taladb/taladb.git",
|
|
29
29
|
"directory": "packages/bindings/react-native"
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://taladb.dev/guide/react-native",
|
|
32
32
|
"bugs": {
|
|
33
|
-
"url": "https://github.com/
|
|
33
|
+
"url": "https://github.com/taladb/taladb/issues"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18"
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"react-native": "^0.83.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"taladb": "0.
|
|
52
|
+
"taladb": "0.12.1"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"typecheck": "tsc --noEmit",
|
|
56
56
|
"build:ios": "sh scripts/build-ios.sh",
|
|
57
57
|
"build:android": "sh scripts/build-android.sh",
|
|
58
|
-
"build:cbindgen": "
|
|
58
|
+
"build:cbindgen": "../ffi/scripts/gen-header.sh"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/index.tsx
CHANGED
|
@@ -17,11 +17,11 @@ export type {
|
|
|
17
17
|
HybridSearchOptions,
|
|
18
18
|
TextSearchOptions,
|
|
19
19
|
VectorMetric,
|
|
20
|
-
VectorClient, VectorQueryOptions, VectorRebuildOptions, VectorBuildProgress, VectorIndexStatus, VectorQueryResult, VectorRecall, VectorGraphOptions, VectorQuantization,
|
|
20
|
+
MemoryPressure, VectorCacheStats, VectorClient, VectorQueryOptions, VectorRebuildOptions, VectorBuildProgress, VectorIndexStatus, VectorQueryResult, VectorRecall, VectorGraphOptions, VectorQuantization,
|
|
21
21
|
} from 'taladb';
|
|
22
22
|
|
|
23
23
|
export const TalaDBModule = {
|
|
24
|
-
/** Open the native database
|
|
24
|
+
/** Open the native database with durability, encryption and vector cache settings. */
|
|
25
25
|
initialize: (dbName: string, configJson?: string) =>
|
|
26
26
|
NativeTalaDB.initialize(dbName, configJson),
|
|
27
27
|
close: () => NativeTalaDB.close(),
|
|
@@ -6,12 +6,12 @@ Pod::Spec.new do |s|
|
|
|
6
6
|
s.name = "taladb-react-native"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
|
-
s.homepage = "https://github.com/
|
|
9
|
+
s.homepage = "https://github.com/taladb/taladb"
|
|
10
10
|
s.license = package["license"]
|
|
11
11
|
s.authors = { "taladb" => "hello@thinkgrid.io" }
|
|
12
12
|
|
|
13
13
|
s.platforms = { :ios => "13.0" }
|
|
14
|
-
s.source = { :git => "https://github.com/
|
|
14
|
+
s.source = { :git => "https://github.com/taladb/taladb.git",
|
|
15
15
|
:tag => "v#{s.version}" }
|
|
16
16
|
|
|
17
17
|
# TypeScript / JS sources (not compiled by Xcode, just bundled)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|