keri-ts 2.0.0 → 2.1.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/esm/keri/npm/src/acdc/chaining.js +223 -89
- package/esm/keri/npm/src/acdc/observing.js +2 -2
- package/esm/keri/npm/src/acdc/regbasing.js +20 -29
- package/esm/keri/npm/src/acdc/regengine.js +4 -6
- package/esm/keri/npm/src/acdc/registering.js +13 -10
- package/esm/keri/npm/src/acdc/registraring.js +4 -9
- package/esm/keri/npm/src/acdc/salting.js +127 -25
- package/esm/keri/npm/src/acdc/unblinding.js +2 -4
- package/esm/keri/npm/src/app/bootstrap/oobiery.js +1 -1
- package/esm/keri/npm/src/app/credentials/root-replicating.js +123 -0
- package/esm/keri/npm/src/app/credentials/verifying.js +21 -3
- package/esm/keri/npm/src/app/delivery/forwarding.js +49 -7
- package/esm/keri/npm/src/app/exchanges/exchanging.js +11 -12
- package/esm/keri/npm/src/app/identity/configing.js +17 -43
- package/esm/keri/npm/src/app/identity/habbing.js +54 -35
- package/esm/keri/npm/src/app/identity/keeping.js +1 -1
- package/esm/keri/npm/src/app/identity/lmdb-habery.js +12 -0
- package/esm/keri/npm/src/app/ipex/ipex-graph.js +7 -70
- package/esm/keri/npm/src/app/ipex/ipex-grouping.js +8 -5
- package/esm/keri/npm/src/app/ipex/ipex-v2.js +21 -5
- package/esm/keri/npm/src/app/ipex/ipexing.js +1 -1
- package/esm/keri/npm/src/app/mailbox/mailboxing.js +5 -9
- package/esm/keri/npm/src/app/multisig/group-members.js +14 -0
- package/esm/keri/npm/src/app/multisig/grouping.js +4 -3
- package/esm/keri/npm/src/app/multisig/multisig-workflows.js +7 -2
- package/esm/keri/npm/src/app/notifications/notifying.js +5 -9
- package/esm/keri/npm/src/app/protocol/protocol-processing.js +35 -3
- package/esm/keri/npm/src/app/queries/witness-inquisitor.js +2 -2
- package/esm/keri/npm/src/app/runtime/agent-runtime.js +7 -10
- package/esm/keri/npm/src/app/transport/byte-source.js +6 -42
- package/esm/keri/npm/src/app/transport/cesr-egress.js +77 -13
- package/esm/keri/npm/src/app/transport/file-bytes.js +41 -0
- package/esm/keri/npm/src/app/transport/http-messenger.js +14 -9
- package/esm/keri/npm/src/app/transport/message-source.js +1 -1
- package/esm/keri/npm/src/app/transport/messengering.js +3 -4
- package/esm/keri/npm/src/app/transport/node-http-client.js +21 -0
- package/esm/keri/npm/src/app/transport/tcp-dialer.js +14 -0
- package/esm/keri/npm/src/app/witness/receipt-client.js +2 -2
- package/esm/keri/npm/src/cli/common/context.js +2 -2
- package/esm/keri/npm/src/cli/common/existing.js +3 -5
- package/esm/keri/npm/src/cli/credentials/ipex.js +2 -1
- package/esm/keri/npm/src/cli/endpoints/oobi-clean.js +4 -3
- package/esm/keri/npm/src/cli/endpoints/oobi.js +2 -2
- package/esm/keri/npm/src/cli/identity/challenge.js +2 -2
- package/esm/keri/npm/src/cli/identity/incept.js +2 -2
- package/esm/keri/npm/src/cli/identity/init.js +4 -3
- package/esm/keri/npm/src/cli/identity/interact.js +2 -2
- package/esm/keri/npm/src/cli/identity/rotate.js +2 -2
- package/esm/keri/npm/src/cli/messaging/exchange.js +2 -2
- package/esm/keri/npm/src/cli/messaging/multisig.js +61 -3
- package/esm/keri/npm/src/cli/tools/annotate.js +2 -1
- package/esm/keri/npm/src/cli/tools/benchmark.js +2 -1
- package/esm/keri/npm/src/cli/tools/db-dump.js +1 -4
- package/esm/keri/npm/src/core/bytes.js +9 -0
- package/esm/keri/npm/src/core/kel/delegation-ancestry.js +92 -0
- package/esm/keri/npm/src/core/kel/eventing.js +1 -2
- package/esm/keri/npm/src/core/kel/kever.js +11 -9
- package/esm/keri/npm/src/core/mailbox/kram-policy.js +2 -3
- package/esm/keri/npm/src/core/mailbox/kram-pruning.js +15 -22
- package/esm/keri/npm/src/core/mailbox/kram-staging.js +2 -2
- package/esm/keri/npm/src/core/routing.js +2 -2
- package/esm/keri/npm/src/db/basing.js +149 -203
- package/esm/keri/npm/src/db/core/dber.js +1062 -0
- package/esm/keri/npm/src/db/core/index.js +4 -2
- package/esm/keri/npm/src/db/core/lmdb-opener.js +30 -0
- package/esm/keri/npm/src/db/core/lmdber.js +199 -1067
- package/esm/keri/npm/src/db/core/memstore.js +532 -0
- package/esm/keri/npm/src/db/core/path-manager.js +109 -223
- package/esm/keri/npm/src/db/core/store-owner.js +104 -0
- package/esm/keri/npm/src/db/core/webdber.js +252 -0
- package/esm/keri/npm/src/db/escrowing.js +2 -2
- package/esm/keri/npm/src/db/exchange/exchange-nests.js +3 -2
- package/esm/keri/npm/src/db/keeping.js +27 -121
- package/esm/keri/npm/src/db/koming.js +1 -1
- package/esm/keri/npm/src/db/lmdb-stores.js +68 -0
- package/esm/keri/npm/src/db/lmdb.js +6 -0
- package/esm/keri/npm/src/db/mailbox/mailboxing.js +12 -65
- package/esm/keri/npm/src/db/noting.js +11 -55
- package/esm/keri/npm/src/db/reger.js +43 -105
- package/esm/keri/npm/src/db/replay/witness-replay.js +2 -20
- package/esm/keri/npm/src/db/subing.js +1 -1
- package/esm/keri/npm/src/npm/db-lmdb.js +3 -0
- package/esm/keri/npm/src/npm/runtime-node.js +3 -0
- package/esm/keri/npm/src/runtime/index.js +9 -10
- package/esm/keri/npm/src/runtime/node.js +14 -0
- package/esm/keri/npm/src/vdr/eventing.js +1 -1
- package/esm/keri/npm/src/vdr/tel-publication.js +3 -3
- package/esm/keri/npm/src/version.js +2 -2
- package/package.json +11 -4
- package/types/acdc/chaining.d.ts +56 -6
- package/types/acdc/chaining.d.ts.map +1 -1
- package/types/acdc/regbasing.d.ts +7 -6
- package/types/acdc/regbasing.d.ts.map +1 -1
- package/types/acdc/regengine.d.ts.map +1 -1
- package/types/acdc/registering.d.ts +8 -4
- package/types/acdc/registering.d.ts.map +1 -1
- package/types/acdc/registraring.d.ts.map +1 -1
- package/types/acdc/salting.d.ts +53 -6
- package/types/acdc/salting.d.ts.map +1 -1
- package/types/acdc/unblinding.d.ts.map +1 -1
- package/types/app/credentials/root-replicating.d.ts +85 -0
- package/types/app/credentials/root-replicating.d.ts.map +1 -0
- package/types/app/credentials/verifying.d.ts +2 -1
- package/types/app/credentials/verifying.d.ts.map +1 -1
- package/types/app/delivery/forwarding.d.ts +10 -0
- package/types/app/delivery/forwarding.d.ts.map +1 -1
- package/types/app/exchanges/exchanging.d.ts +2 -0
- package/types/app/exchanges/exchanging.d.ts.map +1 -1
- package/types/app/identity/configing.d.ts +7 -5
- package/types/app/identity/configing.d.ts.map +1 -1
- package/types/app/identity/habbing.d.ts +23 -5
- package/types/app/identity/habbing.d.ts.map +1 -1
- package/types/app/identity/keeping.d.ts +1 -1
- package/types/app/identity/lmdb-habery.d.ts +6 -0
- package/types/app/identity/lmdb-habery.d.ts.map +1 -0
- package/types/app/ipex/ipex-graph.d.ts +4 -4
- package/types/app/ipex/ipex-graph.d.ts.map +1 -1
- package/types/app/ipex/ipex-grouping.d.ts.map +1 -1
- package/types/app/ipex/ipex-v2.d.ts +11 -2
- package/types/app/ipex/ipex-v2.d.ts.map +1 -1
- package/types/app/ipex/ipexing.d.ts +3 -0
- package/types/app/ipex/ipexing.d.ts.map +1 -1
- package/types/app/mailbox/mailboxing.d.ts +1 -1
- package/types/app/mailbox/mailboxing.d.ts.map +1 -1
- package/types/app/multisig/group-members.d.ts +9 -0
- package/types/app/multisig/group-members.d.ts.map +1 -1
- package/types/app/multisig/grouping.d.ts.map +1 -1
- package/types/app/multisig/multisig-workflows.d.ts +2 -1
- package/types/app/multisig/multisig-workflows.d.ts.map +1 -1
- package/types/app/notifications/notifying.d.ts +1 -1
- package/types/app/notifications/notifying.d.ts.map +1 -1
- package/types/app/protocol/parsering.d.ts +3 -1
- package/types/app/protocol/parsering.d.ts.map +1 -1
- package/types/app/protocol/protocol-processing.d.ts +2 -0
- package/types/app/protocol/protocol-processing.d.ts.map +1 -1
- package/types/app/runtime/agent-runtime.d.ts +7 -0
- package/types/app/runtime/agent-runtime.d.ts.map +1 -1
- package/types/app/transport/byte-source.d.ts +13 -10
- package/types/app/transport/byte-source.d.ts.map +1 -1
- package/types/app/transport/cesr-egress.d.ts +21 -7
- package/types/app/transport/cesr-egress.d.ts.map +1 -1
- package/types/app/transport/file-bytes.d.ts +11 -0
- package/types/app/transport/file-bytes.d.ts.map +1 -0
- package/types/app/transport/http-client.d.ts +3 -0
- package/types/app/transport/http-client.d.ts.map +1 -1
- package/types/app/transport/http-messenger.d.ts +15 -10
- package/types/app/transport/http-messenger.d.ts.map +1 -1
- package/types/app/transport/message-source.d.ts +1 -1
- package/types/app/transport/messengering.d.ts +2 -2
- package/types/app/transport/messengering.d.ts.map +1 -1
- package/types/app/transport/node-http-client.d.ts +10 -0
- package/types/app/transport/node-http-client.d.ts.map +1 -0
- package/types/app/transport/tcp-dialer.d.ts +21 -0
- package/types/app/transport/tcp-dialer.d.ts.map +1 -0
- package/types/cli/common/existing.d.ts.map +1 -1
- package/types/cli/credentials/ipex.d.ts.map +1 -1
- package/types/cli/endpoints/oobi-clean.d.ts.map +1 -1
- package/types/cli/identity/init.d.ts.map +1 -1
- package/types/cli/index.d.ts +1 -1
- package/types/cli/index.d.ts.map +1 -1
- package/types/cli/messaging/multisig.d.ts +10 -1
- package/types/cli/messaging/multisig.d.ts.map +1 -1
- package/types/cli/tools/annotate.d.ts.map +1 -1
- package/types/cli/tools/benchmark.d.ts.map +1 -1
- package/types/cli/tools/db-dump.d.ts.map +1 -1
- package/types/core/bytes.d.ts +2 -0
- package/types/core/bytes.d.ts.map +1 -1
- package/types/core/kel/delegation-ancestry.d.ts +41 -0
- package/types/core/kel/delegation-ancestry.d.ts.map +1 -0
- package/types/core/kel/eventing.d.ts.map +1 -1
- package/types/core/kel/kever.d.ts +5 -4
- package/types/core/kel/kever.d.ts.map +1 -1
- package/types/core/mailbox/kram-policy.d.ts.map +1 -1
- package/types/core/mailbox/kram-pruning.d.ts +1 -3
- package/types/core/mailbox/kram-pruning.d.ts.map +1 -1
- package/types/db/basing.d.ts +14 -23
- package/types/db/basing.d.ts.map +1 -1
- package/types/db/core/dber.d.ts +505 -0
- package/types/db/core/dber.d.ts.map +1 -0
- package/types/db/core/index.d.ts +4 -2
- package/types/db/core/index.d.ts.map +1 -1
- package/types/db/core/lmdb-opener.d.ts +17 -0
- package/types/db/core/lmdb-opener.d.ts.map +1 -0
- package/types/db/core/lmdber.d.ts +60 -383
- package/types/db/core/lmdber.d.ts.map +1 -1
- package/types/db/core/memstore.d.ts +129 -0
- package/types/db/core/memstore.d.ts.map +1 -0
- package/types/db/core/path-manager.d.ts +22 -45
- package/types/db/core/path-manager.d.ts.map +1 -1
- package/types/db/core/store-owner.d.ts +59 -0
- package/types/db/core/store-owner.d.ts.map +1 -0
- package/types/db/core/webdber.d.ts +127 -0
- package/types/db/core/webdber.d.ts.map +1 -0
- package/types/db/escrowing.d.ts +3 -3
- package/types/db/escrowing.d.ts.map +1 -1
- package/types/db/exchange/exchange-nests.d.ts.map +1 -1
- package/types/db/keeping.d.ts +9 -23
- package/types/db/keeping.d.ts.map +1 -1
- package/types/db/koming.d.ts +7 -8
- package/types/db/koming.d.ts.map +1 -1
- package/types/db/lmdb-stores.d.ts +45 -0
- package/types/db/lmdb-stores.d.ts.map +1 -0
- package/types/db/lmdb.d.ts +7 -0
- package/types/db/lmdb.d.ts.map +1 -0
- package/types/db/mailbox/mailboxing.d.ts +7 -21
- package/types/db/mailbox/mailboxing.d.ts.map +1 -1
- package/types/db/noting.d.ts +7 -12
- package/types/db/noting.d.ts.map +1 -1
- package/types/db/reger.d.ts +7 -11
- package/types/db/reger.d.ts.map +1 -1
- package/types/db/replay/witness-replay.d.ts +0 -2
- package/types/db/replay/witness-replay.d.ts.map +1 -1
- package/types/db/subing.d.ts +24 -25
- package/types/db/subing.d.ts.map +1 -1
- package/types/npm/db-lmdb.d.ts +4 -0
- package/types/npm/db-lmdb.d.ts.map +1 -0
- package/types/npm/runtime-node.d.ts +4 -0
- package/types/npm/runtime-node.d.ts.map +1 -0
- package/types/runtime/index.d.ts +9 -10
- package/types/runtime/index.d.ts.map +1 -1
- package/types/runtime/node.d.ts +15 -0
- package/types/runtime/node.d.ts.map +1 -0
- package/types/version.d.ts +2 -2
- package/esm/keri/npm/src/acdc/relating.js +0 -59
- package/esm/keri/npm/src/db/baser-defaults.js +0 -11
- package/types/acdc/relating.d.ts +0 -21
- package/types/acdc/relating.d.ts.map +0 -1
- package/types/db/baser-defaults.d.ts +0 -5
- package/types/db/baser-defaults.d.ts.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory `DBer` backend: one bytewise-sorted row array per table.
|
|
3
|
+
*
|
|
4
|
+
* ADR-0015 owns the semantics and `LMDBer` is the reference where the ADR is
|
|
5
|
+
* silent. Nothing here may reach `lmdb`, `node:` or the `Deno` global.
|
|
6
|
+
*
|
|
7
|
+
* Invariants:
|
|
8
|
+
* - each table's `rows` stay sorted by key, then by value on a dupsort table;
|
|
9
|
+
* - stored rows are immutable and every byte array entering or leaving is a
|
|
10
|
+
* fresh copy, so callers can neither reach nor alias store state;
|
|
11
|
+
* - every mutation runs inside `transaction` and logs its exact inverse.
|
|
12
|
+
*/
|
|
13
|
+
import type { Operation } from "effection";
|
|
14
|
+
import { BaseDBer, type ScanOptions, type StoreIdentity, type Table, type TableEntry } from "./dber.js";
|
|
15
|
+
import type { StoreFamily, StoreOpener } from "./store-owner.js";
|
|
16
|
+
/**
|
|
17
|
+
* One row or version write of a committed transaction, in order, for a backend
|
|
18
|
+
* that must persist what the commit changed. Byte arrays are the immutable
|
|
19
|
+
* stored ones, so a recipient keeping them past the call copies them first.
|
|
20
|
+
*/
|
|
21
|
+
export type StoreChange = {
|
|
22
|
+
readonly kind: "version";
|
|
23
|
+
readonly before: string | null;
|
|
24
|
+
readonly after: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "row";
|
|
27
|
+
readonly table: string;
|
|
28
|
+
readonly dupsort: boolean;
|
|
29
|
+
readonly key: Uint8Array;
|
|
30
|
+
/** The value before and after this write; `null` means the row is absent. */
|
|
31
|
+
readonly before: Uint8Array | null;
|
|
32
|
+
readonly after: Uint8Array | null;
|
|
33
|
+
};
|
|
34
|
+
/** A persisted table handed to `loadContents`. */
|
|
35
|
+
export interface LoadedTable {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly dupsort: boolean;
|
|
38
|
+
readonly rows: readonly TableEntry[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sorted in-memory store with real commit and rollback.
|
|
42
|
+
*
|
|
43
|
+
* Contents belong to the instance. They survive `close` and `reopen` until
|
|
44
|
+
* `close(true)` or `reopen({ clear: true })`, including on a `temp` store,
|
|
45
|
+
* which is what `LMDBer` does with its reused temp path. Each reopen rebinds
|
|
46
|
+
* table handles, so a handle from before it is refused.
|
|
47
|
+
*
|
|
48
|
+
* Scans hold a position, not an index: each step re-seeks past the last row
|
|
49
|
+
* yielded, so a concurrent insert, delete or rollback cannot skip or repeat an
|
|
50
|
+
* untouched row. A scan inside a writer sees that writer's rows as they change.
|
|
51
|
+
*/
|
|
52
|
+
export declare class MemStore extends BaseDBer {
|
|
53
|
+
#private;
|
|
54
|
+
readonly: boolean;
|
|
55
|
+
constructor(options?: StoreIdentity);
|
|
56
|
+
get name(): string;
|
|
57
|
+
get base(): string;
|
|
58
|
+
get opened(): boolean;
|
|
59
|
+
get temp(): boolean;
|
|
60
|
+
get inWriteTransaction(): boolean;
|
|
61
|
+
/** Counts commits that wrote rows; it keeps counting across reopen of one instance. */
|
|
62
|
+
get writeVersion(): number;
|
|
63
|
+
/** Open or reopen the contents. A readonly open of never-created contents reports `false`. */
|
|
64
|
+
reopen(options?: StoreIdentity): Operation<boolean>;
|
|
65
|
+
/** Close the store, deleting its contents when `clear` is set. Repeating is harmless. */
|
|
66
|
+
close(clear?: boolean): Operation<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Bind a table, creating it on a writable store. The flag from creation wins
|
|
69
|
+
* over a later differing request. An absent table on a readonly store yields
|
|
70
|
+
* no handle, as `LMDBer` does, so optional bindings can probe `hasTable`.
|
|
71
|
+
*/
|
|
72
|
+
openTable(name: string, options?: {
|
|
73
|
+
dupsort?: boolean;
|
|
74
|
+
}): Table;
|
|
75
|
+
hasTable(name: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Run `fn` atomically. Only the outermost commit publishes; a nested
|
|
78
|
+
* transaction is a savepoint, and any throw restores the state at its start.
|
|
79
|
+
* A thenable result is a caller-contract error, rolled back like a throw.
|
|
80
|
+
*/
|
|
81
|
+
transaction<T>(fn: () => T): T;
|
|
82
|
+
/** Told each outermost commit that wrote rows, in order. Nothing rolled back ever reaches it. */
|
|
83
|
+
protected committed(_changes: readonly StoreChange[]): void;
|
|
84
|
+
/**
|
|
85
|
+
* Replace the contents with a persisted snapshot, for a backend that loads
|
|
86
|
+
* before `reopen`. Rows are copied and sorted here, so a backend's own order
|
|
87
|
+
* cannot break the sorted-row invariant; a repeated row identity is corrupt.
|
|
88
|
+
*/
|
|
89
|
+
protected loadContents(tables: readonly LoadedTable[], version: string | null): void;
|
|
90
|
+
flushed(): Operation<void>;
|
|
91
|
+
/** This backend retains no read view, so an open store has nothing to discard. */
|
|
92
|
+
refreshRead(): void;
|
|
93
|
+
getVer(): string | null;
|
|
94
|
+
setVer(val: string): void;
|
|
95
|
+
scan(table: Table, options?: ScanOptions): Generator<TableEntry>;
|
|
96
|
+
scanKeys(table: Table, options?: ScanOptions): Generator<Uint8Array>;
|
|
97
|
+
protected assertOpen(): void;
|
|
98
|
+
protected putRow(table: Table, key: Uint8Array, val: Uint8Array): void;
|
|
99
|
+
/** On a dupsort table `val` selects one duplicate; a plain table ignores it, as LMDB does. */
|
|
100
|
+
protected removeRow(table: Table, key: Uint8Array, val?: Uint8Array): boolean;
|
|
101
|
+
/** Insert only when `key` is absent; on a dupsort table any existing duplicate counts. */
|
|
102
|
+
putVal(table: Table, key: Uint8Array, val: Uint8Array): boolean;
|
|
103
|
+
/** Overwrite a plain key's value; on a dupsort table this adds a duplicate. */
|
|
104
|
+
setVal(table: Table, key: Uint8Array, val: Uint8Array): boolean;
|
|
105
|
+
getVal(table: Table, key: Uint8Array): Uint8Array | null;
|
|
106
|
+
delVal(table: Table, key: Uint8Array, val?: Uint8Array): boolean;
|
|
107
|
+
cnt(table: Table): number;
|
|
108
|
+
cntAll(table: Table): number;
|
|
109
|
+
cntTop(table: Table, top?: Uint8Array): number;
|
|
110
|
+
delTop(table: Table, top?: Uint8Array): boolean;
|
|
111
|
+
getTopItemIter(table: Table, top?: Uint8Array): Generator<[Uint8Array, Uint8Array]>;
|
|
112
|
+
/** Add each value not already present; reports `false` if any supplied value existed. */
|
|
113
|
+
putVals(table: Table, key: Uint8Array, vals: Iterable<Uint8Array>): boolean;
|
|
114
|
+
addVal(table: Table, key: Uint8Array, val: Uint8Array): boolean;
|
|
115
|
+
/** Duplicate reads treat an empty or over-long key as simply absent, as `LMDBer` does. */
|
|
116
|
+
getVals(table: Table, key: Uint8Array): Uint8Array[];
|
|
117
|
+
getValLast(table: Table, key: Uint8Array): Uint8Array | null;
|
|
118
|
+
getValsIter(table: Table, key: Uint8Array): Generator<Uint8Array>;
|
|
119
|
+
/** Count duplicates. Like LMDB, a plain table holding `key` refuses this dupsort-only call. */
|
|
120
|
+
cntVals(table: Table, key: Uint8Array): number;
|
|
121
|
+
delVals(table: Table, key: Uint8Array): boolean;
|
|
122
|
+
/** First duplicate at `key` not below `start`; `start` is an unvalidated scan-style bound. */
|
|
123
|
+
seekVal(table: Table, key: Uint8Array, start?: Uint8Array): Uint8Array | null;
|
|
124
|
+
}
|
|
125
|
+
/** A `StoreOpener` of closed, independent in-memory stores. Place is meaningless here. */
|
|
126
|
+
export declare class MemStoreOpener implements StoreOpener {
|
|
127
|
+
create(_family: StoreFamily, identity: StoreIdentity): MemStore;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=memstore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,EAAE;IAMpD,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAI3D,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAIlE,+FAA+F;IAC/F,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM;IAQ9C,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO;IAI/C,8FAA8F;IAC9F,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;CAW9E;AAED,0FAA0F;AAC1F,qBAAa,cAAe,YAAW,WAAW;IAChD,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,QAAQ;CAGhE"}
|
|
@@ -47,7 +47,6 @@ export interface PathManagerDefaults {
|
|
|
47
47
|
altCleanTailDirPath: string;
|
|
48
48
|
tempPrefix: string;
|
|
49
49
|
tempSuffix: string;
|
|
50
|
-
tempHeadDir: string;
|
|
51
50
|
perm: number;
|
|
52
51
|
mode: string;
|
|
53
52
|
fext: string;
|
|
@@ -65,10 +64,11 @@ export declare const PATH_DEFAULTS: PathManagerDefaults;
|
|
|
65
64
|
* - centralize path naming constraints so higher-level DB/config wrappers do
|
|
66
65
|
* not each reimplement filesystem policy
|
|
67
66
|
*
|
|
68
|
-
* Current `keri-ts`
|
|
69
|
-
* -
|
|
70
|
-
*
|
|
71
|
-
*
|
|
67
|
+
* Current `keri-ts` differences from hio `Filer`, which it otherwise follows:
|
|
68
|
+
* - composition rather than inheritance, so stores own one instance
|
|
69
|
+
* - a temp store uses one stable directory per name instead of a fresh
|
|
70
|
+
* `mkdtemp` per open, so its data survives a close and reopen; temp stores are
|
|
71
|
+
* never shared with KERIpy
|
|
72
72
|
*/
|
|
73
73
|
export declare class PathManager {
|
|
74
74
|
headDirPath: string;
|
|
@@ -84,68 +84,45 @@ export declare class PathManager {
|
|
|
84
84
|
opened: boolean;
|
|
85
85
|
private defaults;
|
|
86
86
|
private readonly logger;
|
|
87
|
+
private tempRoot;
|
|
87
88
|
constructor(options?: PathManagerOptions, defaults?: Partial<PathManagerDefaults>);
|
|
88
89
|
get name(): string;
|
|
89
90
|
set name(value: string);
|
|
90
|
-
_getTempPath(): string;
|
|
91
91
|
/** Resolve user home directory with a Windows-aware fallback chain. */
|
|
92
92
|
_resolveHomeDir(): string;
|
|
93
93
|
_pathExpandTilde(path: string): string;
|
|
94
|
-
_getPrimaryPath(headDirPath: string, clean: boolean): string;
|
|
95
|
-
_getAltPath(clean: boolean): string;
|
|
96
|
-
_getPersistentPaths(options?: Partial<PathManagerOptions>): [string, string];
|
|
97
|
-
_getPaths(options?: Partial<PathManagerOptions>): [string, string, string];
|
|
98
94
|
/**
|
|
99
95
|
* Helper: Convert Promise-based file system operations to Effection operations
|
|
100
96
|
* This ensures proper structured concurrency and cancellation support
|
|
101
97
|
*/
|
|
98
|
+
/** True when `path` exists; any failure to stat means absent, like `os.path.exists`. */
|
|
102
99
|
statOp(path: string): Operation<boolean>;
|
|
103
|
-
|
|
104
|
-
mkdirOp(path: string
|
|
100
|
+
/** Create a directory and its parents with default permissions, like `os.makedirs`. */
|
|
101
|
+
mkdirOp(path: string): Operation<void>;
|
|
105
102
|
rmOp(path: string): Operation<void>;
|
|
106
103
|
statFileOp(path: string): Operation<{
|
|
107
104
|
isDirectory: boolean;
|
|
108
105
|
isFile: boolean;
|
|
109
106
|
}>;
|
|
110
107
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* - Tries primary path (/usr/local/var/keri/*) first
|
|
114
|
-
* - Falls back to alt path (~/.tufa/*) on OS errors or access issues
|
|
115
|
-
*
|
|
116
|
-
* Returns Effection Operation with true if path is created and accessible, false otherwise.
|
|
108
|
+
* Close, then open the path, mirroring hio `Filer.reopen`. An existing path
|
|
109
|
+
* is kept only when `reuse` is set; otherwise the path is made again.
|
|
117
110
|
*/
|
|
118
111
|
reopen(options?: Partial<PathManagerOptions>): Operation<boolean>;
|
|
119
|
-
/** Update instance fields from caller-provided options. */
|
|
120
|
-
private _applyOptions;
|
|
121
112
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
113
|
+
* Choose and create the path, mirroring hio `Filer.remake`. `headDirPath` is
|
|
114
|
+
* left alone on fallback, so each open retries the primary location first.
|
|
124
115
|
*/
|
|
125
|
-
private
|
|
116
|
+
private remake;
|
|
117
|
+
/** Name the path uses, with `fext` added to an extensionless file name. */
|
|
118
|
+
private fileName;
|
|
119
|
+
/** Create a directory path, or a file path's parents and the file when `filed`. */
|
|
120
|
+
private makePath;
|
|
121
|
+
/** Make the home-directory alternate, failing when it is unavailable too. */
|
|
122
|
+
private makeAltPath;
|
|
126
123
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*/
|
|
130
|
-
private _createOrFallback;
|
|
131
|
-
/**
|
|
132
|
-
* Verify the primary path exists and is accessible for reuse.
|
|
133
|
-
* If not accessible and using the default head dir, fall back to alt.
|
|
134
|
-
*/
|
|
135
|
-
private _reuseOrFallback;
|
|
136
|
-
/**
|
|
137
|
-
* Ensure a path exists and is accessible, creating it if necessary.
|
|
138
|
-
* Returns true if the path is ready for use.
|
|
139
|
-
*/
|
|
140
|
-
private _ensurePathAccessible;
|
|
141
|
-
/** Remove existing file or directory at path. */
|
|
142
|
-
private _clearPath;
|
|
143
|
-
/** Ensure the directory at path exists and is accessible, creating it if needed. */
|
|
144
|
-
private _ensureDirectoryExists;
|
|
145
|
-
/**
|
|
146
|
-
* Close the path manager
|
|
147
|
-
* If clear is true, removes the directory/file
|
|
148
|
-
* Uses Effection for structured concurrency
|
|
124
|
+
* Mark closed, removing the path when `clear` is set. The path is retained so
|
|
125
|
+
* a later `reopen({ reuse: true })` finds it, as hio does.
|
|
149
126
|
*/
|
|
150
127
|
close(clear?: boolean): Operation<boolean>;
|
|
151
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-manager.d.ts","sourceRoot":"","sources":["../../../src/db/core/path-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path-manager.d.ts","sourceRoot":"","sources":["../../../src/db/core/path-manager.ts"],"names":[],"mappings":"AAWA,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAsClE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qGAAqG;IACrG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IA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SAAS,CAAC,OAAO,CAAC;IAOzC,uFAAuF;IACtF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC;IAOtC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC;IAenC,UAAU,CACT,IAAI,EAAE,MAAM,GACX,SAAS,CAAC;QAAE,WAAW,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAuBvD;;;OAGG;IACF,MAAM,CAAC,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAM,GAAG,SAAS,CAAC,OAAO,CAAC;IAetE;;;OAGG;IACH,OAAO,CAAE,MAAM;IA6Bf,2EAA2E;IAC3E,OAAO,CAAC,QAAQ;IAIhB,mFAAmF;IACnF,OAAO,CAAE,QAAQ;IASjB,6EAA6E;IAC7E,OAAO,CAAE,WAAW;IAYpB;;;OAGG;IACF,KAAK,CAAC,KAAK,UAAQ,GAAG,SAAS,CAAC,OAAO,CAAC;CAS1C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composition seam between typed domain stores and a `DBer` backend.
|
|
3
|
+
*
|
|
4
|
+
* ADR-0015 owns the store contract. A `StoreOwner` is a domain store such as
|
|
5
|
+
* `Noter` or `Reger`: it borrows no backend knowledge and delegates lifecycle
|
|
6
|
+
* and transactions to the one store it composes over.
|
|
7
|
+
*/
|
|
8
|
+
import type { Operation } from "effection";
|
|
9
|
+
import type { DBer, StoreIdentity } from "./dber.js";
|
|
10
|
+
import type { LMDBer } from "./lmdber.js";
|
|
11
|
+
/** Names one kind of store so an opener can place it, without saying how. */
|
|
12
|
+
export interface StoreFamily {
|
|
13
|
+
/** Family path segment, such as `reg` or `acdc/reg`. */
|
|
14
|
+
tail: string;
|
|
15
|
+
/** Upper bound on named tables, for backends that need one up front. */
|
|
16
|
+
maxTables?: number;
|
|
17
|
+
/** True for a family that never uses the `.keri` compatibility layout. */
|
|
18
|
+
noCompat?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates closed stores for one composition.
|
|
22
|
+
*
|
|
23
|
+
* The caller owns each returned store: opening happens through its owner's
|
|
24
|
+
* `reopen`, and whoever constructs an owner closes it.
|
|
25
|
+
*/
|
|
26
|
+
export interface StoreOpener {
|
|
27
|
+
create(family: StoreFamily, identity: StoreIdentity): DBer;
|
|
28
|
+
}
|
|
29
|
+
/** A domain store composed over one `DBer`. */
|
|
30
|
+
export declare abstract class StoreOwner {
|
|
31
|
+
readonly store: DBer;
|
|
32
|
+
constructor(store: DBer);
|
|
33
|
+
/** Open the store and rebind this owner's typed tables. */
|
|
34
|
+
abstract reopen(options?: StoreIdentity): Operation<boolean>;
|
|
35
|
+
get name(): string;
|
|
36
|
+
get base(): string;
|
|
37
|
+
get opened(): boolean;
|
|
38
|
+
get readonly(): boolean;
|
|
39
|
+
get temp(): boolean;
|
|
40
|
+
get inWriteTransaction(): boolean;
|
|
41
|
+
/** Filesystem path on an LMDB-backed store; `null` elsewhere. */
|
|
42
|
+
get path(): string | null;
|
|
43
|
+
/** Native LMDB environment for low-level tests only; `null` on other backends. */
|
|
44
|
+
get env(): LMDBer["env"];
|
|
45
|
+
get writeVersion(): number;
|
|
46
|
+
transaction<T>(fn: () => T): T;
|
|
47
|
+
flushed(): Operation<void>;
|
|
48
|
+
refreshRead(): void;
|
|
49
|
+
hasTable(name: string): boolean;
|
|
50
|
+
getVer(): string | null;
|
|
51
|
+
setVer(val: string): void;
|
|
52
|
+
close(clear?: boolean): Operation<boolean>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Open a ready owner for its caller, closing an unreturned acquisition on
|
|
56
|
+
* failure or cancellation without masking the original error.
|
|
57
|
+
*/
|
|
58
|
+
export declare function openOwner<T extends StoreOwner>(owner: T, label: string, options?: StoreIdentity): Operation<T>;
|
|
59
|
+
//# sourceMappingURL=store-owner.d.ts.map
|
|
@@ -0,0 +1 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AE,MAAM,CAAC,GAAG,CAAC;IAI9B,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC;IAI1B,WAAW,IAAI,IAAI;IAInB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI/B,MAAM,IAAI,MAAM,GAAG,IAAI;IAIvB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,KAAK,CAAC,KAAK,UAAQ,GAAG,SAAS,CAAC,OAAO,CAAC;CAGzC;AAED;;;GAGG;AACH,wBAAiB,SAAS,CAAC,CAAC,SAAS,UAAU,EAC7C,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,SAAS,CAAC,CAAC,CAAC,CA0Bd"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-capable `DBer`: a `MemStore` mirror with write-behind persistence.
|
|
3
|
+
*
|
|
4
|
+
* ADR-0015 owns the durability model. Reads and writes are synchronous against
|
|
5
|
+
* the mirror; each outermost commit enqueues one batch holding its net effect,
|
|
6
|
+
* and a queue shared by a composition applies batches one at a time in global
|
|
7
|
+
* commit order. Nothing here may reach `lmdb`, `node:` or the `Deno` global.
|
|
8
|
+
*
|
|
9
|
+
* Invariant: once the queue is joined with no failure, the mirror and the
|
|
10
|
+
* persisted rows are byte-identical, which is why `reopen` joins before it loads.
|
|
11
|
+
*/
|
|
12
|
+
import { type Operation } from "effection";
|
|
13
|
+
import type { StoreIdentity, Table, TableEntry } from "./dber.js";
|
|
14
|
+
import { MemStore, type StoreChange } from "./memstore.js";
|
|
15
|
+
import type { StoreFamily, StoreOpener } from "./store-owner.js";
|
|
16
|
+
/** One persisted table and the dupsort flag fixed when it was created. */
|
|
17
|
+
export interface PersistedTable {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly dupsort: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** What one store has persisted, apart from its rows. */
|
|
22
|
+
export interface PersistedMeta {
|
|
23
|
+
/** The `__version__` marker, or `null` when none was written. */
|
|
24
|
+
readonly version: string | null;
|
|
25
|
+
readonly tables: readonly PersistedTable[];
|
|
26
|
+
}
|
|
27
|
+
/** Store one row. Replaces `(table, key)` on a plain table; adds `(table, key, value)` on a dupsort one. */
|
|
28
|
+
export interface RowPut {
|
|
29
|
+
readonly table: string;
|
|
30
|
+
readonly key: Uint8Array;
|
|
31
|
+
readonly value: Uint8Array;
|
|
32
|
+
}
|
|
33
|
+
/** Remove one row. `value` is set exactly when the table is dupsort, selecting that one duplicate. */
|
|
34
|
+
export interface RowDelete {
|
|
35
|
+
readonly table: string;
|
|
36
|
+
readonly key: Uint8Array;
|
|
37
|
+
readonly value?: Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The net effect of one commit. Row identities are distinct across `puts` and
|
|
41
|
+
* `deletes`, so an adapter may apply them in any order.
|
|
42
|
+
*/
|
|
43
|
+
export interface PersistenceBatch {
|
|
44
|
+
/** Tables first carried by this batch; the adapter creates them before writing rows. */
|
|
45
|
+
readonly tables: readonly PersistedTable[];
|
|
46
|
+
/** Present only when this commit changed the version marker. */
|
|
47
|
+
readonly version?: string;
|
|
48
|
+
readonly puts: readonly RowPut[];
|
|
49
|
+
readonly deletes: readonly RowDelete[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Storage adapter behind one `WebDBer`. Its methods are only ever called one
|
|
53
|
+
* at a time per store, never overlapping a `write`. A batch is the adapter's
|
|
54
|
+
* to keep: it shares no bytes with the mirror.
|
|
55
|
+
*/
|
|
56
|
+
export interface Persistence {
|
|
57
|
+
/** Describe what is persisted, connecting if needed; called first on every open. */
|
|
58
|
+
meta(): Promise<PersistedMeta>;
|
|
59
|
+
/** Every row of one table, in any order. */
|
|
60
|
+
load(table: string): Promise<TableEntry[]>;
|
|
61
|
+
/** Apply one batch atomically across its tables. Resolves only once it is durable. */
|
|
62
|
+
write(batch: PersistenceBatch): Promise<void>;
|
|
63
|
+
/** Delete everything persisted. Called with the connection released. */
|
|
64
|
+
clear(): Promise<void>;
|
|
65
|
+
/** Release the connection. A later `meta` reconnects. */
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The persistence order of one composition. Tasks run strictly one at a time,
|
|
70
|
+
* outside any Effection scope, so cancelling a waiter never cancels a write.
|
|
71
|
+
*
|
|
72
|
+
* The first failure latches: every later task is skipped, because applying a
|
|
73
|
+
* later batch over a lost earlier one would break prefix durability.
|
|
74
|
+
*/
|
|
75
|
+
export declare class PersistenceQueue {
|
|
76
|
+
#private;
|
|
77
|
+
/** Append a task, which is skipped if an earlier one failed. */
|
|
78
|
+
enqueue(task: () => Promise<void>): void;
|
|
79
|
+
/** Append connection teardown, which still runs after a failure so a handle is not left open. */
|
|
80
|
+
release(task: () => Promise<void>): void;
|
|
81
|
+
/** Refuse new work once latched. The original failure is the cause. */
|
|
82
|
+
assertHealthy(): void;
|
|
83
|
+
/** Wait until everything enqueued before this call is durable. Halting cancels only the wait. */
|
|
84
|
+
flushed(): Operation<void>;
|
|
85
|
+
/** Like `flushed`, but a halted caller still waits for the queue and still reports its failure. */
|
|
86
|
+
joined(): Operation<void>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* `MemStore` mirror whose commits persist through a `Persistence` adapter.
|
|
90
|
+
*
|
|
91
|
+
* After the queue latches, a commit already in the mirror stays there and stays
|
|
92
|
+
* readable even though it was never persisted, and every later transaction
|
|
93
|
+
* throws before touching the mirror, so the mirror stops changing. The durable
|
|
94
|
+
* state is a prefix of the commit sequence. Recovery is a new composition, with
|
|
95
|
+
* a new queue, loading that prefix; there is no retry.
|
|
96
|
+
*/
|
|
97
|
+
export declare class WebDBer extends MemStore {
|
|
98
|
+
#private;
|
|
99
|
+
constructor(options: StoreIdentity, persistence: Persistence, queue: PersistenceQueue);
|
|
100
|
+
/**
|
|
101
|
+
* Join the queue, then bulk-load every persisted table before returning, so
|
|
102
|
+
* reads never suspend. A latched queue refuses, reporting its failure.
|
|
103
|
+
*/
|
|
104
|
+
reopen(options?: StoreIdentity): Operation<boolean>;
|
|
105
|
+
/**
|
|
106
|
+
* Stop accepting work, drain and join the queue even when cancelled, and
|
|
107
|
+
* report any failure. A latched store is neither cleared nor reusable, and
|
|
108
|
+
* every later close reports the same failure.
|
|
109
|
+
*/
|
|
110
|
+
close(clear?: boolean): Operation<boolean>;
|
|
111
|
+
/** Bind a table; a new one is physically created by the batch that first carries it. */
|
|
112
|
+
openTable(name: string, options?: {
|
|
113
|
+
dupsort?: boolean;
|
|
114
|
+
}): Table;
|
|
115
|
+
transaction<T>(fn: () => T): T;
|
|
116
|
+
/** Completes when every earlier commit in this composition is durable, or fails with its recorded failure. */
|
|
117
|
+
flushed(): Operation<void>;
|
|
118
|
+
protected committed(changes: readonly StoreChange[]): void;
|
|
119
|
+
}
|
|
120
|
+
/** A `StoreOpener` of `WebDBer`s bound to one queue, which is what makes a composition one commit order. */
|
|
121
|
+
export declare class WebStoreOpener implements StoreOpener {
|
|
122
|
+
readonly persistenceFor: (family: StoreFamily, identity: StoreIdentity) => Persistence;
|
|
123
|
+
readonly queue: PersistenceQueue;
|
|
124
|
+
constructor(persistenceFor: (family: StoreFamily, identity: StoreIdentity) => Persistence);
|
|
125
|
+
create(family: StoreFamily, identity: StoreIdentity): WebDBer;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=webdber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webdber.d.ts","sourceRoot":"","sources":["../../../src/db/core/webdber.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM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qBAAa,cAAe,YAAW,WAAW;IAGpC,QAAQ,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,KAAK,WAAW;IAFlG,QAAQ,CAAC,KAAK,mBAA0B;gBAEnB,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,KAAK,WAAW;IAElG,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO;CAG9D"}
|
package/types/db/escrowing.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Cigar, Dater, Diger, SerderKERI, Siger } from "cesr-ts";
|
|
|
2
2
|
import { TransIdxSigGroup } from "../core/dispatch.js";
|
|
3
3
|
import { type EscrowProcessDecision } from "../core/kel/kever-decisions.js";
|
|
4
4
|
import type { VerferCigarCouple } from "../core/records.js";
|
|
5
|
-
import {
|
|
5
|
+
import type { DBer } from "./core/dber.js";
|
|
6
6
|
import { CatCesrIoSetSuber, CesrIoSetSuber, CesrSuber, SerderSuber } from "./subing.js";
|
|
7
7
|
/** Callback shape used when `Broker` retries one escrowed state notice. */
|
|
8
8
|
export interface BrokerProcessReplyArgs {
|
|
@@ -37,7 +37,7 @@ export interface BrokerOptions {
|
|
|
37
37
|
* - storage/corruption failures propagate without discarding retryable evidence
|
|
38
38
|
*/
|
|
39
39
|
export declare class Broker {
|
|
40
|
-
readonly db:
|
|
40
|
+
readonly db: DBer;
|
|
41
41
|
readonly timeout: number;
|
|
42
42
|
readonly daterdb: CesrSuber<Dater>;
|
|
43
43
|
readonly serderdb: SerderSuber<SerderKERI>;
|
|
@@ -46,7 +46,7 @@ export declare class Broker {
|
|
|
46
46
|
readonly escrowdb: CesrIoSetSuber<Diger>;
|
|
47
47
|
readonly saiderdb: CesrSuber<Diger>;
|
|
48
48
|
private readonly retryScans;
|
|
49
|
-
constructor(db:
|
|
49
|
+
constructor(db: DBer, subkey: string, { timeout }?: BrokerOptions);
|
|
50
50
|
/** Return the currently saved transaction-state SAID for `(prefix, aid)`. */
|
|
51
51
|
current(keys: [string, string]): Diger | null;
|
|
52
52
|
/** Test one exact family/prefix/attester bucket without materializing its members. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrowing.d.ts","sourceRoot":"","sources":["../../src/db/escrowing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAoB,UAAU,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAExF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"escrowing.d.ts","sourceRoot":"","sources":["../../src/db/escrowing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAoB,UAAU,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAExF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuBxF,2EAA2E;AAC3E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,G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;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE;IA+EvC;;;;;;;;;;;;OAYG;IACH,iBAAiB,CACf,EACE,GAAG,EACH,GAAG,EACH,GAAG,EACH,MAAM,EACN,KAAK,EACL,KAAK,EACL,MAAW,EACX,IAAS,GACV,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,UAAU,CAAC;QACnB,KAAK,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;KACpC,GACA,OAAO;IAyBV;;;;;OAKG;IACH,WAAW,CACT,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,GACX,IAAI;IAeP,wEAAwE;IACxE,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAYlD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,SAAS;CAyClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exchange-nests.d.ts","sourceRoot":"","sources":["../../../src/db/exchange/exchange-nests.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAqB1C,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"exchange-nests.d.ts","sourceRoot":"","sources":["../../../src/db/exchange/exchange-nests.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,OAAO,EAEL,KAAK,SAAS,EAQf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAqB1C,0EAA0E;AAC1E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,OAAO,CAKtE;AAED,4FAA4F;AAC5F,wBAAsB,YAAY,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAI3G;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAMxF;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAY9D"}
|
package/types/db/keeping.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Cipher, type Decrypter, type Encrypter, Prefixer, Salter, type Tier } from "cesr-ts";
|
|
2
2
|
import { type Operation } from "effection";
|
|
3
|
+
import { type Logger } from "../core/logger.js";
|
|
3
4
|
import { GroupMemberTuple, RawRecord } from "../core/records.js";
|
|
4
|
-
import {
|
|
5
|
+
import type { DBer, StoreIdentity } from "./core/dber.js";
|
|
6
|
+
import type { LMDBerOptions } from "./core/lmdber.js";
|
|
7
|
+
import { type StoreFamily, StoreOwner } from "./core/store-owner.js";
|
|
5
8
|
import { Komer } from "./koming.js";
|
|
6
9
|
import { CatCesrIoSetSuber, CesrSuber, CryptSignerSuber, Suber } from "./subing.js";
|
|
7
10
|
/** Options for opening a keeper LMDB environment and its named subdb surface. */
|
|
@@ -148,8 +151,9 @@ export declare class PubSet extends RawRecord<PubSetShape> implements PubSetShap
|
|
|
148
151
|
* named handles
|
|
149
152
|
* - compatibility mode supports KERIpy `.keri/ks` layout visibility
|
|
150
153
|
*/
|
|
151
|
-
export declare class Keeper {
|
|
152
|
-
|
|
154
|
+
export declare class Keeper extends StoreOwner {
|
|
155
|
+
/** Placement of this store kind. */
|
|
156
|
+
static readonly Family: StoreFamily;
|
|
153
157
|
private readonly logger;
|
|
154
158
|
/** Keeper-global parameters shared across all managed prefixes. */
|
|
155
159
|
gbls: Suber;
|
|
@@ -173,24 +177,8 @@ export declare class Keeper {
|
|
|
173
177
|
nxts: CesrSuber<Cipher>;
|
|
174
178
|
/** Encrypted Salt128 roots scoped by canonical local AID and registry SAID. */
|
|
175
179
|
rroots: CesrSuber<Cipher>;
|
|
176
|
-
static readonly TailDirPath = "keri/ks";
|
|
177
|
-
static readonly AltTailDirPath = ".tufa/ks";
|
|
178
|
-
static readonly CompatAltTailDirPath = ".keri/ks";
|
|
179
|
-
static readonly TempPrefix = "keri_ks_";
|
|
180
180
|
static readonly MaxNamedDBs = 24;
|
|
181
|
-
constructor(
|
|
182
|
-
/** Expose the resolved keeper database name delegated from the root LMDBer. */
|
|
183
|
-
get name(): string;
|
|
184
|
-
/** Expose the resolved keeper base prefix delegated from the root LMDBer. */
|
|
185
|
-
get base(): string;
|
|
186
|
-
/** Report whether the keeper LMDB environment and named subdb surface are open. */
|
|
187
|
-
get opened(): boolean;
|
|
188
|
-
/** Report whether the keeper environment is opened in read-only mode. */
|
|
189
|
-
get readonly(): boolean;
|
|
190
|
-
/** Report whether this keeper uses a temporary backing directory. */
|
|
191
|
-
get temp(): boolean;
|
|
192
|
-
/** Expose the resolved filesystem path for the keeper environment, when open. */
|
|
193
|
-
get path(): string | null;
|
|
181
|
+
constructor(store: DBer, logger?: Logger);
|
|
194
182
|
/**
|
|
195
183
|
* Reopen the keeper environment and bind the KERIpy-style named subdbs.
|
|
196
184
|
*
|
|
@@ -199,7 +187,7 @@ export declare class Keeper {
|
|
|
199
187
|
* of the keeper surface remains parity-bound even where higher-level runtime
|
|
200
188
|
* flows have not yet exercised it deeply.
|
|
201
189
|
*/
|
|
202
|
-
reopen(options?:
|
|
190
|
+
reopen(options?: StoreIdentity): Operation<boolean>;
|
|
203
191
|
/** Close the underlying keeper LMDB environment. */
|
|
204
192
|
close(clear?: boolean): Operation<boolean>;
|
|
205
193
|
/**
|
|
@@ -287,6 +275,4 @@ export declare class Keeper {
|
|
|
287
275
|
/** Read group-rotating member tuples from `rmids.`. */
|
|
288
276
|
getRmids(pre: string): GroupMemberTuple[];
|
|
289
277
|
}
|
|
290
|
-
/** Constructor-safe async factory for a fully reopened `Keeper`. */
|
|
291
|
-
export declare function createKeeper(options?: KeeperOptions): Operation<Keeper>;
|
|
292
278
|
//# sourceMappingURL=keeping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keeping.d.ts","sourceRoot":"","sources":["../../src/db/keeping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAGd,QAAQ,EACR,MAAM,EAEN,KAAK,IAAI,EAEV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"keeping.d.ts","sourceRoot":"","sources":["../../src/db/keeping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAGd,QAAQ,EACR,MAAM,EAEN,KAAK,IAAI,EAEV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAA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