@lossless.org/nosqldb 10.11.0 → 11.0.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.
- package/.smartconfig.json +117 -0
- package/dist_rust/rustdb_linux_amd64 +0 -0
- package/dist_rust/rustdb_linux_amd64.tsrust-build.json +5 -5
- package/dist_rust/rustdb_linux_amd64_musl +0 -0
- package/dist_rust/rustdb_linux_amd64_musl.tsrust-build.json +5 -5
- package/dist_rust/rustdb_linux_arm64 +0 -0
- package/dist_rust/rustdb_linux_arm64.tsrust-build.json +5 -5
- package/dist_rust/rustdb_linux_arm64_musl +0 -0
- package/dist_rust/rustdb_linux_arm64_musl.tsrust-build.json +5 -5
- package/dist_rust/rustdb_macos_amd64 +0 -0
- package/dist_rust/rustdb_macos_amd64.tsrust-build.json +5 -5
- package/dist_rust/rustdb_macos_arm64 +0 -0
- package/dist_rust/rustdb_macos_arm64.tsrust-build.json +5 -5
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/ts_local/classes.localnosqldb.d.ts +15 -4
- package/dist_ts/ts_local/classes.localnosqldb.js +31 -11
- package/dist_ts/ts_nosqldb/index.d.ts +3 -3
- package/dist_ts/ts_nosqldb/index.js +5 -4
- package/dist_ts/ts_nosqldb/rust-db-bridge.d.ts +125 -2
- package/dist_ts/ts_nosqldb/rust-db-bridge.js +261 -46
- package/dist_ts/ts_nosqldb/server/classes.nosqldbserver.d.ts +69 -3
- package/dist_ts/ts_nosqldb/server/classes.nosqldbserver.js +91 -12
- package/dist_ts/ts_nosqldb/server/index.d.ts +2 -2
- package/dist_ts/ts_nosqldb/server/index.js +2 -2
- package/dist_ts/ts_nosqldb/stopped-storage.d.ts +9 -1
- package/dist_ts/ts_nosqldb/stopped-storage.js +1 -1
- package/dist_ts/ts_nosqldb/storage-rehearsal.js +1 -1
- package/dist_ts/ts_nosqldb/storage-root-alignment.js +7 -3
- package/dist_ts/ts_nosqldb/storage-root-relocation.js +2 -2
- package/dist_ts_debugserver/bundled.js +6 -2
- package/package.json +28 -15
- package/readme.md +470 -730
- package/third-party-notices.md +40 -8
- package/third_party_licenses/inventory.json +6 -6
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/index.ts +85 -0
- package/ts/ts_local/classes.localnosqldb.ts +631 -0
- package/ts/ts_local/index.ts +19 -0
- package/ts/ts_local/plugins.ts +1 -0
- package/ts/ts_nosqldb/classes.storagerehearsal.ts +109 -0
- package/ts/ts_nosqldb/committed-writes.ts +38 -0
- package/ts/ts_nosqldb/file-storage-options.ts +33 -0
- package/ts/ts_nosqldb/file-storage-startup.ts +10 -0
- package/ts/ts_nosqldb/index.ts +132 -0
- package/ts/ts_nosqldb/offline-inspection.ts +375 -0
- package/ts/ts_nosqldb/plugins.ts +12 -0
- package/ts/ts_nosqldb/resource-fencing.ts +368 -0
- package/ts/ts_nosqldb/rust-db-bridge.ts +1309 -0
- package/ts/ts_nosqldb/server/classes.nosqldbserver.ts +874 -0
- package/ts/ts_nosqldb/server/index.ts +4 -0
- package/ts/ts_nosqldb/service-types.ts +499 -0
- package/ts/ts_nosqldb/stopped-storage.ts +116 -0
- package/ts/ts_nosqldb/storage-rehearsal.ts +215 -0
- package/ts/ts_nosqldb/storage-root-alignment.ts +180 -0
- package/ts/ts_nosqldb/storage-root-relocation.ts +279 -0
|
@@ -69,6 +69,48 @@ export interface IDocumentsResult {
|
|
|
69
69
|
documents: Record<string, any>[];
|
|
70
70
|
total: number;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Bounds of the engine standard-error tail that start failures, unexpected
|
|
74
|
+
* engine exits and failed management calls carry: the engine's last 64 lines.
|
|
75
|
+
* A longer line keeps its first 1,024 characters, followed by
|
|
76
|
+
* ` [<n> more characters]`.
|
|
77
|
+
*/
|
|
78
|
+
export declare const noSqlDbEngineStderrTailLimits: Readonly<{
|
|
79
|
+
lines: 64;
|
|
80
|
+
lineCharacters: 1024;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Attach the engine's last standard-error lines to an error as its own field
|
|
84
|
+
* `engineStderrTail`, leaving its message and cause unchanged. Values that
|
|
85
|
+
* cannot carry a field (primitives, frozen objects) are left as they are.
|
|
86
|
+
*/
|
|
87
|
+
export declare function attachNoSqlDbEngineStderrTail(errorArg: unknown, tailArg: readonly string[]): void;
|
|
88
|
+
/**
|
|
89
|
+
* The engine process exited with a non-zero status or by a signal while its
|
|
90
|
+
* server was running and no stop was in progress. `engineStderrTail` holds
|
|
91
|
+
* its last standard-error lines.
|
|
92
|
+
*/
|
|
93
|
+
export declare class NoSqlDbEngineExitError extends Error {
|
|
94
|
+
readonly exitCode: number | null;
|
|
95
|
+
readonly signal: string | null;
|
|
96
|
+
readonly engineStderrTail: readonly string[];
|
|
97
|
+
constructor(exitCode: number | null, signal: string | null, engineStderrTailArg: readonly string[]);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A start that the engine refused because the storage root, or a feature it
|
|
101
|
+
* carries, comes from a later NoSQLDB release than this one: the engine's
|
|
102
|
+
* management reply carried the code `UNKNOWN_ROOT`. The engine wrote nothing
|
|
103
|
+
* into the root (storage-root-names-and-start.md, "Roots of later releases";
|
|
104
|
+
* requirements A300 and A319). `code` holds the code, and `cause` the
|
|
105
|
+
* management error that carried it.
|
|
106
|
+
*/
|
|
107
|
+
export declare class NoSqlDbUnknownRootError extends Error {
|
|
108
|
+
readonly code: 'UNKNOWN_ROOT';
|
|
109
|
+
readonly responseErrorCode: 'UNKNOWN_ROOT';
|
|
110
|
+
constructor(options?: {
|
|
111
|
+
cause?: unknown;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
72
114
|
export declare class NoSqlDbManagementOperationTerminationError extends AggregateError {
|
|
73
115
|
constructor(operationErrorArg: unknown, terminationErrorArg: unknown);
|
|
74
116
|
}
|
|
@@ -131,6 +173,7 @@ interface INoSqlDbRustConfig {
|
|
|
131
173
|
storagePath?: string;
|
|
132
174
|
query?: INoSqlDbQueryOptions;
|
|
133
175
|
inbound?: INoSqlDbInboundOptions;
|
|
176
|
+
storageBudgetBytes?: number;
|
|
134
177
|
auth?: {
|
|
135
178
|
enabled?: boolean;
|
|
136
179
|
users?: Array<{
|
|
@@ -154,10 +197,30 @@ interface INoSqlDbRustConfig {
|
|
|
154
197
|
maxBytes?: number;
|
|
155
198
|
};
|
|
156
199
|
}
|
|
157
|
-
|
|
200
|
+
/**
|
|
201
|
+
* What a spawn() that returned false after `waitedMs` means, stating only what
|
|
202
|
+
* is known. Smartrust refuses a `binaryPath` that does not pass its validation
|
|
203
|
+
* before spawn() can return false, so with one the engine there passed
|
|
204
|
+
* Smartrust's validation and did not report ready within the bridge's limit,
|
|
205
|
+
* and its path is given as the caller gave it.
|
|
206
|
+
* Without one, whatever NOSQLDB_RUST_BINARY holds (one of the places that
|
|
207
|
+
* Smartrust's search looks), either the search found no engine or the engine
|
|
208
|
+
* it found did not report ready, and nothing tells which.
|
|
209
|
+
*/
|
|
210
|
+
export declare function describeRefusedSpawn(binaryPath: string | undefined, waitedMs: number): string;
|
|
158
211
|
export interface IRustDbBridgeOptions {
|
|
159
212
|
/** Exact engine executable, validated by Smartrust without discovery fallback or permission changes. */
|
|
160
213
|
binaryPath?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Receives every line the engine writes to its standard error, in order and
|
|
216
|
+
* without its line break. Without it, no engine line reaches the host
|
|
217
|
+
* process's standard error. Either way the bridge keeps the last lines for
|
|
218
|
+
* errors (`noSqlDbEngineStderrTailLimits`). Each call runs in its own
|
|
219
|
+
* microtask after the bridge has recorded the line, so an exception it
|
|
220
|
+
* throws cannot disturb the bridge; it is not caught and reaches the process
|
|
221
|
+
* as an uncaught exception.
|
|
222
|
+
*/
|
|
223
|
+
engineLog?: (line: string) => void;
|
|
161
224
|
}
|
|
162
225
|
/**
|
|
163
226
|
* Bridge between TypeScript NoSqlDbServer and the Rust binary.
|
|
@@ -171,13 +234,73 @@ export declare class RustDbBridge extends EventEmitter {
|
|
|
171
234
|
* termination, or when the bridge is connected to an external process.
|
|
172
235
|
*/
|
|
173
236
|
get processId(): number | undefined;
|
|
237
|
+
/** The engine child process of the latest spawn, while the bridge holds it. */
|
|
238
|
+
private get childProcess();
|
|
239
|
+
/** How the engine process of the latest spawn exited, once it has. */
|
|
240
|
+
private engineExit;
|
|
241
|
+
private engineExitPromise;
|
|
242
|
+
/** Records the exit of the engine process that a spawn has just started. */
|
|
243
|
+
private watchEngineExit;
|
|
244
|
+
/**
|
|
245
|
+
* The exit code and signal of the engine process of the latest spawn, as its
|
|
246
|
+
* process exit reported them, each null where it reported none; or null
|
|
247
|
+
* while that process has not exited, or no spawn started one.
|
|
248
|
+
*/
|
|
249
|
+
get lastEngineExit(): {
|
|
250
|
+
code: number | null;
|
|
251
|
+
signal: string | null;
|
|
252
|
+
} | null;
|
|
253
|
+
/** Whether the engine process of the latest spawn exists and has not exited. */
|
|
254
|
+
get engineProcessAlive(): boolean;
|
|
255
|
+
/** Waits up to `timeoutMs` for the engine process to exit by itself; resolves whether it has. */
|
|
256
|
+
waitForEngineExit(timeoutMs: number): Promise<boolean>;
|
|
257
|
+
/**
|
|
258
|
+
* Closes the engine's management input, the end of the management protocol
|
|
259
|
+
* after an acknowledged `stop`, on which the engine exits by itself. This is
|
|
260
|
+
* neither a signal nor a kill. Returns whether there was an input to close.
|
|
261
|
+
*/
|
|
262
|
+
endManagementInput(): boolean;
|
|
174
263
|
private terminationConfirmed;
|
|
175
264
|
private terminationPromise;
|
|
176
265
|
private terminationFailure;
|
|
266
|
+
private readonly stderrTail;
|
|
267
|
+
/** The `binaryPath` this bridge was given, if any, as given: the bridge's only configured path. */
|
|
268
|
+
private readonly binaryPath;
|
|
269
|
+
private spawnRefusal;
|
|
270
|
+
/**
|
|
271
|
+
* Why Smartrust's spawn() returned false, as far as the bridge knows. Each
|
|
272
|
+
* spawn() clears it as it starts, and sets it when Smartrust's spawn()
|
|
273
|
+
* returns false before this spawn()'s own `timeoutMs` or `signal` cuts it
|
|
274
|
+
* short, before the engine is ended. That spawn() then returns false, or
|
|
275
|
+
* throws if ending the engine fails. After any other spawn() it is
|
|
276
|
+
* undefined, including one cut short by its own `timeoutMs` or `signal`.
|
|
277
|
+
* Smartrust's spawn() returns false both when it finds no engine and when
|
|
278
|
+
* the engine it starts does not report ready within its limit; a
|
|
279
|
+
* `binaryPath` tells the two apart, as Smartrust refuses one that does not
|
|
280
|
+
* pass its validation with RustBinaryLocatorError before spawn() can return
|
|
281
|
+
* false.
|
|
282
|
+
*/
|
|
283
|
+
get spawnFailureMessage(): string | undefined;
|
|
177
284
|
constructor(options?: IRustDbBridgeOptions);
|
|
285
|
+
/**
|
|
286
|
+
* The last standard-error lines of the running or most recently spawned
|
|
287
|
+
* engine process, within `noSqlDbEngineStderrTailLimits`.
|
|
288
|
+
*/
|
|
289
|
+
get engineStderrTail(): string[];
|
|
290
|
+
/**
|
|
291
|
+
* Send one management command. A failure while no engine runs (it exited
|
|
292
|
+
* or never started) carries the engine's last standard-error lines.
|
|
293
|
+
*/
|
|
294
|
+
private send;
|
|
178
295
|
/**
|
|
179
296
|
* Spawn the Rust binary in management mode.
|
|
180
|
-
* Returns true
|
|
297
|
+
* Returns true once the engine reported ready. Returns false when
|
|
298
|
+
* Smartrust's spawn() returned false: no engine was found, or the one found
|
|
299
|
+
* did not report ready within the bridge's limit. spawnFailureMessage then
|
|
300
|
+
* says what that means, as far as the bridge knows, and still says it if
|
|
301
|
+
* ending that engine fails and this throws instead. After any other
|
|
302
|
+
* outcome, including a throw on this spawn()'s own `timeoutMs` or `signal`,
|
|
303
|
+
* spawnFailureMessage is undefined.
|
|
181
304
|
*/
|
|
182
305
|
spawn(optionsArg?: INoSqlDbManagementOperationOptions): Promise<boolean>;
|
|
183
306
|
/**
|