@quereus/plugin-react-native-leveldb 4.11.0 → 4.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 +34 -0
- package/dist/src/provider.d.ts +36 -16
- package/dist/src/provider.d.ts.map +1 -1
- package/dist/src/provider.js +150 -46
- package/dist/src/provider.js.map +1 -1
- package/dist/src/store.d.ts +33 -0
- package/dist/src/store.d.ts.map +1 -1
- package/dist/src/store.js +77 -1
- package/dist/src/store.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -16,6 +16,40 @@ LevelDB storage plugin for Quereus on React Native. Provides fast, persistent st
|
|
|
16
16
|
- **Persistent**: Data survives app restarts
|
|
17
17
|
- **Atomic batch writes**: Uses native LevelDB WriteBatch for atomic multi-key operations
|
|
18
18
|
|
|
19
|
+
## Database naming
|
|
20
|
+
|
|
21
|
+
Each logical store — a table's row data, or one of its secondary indexes — is its own
|
|
22
|
+
on-device LevelDB database. The name comes from `@quereus/store`'s shared builders, is
|
|
23
|
+
percent-escaped into a filename-safe form, and is prefixed with the configurable
|
|
24
|
+
`databaseName` (default `quereus`):
|
|
25
|
+
|
|
26
|
+
| Logical store | LevelDB database |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| table `t` in schema `main` | `quereus.main.t` |
|
|
29
|
+
| index `x` on table `t` | `quereus.main.t_idx_x` |
|
|
30
|
+
| table `a b` in schema `main` | `quereus.main.a%20b` |
|
|
31
|
+
| table `a/b` in schema `main` | `quereus.main.a%2Fb` |
|
|
32
|
+
| unified stats | `quereus.__stats__` |
|
|
33
|
+
| catalog (DDL) | `quereus.__catalog__` |
|
|
34
|
+
|
|
35
|
+
rn-leveldb resolves the name it is given as a path under the app's documents directory, so
|
|
36
|
+
the escape covers every byte that is hostile in a filename: the path separators `/` and
|
|
37
|
+
`\`, `:`, the Windows-illegal `* ? " < > |`, `%` itself (the escape introducer), and every
|
|
38
|
+
control, space and non-ASCII byte. Because the separators can never appear literally, the
|
|
39
|
+
whole name is always a single path component. The escape is reversible in principle, which
|
|
40
|
+
is what guarantees two differently-named tables never share one database.
|
|
41
|
+
|
|
42
|
+
The two reserved databases are deliberately **not** escaped, which is what keeps them
|
|
43
|
+
unreachable from any user table: every logical store name contains a `.` (it is built as
|
|
44
|
+
`{schema}.{table}`) and neither `__stats__` nor `__catalog__` does.
|
|
45
|
+
|
|
46
|
+
> **Hard cutover (no on-disk migration).** An earlier version derived its own names and
|
|
47
|
+
> lowercased only part of them — an index store was named with the index name's original
|
|
48
|
+
> case, so one logical index could occupy two on-device databases depending on how the SQL
|
|
49
|
+
> spelled it. Databases written by the older version are **not** read by this version and
|
|
50
|
+
> must be re-created. Pre-1.0 dev data is expected to be thrown away; there is no migration
|
|
51
|
+
> importer.
|
|
52
|
+
|
|
19
53
|
## Installation
|
|
20
54
|
|
|
21
55
|
```bash
|
package/dist/src/provider.d.ts
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React Native LevelDB KVStore provider implementation.
|
|
3
3
|
*
|
|
4
|
-
* Manages LevelDB stores for the StoreModule in React Native environments.
|
|
4
|
+
* Manages LevelDB stores for the StoreModule in React Native environments. Each logical
|
|
5
|
+
* store is its own on-device LevelDB database, named after the store.
|
|
5
6
|
*
|
|
6
|
-
* Storage naming convention
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* {prefix}.
|
|
7
|
+
* Storage naming convention. Every logical store name comes from the shared builders
|
|
8
|
+
* (`buildDataStoreName` / `buildIndexStoreName`), then {@link encodeDatabaseName} escapes
|
|
9
|
+
* it into a filename-safe form:
|
|
10
|
+
*
|
|
11
|
+
* {prefix}.{encoded {schema}.{table}} - Data store (row data)
|
|
12
|
+
* {prefix}.{encoded {schema}.{table}_idx_{name}} - Index store (secondary indexes)
|
|
13
|
+
* {prefix}.__stats__ - Unified stats store (row counts)
|
|
14
|
+
* {prefix}.__catalog__ - Catalog store (DDL metadata)
|
|
15
|
+
*
|
|
16
|
+
* e.g. table `users` in schema `main` → `quereus.main.users`; a table named `a/b` →
|
|
17
|
+
* `quereus.main.a%2Fb`.
|
|
18
|
+
*
|
|
19
|
+
* The two reserved stores are NOT run through the encoder, and that is what keeps them in
|
|
20
|
+
* a namespace no table can reach — see {@link encodeDatabaseName}.
|
|
21
|
+
*
|
|
22
|
+
* HARD CUTOVER: an earlier version derived its own names and lowercased only part of them
|
|
23
|
+
* (an index store was `{prefix}.{schema}.{table}_idx_{indexName}` with the index name's
|
|
24
|
+
* case preserved, so one logical index could occupy two on-device databases). Those
|
|
25
|
+
* databases are NOT read here and must be re-created; there is no on-disk migration.
|
|
11
26
|
*/
|
|
12
27
|
import type { KVStore, KVStoreProvider } from '@quereus/store';
|
|
13
28
|
import { type LevelDBOpenFn, type LevelDBWriteBatchConstructor } from './store.js';
|
|
@@ -53,15 +68,6 @@ export declare class ReactNativeLevelDBProvider implements KVStoreProvider {
|
|
|
53
68
|
private catalogStore;
|
|
54
69
|
private statsStore;
|
|
55
70
|
constructor(options: ReactNativeLevelDBProviderOptions);
|
|
56
|
-
/**
|
|
57
|
-
* Get the database name for a table.
|
|
58
|
-
* Uses dots as separators for a flat namespace.
|
|
59
|
-
*/
|
|
60
|
-
private getDatabaseName;
|
|
61
|
-
/**
|
|
62
|
-
* Get the key for the store cache.
|
|
63
|
-
*/
|
|
64
|
-
private getStoreKey;
|
|
65
71
|
getStore(schemaName: string, tableName: string, _options?: Record<string, unknown>): Promise<KVStore>;
|
|
66
72
|
getIndexStore(schemaName: string, tableName: string, indexName: string): Promise<KVStore>;
|
|
67
73
|
getStatsStore(_schemaName: string, _tableName: string): Promise<KVStore>;
|
|
@@ -71,8 +77,22 @@ export declare class ReactNativeLevelDBProvider implements KVStoreProvider {
|
|
|
71
77
|
closeAll(): Promise<void>;
|
|
72
78
|
deleteIndexStore(schemaName: string, tableName: string, indexName: string): Promise<void>;
|
|
73
79
|
deleteTableStores(schemaName: string, tableName: string, indexNames: readonly string[]): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Get or open the store for a logical store name, caching by that CANONICAL name —
|
|
82
|
+
* the same string the shared builders produce and `StoreModule` reasons about. Keying
|
|
83
|
+
* the cache by anything else (a separately-derived spelling) risks two cache entries
|
|
84
|
+
* for one on-device database, or one entry shared by two.
|
|
85
|
+
*/
|
|
74
86
|
private getOrCreateStore;
|
|
75
|
-
private
|
|
87
|
+
private closeStoreByName;
|
|
88
|
+
/**
|
|
89
|
+
* Erase a store's keyspace and drop its cached handle, so a store re-opened later under
|
|
90
|
+
* the same name is EMPTY — the reclaim contract on
|
|
91
|
+
* {@link KVStoreProvider.deleteTableStores}. Same shape as `@quereus/plugin-leveldb`'s
|
|
92
|
+
* `clearAndDropStore`: the store owns the erase ({@link ReactNativeLevelDBStore.clear}),
|
|
93
|
+
* the provider owns the handle.
|
|
94
|
+
*/
|
|
95
|
+
private clearAndDropStore;
|
|
76
96
|
}
|
|
77
97
|
/**
|
|
78
98
|
* Create a React Native LevelDB provider with the given options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,4BAA4B,EAAE,MAAM,YAAY,CAAC;AA2E5G;;GAEG;AACH,MAAM,WAAW,iCAAiC;IACjD;;;;OAIG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;;OAGG;IACH,UAAU,EAAE,4BAA4B,CAAC;IAEzC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,eAAe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AC;IAiB5G;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;YAuBV,gBAAgB;IAQ9B;;;;;;OAMG;YACW,iBAAiB;CAgB/B;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,iCAAiC,GAAG,0BAA0B,CAEvH"}
|
package/dist/src/provider.js
CHANGED
|
@@ -1,16 +1,102 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React Native LevelDB KVStore provider implementation.
|
|
3
3
|
*
|
|
4
|
-
* Manages LevelDB stores for the StoreModule in React Native environments.
|
|
4
|
+
* Manages LevelDB stores for the StoreModule in React Native environments. Each logical
|
|
5
|
+
* store is its own on-device LevelDB database, named after the store.
|
|
5
6
|
*
|
|
6
|
-
* Storage naming convention
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* {prefix}.
|
|
7
|
+
* Storage naming convention. Every logical store name comes from the shared builders
|
|
8
|
+
* (`buildDataStoreName` / `buildIndexStoreName`), then {@link encodeDatabaseName} escapes
|
|
9
|
+
* it into a filename-safe form:
|
|
10
|
+
*
|
|
11
|
+
* {prefix}.{encoded {schema}.{table}} - Data store (row data)
|
|
12
|
+
* {prefix}.{encoded {schema}.{table}_idx_{name}} - Index store (secondary indexes)
|
|
13
|
+
* {prefix}.__stats__ - Unified stats store (row counts)
|
|
14
|
+
* {prefix}.__catalog__ - Catalog store (DDL metadata)
|
|
15
|
+
*
|
|
16
|
+
* e.g. table `users` in schema `main` → `quereus.main.users`; a table named `a/b` →
|
|
17
|
+
* `quereus.main.a%2Fb`.
|
|
18
|
+
*
|
|
19
|
+
* The two reserved stores are NOT run through the encoder, and that is what keeps them in
|
|
20
|
+
* a namespace no table can reach — see {@link encodeDatabaseName}.
|
|
21
|
+
*
|
|
22
|
+
* HARD CUTOVER: an earlier version derived its own names and lowercased only part of them
|
|
23
|
+
* (an index store was `{prefix}.{schema}.{table}_idx_{indexName}` with the index name's
|
|
24
|
+
* case preserved, so one logical index could occupy two on-device databases). Those
|
|
25
|
+
* databases are NOT read here and must be re-created; there is no on-disk migration.
|
|
11
26
|
*/
|
|
12
|
-
import {
|
|
27
|
+
import { buildDataStoreName, buildIndexStoreName, CATALOG_STORE_NAME, STATS_STORE_NAME } from '@quereus/store';
|
|
13
28
|
import { ReactNativeLevelDBStore } from './store.js';
|
|
29
|
+
const textEncoder = new TextEncoder();
|
|
30
|
+
/**
|
|
31
|
+
* True when `byte` may appear literally in a database name.
|
|
32
|
+
*
|
|
33
|
+
* Printable ASCII only, minus the escape introducer `%` and every byte that is hostile in
|
|
34
|
+
* a filesystem path — rn-leveldb resolves the name it is given as a path under the app's
|
|
35
|
+
* documents directory, so the name has to be safe as a SINGLE path component.
|
|
36
|
+
*
|
|
37
|
+
* Excluded: `/` and `\` (path separators — excluding them is what stops a quoted table
|
|
38
|
+
* name from reaching a directory boundary, so a name like `..` can only ever be a strange
|
|
39
|
+
* filename, never a traversal), `:` (a separator on Apple platforms and in Windows paths),
|
|
40
|
+
* and `* ? " < > |` (illegal on Windows). The last group is not needed on iOS/Android but
|
|
41
|
+
* costs nothing: ordinary identifiers contain none of these, and excluding them keeps the
|
|
42
|
+
* name usable if a host ever puts it on a Windows-like filesystem. Control bytes, NUL,
|
|
43
|
+
* space and every non-ASCII byte fall outside the printable range and are escaped too.
|
|
44
|
+
*/
|
|
45
|
+
function isSafeNameByte(byte) {
|
|
46
|
+
if (byte < 0x21 || byte > 0x7e)
|
|
47
|
+
return false;
|
|
48
|
+
switch (byte) {
|
|
49
|
+
case 0x25: // '%' — reserved as the escape introducer, so the mapping stays injective
|
|
50
|
+
case 0x2f: // '/'
|
|
51
|
+
case 0x5c: // '\'
|
|
52
|
+
case 0x3a: // ':'
|
|
53
|
+
case 0x2a: // '*'
|
|
54
|
+
case 0x3f: // '?'
|
|
55
|
+
case 0x22: // '"'
|
|
56
|
+
case 0x3c: // '<'
|
|
57
|
+
case 0x3e: // '>'
|
|
58
|
+
case 0x7c: // '|'
|
|
59
|
+
return false;
|
|
60
|
+
default:
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Escape a logical store name into a filename-safe on-device database name.
|
|
66
|
+
*
|
|
67
|
+
* Percent-encoding of the UTF-8 bytes, same shape as `@quereus/plugin-leveldb`'s
|
|
68
|
+
* `encodeSublevelName` (no SQL is involved here, so `%` is free to be the introducer) but
|
|
69
|
+
* with a stricter safe set — see {@link isSafeNameByte}. Ordinary lowercase identifiers,
|
|
70
|
+
* `.` and `_` pass through unchanged; the name is never decoded back.
|
|
71
|
+
*
|
|
72
|
+
* The mapping is injective over the names the shared builders can produce, which is what
|
|
73
|
+
* `StoreModule.assertStoreNameFree` relies on: it compares LOGICAL names and only stands in
|
|
74
|
+
* for a physical collision check while each provider's encoding is one-to-one. (It is NOT
|
|
75
|
+
* injective over arbitrary JS strings — `TextEncoder` folds every unpaired surrogate to
|
|
76
|
+
* U+FFFD — but those builders reject such an identifier, so no such name reaches here.)
|
|
77
|
+
*
|
|
78
|
+
* Disjoint from the reserved store names: `{databaseName}.__stats__` and
|
|
79
|
+
* `{databaseName}.__catalog__` are used UNESCAPED, and every canonical store name contains
|
|
80
|
+
* at least one `.` (it is built as `{schema}.{table}`) which survives escaping, while
|
|
81
|
+
* neither reserved name contains one. Do not run the reserved names through this function.
|
|
82
|
+
*/
|
|
83
|
+
// NOTE: escaping is a 3x expansion per unsafe byte, and the result is one path component,
|
|
84
|
+
// which most filesystems cap at 255 bytes. A 90-character Cyrillic table name is 193 bytes
|
|
85
|
+
// as raw UTF-8 (which the previous unescaped naming handed to rn-leveldb) but 553 bytes
|
|
86
|
+
// escaped, so names of roughly 80+ non-ASCII characters that used to open will now fail on
|
|
87
|
+
// device with a filesystem error. Not reproducible off-device (the tests drive MockLevelDB,
|
|
88
|
+
// which has no path). If long non-ASCII table names ever need to work here, hash the tail of
|
|
89
|
+
// an over-long encoded name rather than widening the safe set — the escape must stay
|
|
90
|
+
// injective. The other three providers have no equivalent limit.
|
|
91
|
+
function encodeDatabaseName(name) {
|
|
92
|
+
let out = '';
|
|
93
|
+
for (const byte of textEncoder.encode(name)) {
|
|
94
|
+
out += isSafeNameByte(byte)
|
|
95
|
+
? String.fromCharCode(byte)
|
|
96
|
+
: '%' + byte.toString(16).toUpperCase().padStart(2, '0');
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
14
100
|
/**
|
|
15
101
|
* React Native LevelDB implementation of KVStoreProvider.
|
|
16
102
|
*
|
|
@@ -31,27 +117,11 @@ export class ReactNativeLevelDBProvider {
|
|
|
31
117
|
this.databaseName = options.databaseName ?? 'quereus';
|
|
32
118
|
this.createIfMissing = options.createIfMissing ?? true;
|
|
33
119
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the database name for a table.
|
|
36
|
-
* Uses dots as separators for a flat namespace.
|
|
37
|
-
*/
|
|
38
|
-
getDatabaseName(schemaName, tableName) {
|
|
39
|
-
return `${this.databaseName}.${schemaName}.${tableName}`.toLowerCase();
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Get the key for the store cache.
|
|
43
|
-
*/
|
|
44
|
-
getStoreKey(schemaName, tableName) {
|
|
45
|
-
return `${schemaName}.${tableName}`.toLowerCase();
|
|
46
|
-
}
|
|
47
120
|
async getStore(schemaName, tableName, _options) {
|
|
48
|
-
|
|
49
|
-
return this.getOrCreateStore(key, this.getDatabaseName(schemaName, tableName));
|
|
121
|
+
return this.getOrCreateStore(buildDataStoreName(schemaName, tableName));
|
|
50
122
|
}
|
|
51
123
|
async getIndexStore(schemaName, tableName, indexName) {
|
|
52
|
-
|
|
53
|
-
const dbName = `${this.getDatabaseName(schemaName, tableName)}${STORE_SUFFIX.INDEX}${indexName}`;
|
|
54
|
-
return this.getOrCreateStore(key, dbName);
|
|
124
|
+
return this.getOrCreateStore(buildIndexStoreName(schemaName, tableName, indexName));
|
|
55
125
|
}
|
|
56
126
|
async getStatsStore(_schemaName, _tableName) {
|
|
57
127
|
// Use the unified __stats__ store for all tables
|
|
@@ -65,7 +135,7 @@ export class ReactNativeLevelDBProvider {
|
|
|
65
135
|
}
|
|
66
136
|
async getCatalogStore() {
|
|
67
137
|
if (!this.catalogStore) {
|
|
68
|
-
const catalogDbName = `${this.databaseName}
|
|
138
|
+
const catalogDbName = `${this.databaseName}.${CATALOG_STORE_NAME}`;
|
|
69
139
|
this.catalogStore = ReactNativeLevelDBStore.open(this.openFn, this.WriteBatch, catalogDbName, {
|
|
70
140
|
createIfMissing: this.createIfMissing,
|
|
71
141
|
});
|
|
@@ -73,12 +143,10 @@ export class ReactNativeLevelDBProvider {
|
|
|
73
143
|
return this.catalogStore;
|
|
74
144
|
}
|
|
75
145
|
async closeStore(schemaName, tableName) {
|
|
76
|
-
|
|
77
|
-
await this.closeStoreByKey(key);
|
|
146
|
+
await this.closeStoreByName(buildDataStoreName(schemaName, tableName));
|
|
78
147
|
}
|
|
79
148
|
async closeIndexStore(schemaName, tableName, indexName) {
|
|
80
|
-
|
|
81
|
-
await this.closeStoreByKey(key);
|
|
149
|
+
await this.closeStoreByName(buildIndexStoreName(schemaName, tableName, indexName));
|
|
82
150
|
}
|
|
83
151
|
async closeAll() {
|
|
84
152
|
for (const store of this.stores.values()) {
|
|
@@ -95,40 +163,76 @@ export class ReactNativeLevelDBProvider {
|
|
|
95
163
|
}
|
|
96
164
|
}
|
|
97
165
|
async deleteIndexStore(schemaName, tableName, indexName) {
|
|
98
|
-
|
|
99
|
-
await this.closeStoreByKey(key);
|
|
100
|
-
// Note: LevelDB doesn't have a built-in delete, would need filesystem ops
|
|
166
|
+
await this.clearAndDropStore(buildIndexStoreName(schemaName, tableName, indexName));
|
|
101
167
|
}
|
|
102
168
|
async deleteTableStores(schemaName, tableName, indexNames) {
|
|
103
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
169
|
+
// Erase the data store's keyspace.
|
|
170
|
+
await this.clearAndDropStore(buildDataStoreName(schemaName, tableName));
|
|
171
|
+
// Stats live in the unified __stats__ store, so there is no per-table stats store to
|
|
172
|
+
// clear here. (The table's ENTRY in that store is not reclaimed by anyone today —
|
|
173
|
+
// tracked as `bug-drop-table-leaves-stale-stats-entry`; it is a stale row-count
|
|
174
|
+
// estimate, not stale rows.)
|
|
175
|
+
// Erase exactly the table's index stores (by name), not every store matching
|
|
109
176
|
// the `{table}_idx_` prefix — that prefix also matches a sibling table
|
|
110
177
|
// literally named `{table}_idx_<x>`.
|
|
111
178
|
for (const indexName of indexNames) {
|
|
112
|
-
await this.
|
|
179
|
+
await this.clearAndDropStore(buildIndexStoreName(schemaName, tableName, indexName));
|
|
113
180
|
}
|
|
114
181
|
}
|
|
115
|
-
|
|
116
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Get or open the store for a logical store name, caching by that CANONICAL name —
|
|
184
|
+
* the same string the shared builders produce and `StoreModule` reasons about. Keying
|
|
185
|
+
* the cache by anything else (a separately-derived spelling) risks two cache entries
|
|
186
|
+
* for one on-device database, or one entry shared by two.
|
|
187
|
+
*/
|
|
188
|
+
getOrCreateStore(storeName) {
|
|
189
|
+
let store = this.stores.get(storeName);
|
|
190
|
+
if (store?.isClosed()) {
|
|
191
|
+
// A handle handed out earlier was closed out-of-band (e.g. the StoreTable's
|
|
192
|
+
// releaseIndexStore closes the index handle just before dropIndex calls
|
|
193
|
+
// deleteIndexStore). Evict the stale entry and re-open the database — every read
|
|
194
|
+
// through a closed handle throws, including the clearing walk below.
|
|
195
|
+
this.stores.delete(storeName);
|
|
196
|
+
store = undefined;
|
|
197
|
+
}
|
|
117
198
|
if (!store) {
|
|
199
|
+
const dbName = `${this.databaseName}.${encodeDatabaseName(storeName)}`;
|
|
118
200
|
store = ReactNativeLevelDBStore.open(this.openFn, this.WriteBatch, dbName, {
|
|
119
201
|
createIfMissing: this.createIfMissing,
|
|
120
202
|
});
|
|
121
|
-
this.stores.set(
|
|
203
|
+
this.stores.set(storeName, store);
|
|
122
204
|
}
|
|
123
205
|
return store;
|
|
124
206
|
}
|
|
125
|
-
async
|
|
126
|
-
const store = this.stores.get(
|
|
207
|
+
async closeStoreByName(storeName) {
|
|
208
|
+
const store = this.stores.get(storeName);
|
|
127
209
|
if (store) {
|
|
128
210
|
await store.close();
|
|
129
|
-
this.stores.delete(
|
|
211
|
+
this.stores.delete(storeName);
|
|
130
212
|
}
|
|
131
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Erase a store's keyspace and drop its cached handle, so a store re-opened later under
|
|
216
|
+
* the same name is EMPTY — the reclaim contract on
|
|
217
|
+
* {@link KVStoreProvider.deleteTableStores}. Same shape as `@quereus/plugin-leveldb`'s
|
|
218
|
+
* `clearAndDropStore`: the store owns the erase ({@link ReactNativeLevelDBStore.clear}),
|
|
219
|
+
* the provider owns the handle.
|
|
220
|
+
*/
|
|
221
|
+
async clearAndDropStore(storeName) {
|
|
222
|
+
// NOTE: opening the store first means clearing a store that never existed CREATES an
|
|
223
|
+
// empty on-device database as a side effect (createIfMissing defaults true). Harmless
|
|
224
|
+
// — the operation is still a no-op for data, which is what the reclaim contract asks
|
|
225
|
+
// of an absent store — and it leaves the same empty-database residue described below.
|
|
226
|
+
const store = this.getOrCreateStore(storeName);
|
|
227
|
+
await store.clear();
|
|
228
|
+
// NOTE: this empties the database but leaves the on-device LevelDB DIRECTORY in place
|
|
229
|
+
// (a few KB of MANIFEST/LOG/CURRENT per dropped store). The row data — the leak that
|
|
230
|
+
// matters on a phone — is gone. If empty-database residue ever matters, add an optional
|
|
231
|
+
// `destroyFn` provider option (rn-leveldb's database-destroy entry point) and call it
|
|
232
|
+
// after clearing; check the installed rn-leveldb version for that API's real shape
|
|
233
|
+
// rather than guessing, since it is only a peer dependency here.
|
|
234
|
+
await this.closeStoreByName(storeName);
|
|
235
|
+
}
|
|
132
236
|
}
|
|
133
237
|
/**
|
|
134
238
|
* Create a React Native LevelDB provider with the given options.
|
package/dist/src/provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC/G,OAAO,EAAE,uBAAuB,EAAyD,MAAM,YAAY,CAAC;AAE5G,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC;;;;;;;;;;;;;;GAcG;AACH,SAAS,cAAc,CAAC,IAAY;IACnC,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,IAAI,CAAC,CAAC,0EAA0E;QACrF,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,CAAC,CAAC,MAAM;QACjB,KAAK,IAAI,EAAE,MAAM;YAChB,OAAO,KAAK,CAAC;QACd;YACC,OAAO,IAAI,CAAC;IACd,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,0FAA0F;AAC1F,2FAA2F;AAC3F,wFAAwF;AACxF,2FAA2F;AAC3F,4FAA4F;AAC5F,6FAA6F;AAC7F,qFAAqF;AACrF,iEAAiE;AACjE,SAAS,kBAAkB,CAAC,IAAY;IACvC,IAAI,GAAG,GAAG,EAAE,CAAC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AAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/src/store.d.ts
CHANGED
|
@@ -131,6 +131,12 @@ export declare class ReactNativeLevelDBStore implements KVStore {
|
|
|
131
131
|
errorIfExists?: boolean;
|
|
132
132
|
}): ReactNativeLevelDBStore;
|
|
133
133
|
get(key: Uint8Array): Promise<Uint8Array | undefined>;
|
|
134
|
+
/**
|
|
135
|
+
* The shared fallback is the right answer here: rn-leveldb's `getBuf` is a SYNCHRONOUS
|
|
136
|
+
* native call with no multi-get in its surface, so there is no round trip to collapse —
|
|
137
|
+
* a batch is already just N in-process reads.
|
|
138
|
+
*/
|
|
139
|
+
getMany(keys: readonly Uint8Array[]): Promise<(Uint8Array | undefined)[]>;
|
|
134
140
|
put(key: Uint8Array, value: Uint8Array): Promise<void>;
|
|
135
141
|
delete(key: Uint8Array): Promise<void>;
|
|
136
142
|
has(key: Uint8Array): Promise<boolean>;
|
|
@@ -143,7 +149,34 @@ export declare class ReactNativeLevelDBStore implements KVStore {
|
|
|
143
149
|
*/
|
|
144
150
|
private walkEntries;
|
|
145
151
|
batch(): WriteBatch;
|
|
152
|
+
/**
|
|
153
|
+
* Delete every entry in the store, leaving the database itself open and usable — the
|
|
154
|
+
* erase behind the provider's reclaim of a dropped table (`LevelDBStore.clear`'s
|
|
155
|
+
* counterpart, which its sublevel can do natively).
|
|
156
|
+
*
|
|
157
|
+
* rn-leveldb exposes no range delete, so the erase is a bounded walk that deletes what
|
|
158
|
+
* it reads: each pass takes at most {@link CLEAR_CHUNK_SIZE} keys and deletes them in
|
|
159
|
+
* one `WriteBatch`, then resumes strictly PAST the last key it saw. Resuming — rather
|
|
160
|
+
* than re-reading from the start — is what makes the walk terminate after exactly one
|
|
161
|
+
* pass over the keyspace even if a delete did not land, instead of spinning forever.
|
|
162
|
+
*
|
|
163
|
+
* NOTE: chunked, therefore not crash-atomic — a process death partway through leaves a
|
|
164
|
+
* tail of keys behind, which a store re-opened under the same name would then see. Same
|
|
165
|
+
* exposure as `@quereus/plugin-leveldb`'s sublevel clear. If DDL crash-consistency is
|
|
166
|
+
* ever tightened, a cleared store needs a tombstone the next open honors rather than a
|
|
167
|
+
* best-effort walk.
|
|
168
|
+
*/
|
|
169
|
+
clear(): Promise<void>;
|
|
170
|
+
/** At most {@link CLEAR_CHUNK_SIZE} keys, starting strictly past `after`. */
|
|
171
|
+
private readKeyChunk;
|
|
146
172
|
close(): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* True once {@link close} has run. Lets the provider notice a handle a caller closed
|
|
175
|
+
* out-of-band (`StoreTableBase.releaseIndexStore` closes an index handle just before
|
|
176
|
+
* `dropIndex` asks the provider to delete that store) and re-open instead of handing
|
|
177
|
+
* back a dead one.
|
|
178
|
+
*/
|
|
179
|
+
isClosed(): boolean;
|
|
147
180
|
approximateCount(options?: IterateOptions): Promise<number>;
|
|
148
181
|
private checkOpen;
|
|
149
182
|
}
|
package/dist/src/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAgC,KAAK,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhI;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAElE;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACd;AAED;;;GA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OAAO,CAAC,SAAS;CAKjB"}
|
package/dist/src/store.js
CHANGED
|
@@ -7,7 +7,17 @@
|
|
|
7
7
|
// `compareBytes` is the ordering oracle the KVStore contract and its conformance battery
|
|
8
8
|
// are written against — the bound checks below must use that exact definition, not a
|
|
9
9
|
// re-derived copy that could drift from it.
|
|
10
|
-
import { compareBytes } from '@quereus/store';
|
|
10
|
+
import { compareBytes, defaultGetMany } from '@quereus/store';
|
|
11
|
+
/**
|
|
12
|
+
* Keys read-then-deleted per pass by {@link ReactNativeLevelDBStore.clear}.
|
|
13
|
+
*
|
|
14
|
+
* Emptying the keyspace in bounded chunks — rather than reading every key into one
|
|
15
|
+
* `WriteBatch` — keeps peak memory at a chunk however large the store is, the same
|
|
16
|
+
* bounded-peak rule {@link KVStore.iterate} is held to. The size is the usual peak-memory /
|
|
17
|
+
* round-trip tradeoff; it is a judgement call, not a measurement (nothing has profiled a
|
|
18
|
+
* drop on device).
|
|
19
|
+
*/
|
|
20
|
+
const CLEAR_CHUNK_SIZE = 512;
|
|
11
21
|
/**
|
|
12
22
|
* LevelDB implementation of KVStore for React Native.
|
|
13
23
|
*
|
|
@@ -40,6 +50,14 @@ export class ReactNativeLevelDBStore {
|
|
|
40
50
|
const result = this.db.getBuf(toArrayBuffer(key));
|
|
41
51
|
return result === null ? undefined : toUint8Array(result);
|
|
42
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* The shared fallback is the right answer here: rn-leveldb's `getBuf` is a SYNCHRONOUS
|
|
55
|
+
* native call with no multi-get in its surface, so there is no round trip to collapse —
|
|
56
|
+
* a batch is already just N in-process reads.
|
|
57
|
+
*/
|
|
58
|
+
getMany(keys) {
|
|
59
|
+
return defaultGetMany(this, keys);
|
|
60
|
+
}
|
|
43
61
|
async put(key, value) {
|
|
44
62
|
this.checkOpen();
|
|
45
63
|
this.db.put(toArrayBuffer(key), toArrayBuffer(value));
|
|
@@ -162,12 +180,70 @@ export class ReactNativeLevelDBStore {
|
|
|
162
180
|
this.checkOpen();
|
|
163
181
|
return new ReactNativeLevelDBWriteBatch(this.db, this.WriteBatchCtor);
|
|
164
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Delete every entry in the store, leaving the database itself open and usable — the
|
|
185
|
+
* erase behind the provider's reclaim of a dropped table (`LevelDBStore.clear`'s
|
|
186
|
+
* counterpart, which its sublevel can do natively).
|
|
187
|
+
*
|
|
188
|
+
* rn-leveldb exposes no range delete, so the erase is a bounded walk that deletes what
|
|
189
|
+
* it reads: each pass takes at most {@link CLEAR_CHUNK_SIZE} keys and deletes them in
|
|
190
|
+
* one `WriteBatch`, then resumes strictly PAST the last key it saw. Resuming — rather
|
|
191
|
+
* than re-reading from the start — is what makes the walk terminate after exactly one
|
|
192
|
+
* pass over the keyspace even if a delete did not land, instead of spinning forever.
|
|
193
|
+
*
|
|
194
|
+
* NOTE: chunked, therefore not crash-atomic — a process death partway through leaves a
|
|
195
|
+
* tail of keys behind, which a store re-opened under the same name would then see. Same
|
|
196
|
+
* exposure as `@quereus/plugin-leveldb`'s sublevel clear. If DDL crash-consistency is
|
|
197
|
+
* ever tightened, a cleared store needs a tombstone the next open honors rather than a
|
|
198
|
+
* best-effort walk.
|
|
199
|
+
*/
|
|
200
|
+
async clear() {
|
|
201
|
+
this.checkOpen();
|
|
202
|
+
let cursor;
|
|
203
|
+
for (;;) {
|
|
204
|
+
const keys = await this.readKeyChunk(cursor);
|
|
205
|
+
if (keys.length === 0)
|
|
206
|
+
break;
|
|
207
|
+
cursor = keys[keys.length - 1];
|
|
208
|
+
// A fresh batch per pass: `WriteBatch` is documented single-use, so reusing one
|
|
209
|
+
// across writes would lean on backend-specific behavior this store happens to
|
|
210
|
+
// have and `@quereus/plugin-leveldb` does not.
|
|
211
|
+
const batch = this.batch();
|
|
212
|
+
for (const key of keys) {
|
|
213
|
+
batch.delete(key);
|
|
214
|
+
}
|
|
215
|
+
await batch.write();
|
|
216
|
+
// A short chunk means the walk reached the end of the keyspace.
|
|
217
|
+
if (keys.length < CLEAR_CHUNK_SIZE)
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/** At most {@link CLEAR_CHUNK_SIZE} keys, starting strictly past `after`. */
|
|
222
|
+
async readKeyChunk(after) {
|
|
223
|
+
const range = after === undefined
|
|
224
|
+
? { limit: CLEAR_CHUNK_SIZE }
|
|
225
|
+
: { gt: after, limit: CLEAR_CHUNK_SIZE };
|
|
226
|
+
const keys = [];
|
|
227
|
+
for await (const entry of this.iterate(range)) {
|
|
228
|
+
keys.push(entry.key);
|
|
229
|
+
}
|
|
230
|
+
return keys;
|
|
231
|
+
}
|
|
165
232
|
async close() {
|
|
166
233
|
if (!this.closed) {
|
|
167
234
|
this.closed = true;
|
|
168
235
|
this.db.close();
|
|
169
236
|
}
|
|
170
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* True once {@link close} has run. Lets the provider notice a handle a caller closed
|
|
240
|
+
* out-of-band (`StoreTableBase.releaseIndexStore` closes an index handle just before
|
|
241
|
+
* `dropIndex` asks the provider to delete that store) and re-open instead of handing
|
|
242
|
+
* back a dead one.
|
|
243
|
+
*/
|
|
244
|
+
isClosed() {
|
|
245
|
+
return this.closed;
|
|
246
|
+
}
|
|
171
247
|
async approximateCount(options) {
|
|
172
248
|
this.checkOpen();
|
|
173
249
|
// LevelDB doesn't have a native count, so we iterate and count
|
package/dist/src/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,qFAAqF;AACrF,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAoE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yFAAyF;AACzF,qFAAqF;AACrF,4CAA4C;AAC5C,OAAO,EAAE,YAAY,EAAE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2
2
|
"name": "@quereus/plugin-react-native-leveldb",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React Native LevelDB storage plugin for Quereus - mobile persistent storage",
|
|
6
6
|
"keywords": [
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@quereus/isolation": "^4.
|
|
45
|
-
"@quereus/quereus": "^4.
|
|
46
|
-
"@quereus/store": "^4.
|
|
44
|
+
"@quereus/isolation": "^4.12.1",
|
|
45
|
+
"@quereus/quereus": "^4.12.1",
|
|
46
|
+
"@quereus/store": "^4.12.1",
|
|
47
47
|
"rn-leveldb": "^3.11.0"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"test": "cd ../.. && node --import ./packages/quereus-plugin-react-native-leveldb/register.mjs node_modules/mocha/bin/mocha.js \"packages/quereus-plugin-react-native-leveldb/test/**/*.spec.ts\" --reporter min --colors"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@quereus/quereus": "^4.
|
|
91
|
-
"@quereus/store": "^4.
|
|
90
|
+
"@quereus/quereus": "^4.12.1",
|
|
91
|
+
"@quereus/store": "^4.12.1"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@quereus/isolation": "*",
|