@peerbit/native-backbone 0.2.9 → 0.2.11
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 +55 -20
- package/dist/src/index.d.ts +61 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +948 -74
- package/dist/src/index.js.map +1 -1
- package/dist/wasm/README.md +55 -20
- package/dist/wasm/native_backbone.d.ts +124 -79
- package/dist/wasm/native_backbone.js +297 -0
- package/dist/wasm/native_backbone_bg.wasm +0 -0
- package/dist/wasm/native_backbone_bg.wasm.d.ts +90 -79
- package/package.json +2 -2
- package/src/append_tx/committed_latest.rs +10 -5
- package/src/append_tx/committed_no_next.rs +6 -3
- package/src/append_tx/facts.rs +427 -1
- package/src/append_tx/mod.rs +51 -18
- package/src/append_tx/storage.rs +12 -2
- package/src/index.ts +1418 -227
- package/src/shared_log_plan.rs +30 -0
package/README.md
CHANGED
|
@@ -7,26 +7,60 @@ fused. It owns the native lower-log graph, native log block store, and shared-lo
|
|
|
7
7
|
resident coordinate state in one Rust object so higher layers can move toward a
|
|
8
8
|
single `JS -> native -> compact facts` transaction boundary.
|
|
9
9
|
|
|
10
|
-
## Coordinate WAL persistence
|
|
10
|
+
## Coordinate and document-fact WAL persistence
|
|
11
11
|
|
|
12
|
-
Native shared-log coordinates
|
|
13
|
-
buffered
|
|
14
|
-
mode. Buffered
|
|
15
|
-
flush,
|
|
16
|
-
document writes.
|
|
12
|
+
Native shared-log coordinates, document values, and document signer facts can be
|
|
13
|
+
persisted through write-through or buffered WALs. Write-through flushes every
|
|
14
|
+
append and is the strictest persistence mode. Buffered WALs batch bytes and flush
|
|
15
|
+
on their pending-byte threshold, explicit flush, checkpoint, or close, which is
|
|
16
|
+
the high-throughput mode for strict native document writes.
|
|
17
17
|
|
|
18
18
|
Use `createBufferedNativeBackboneCoordinatePersistence(store)` with OPFS, memory,
|
|
19
19
|
or custom stores, and `createBufferedNativeBackboneNodeCoordinatePersistence(dir)`
|
|
20
|
-
for the Node adapter.
|
|
21
|
-
|
|
22
|
-
uses the same bounded checkpoint default.
|
|
20
|
+
for the Node adapter. Persistence flush and replay are enabled by default;
|
|
21
|
+
checkpoint compaction is not.
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
The built-in Node adapter supports explicit crash-safe checkpointing when its
|
|
24
|
+
filesystem implementation provides atomic replacement. Opt in by setting
|
|
25
|
+
`compactMaxJournalBytes` or `compactMaxJournalRecords` on
|
|
26
|
+
`NativeBackboneNodeCoordinatePersistence` or
|
|
27
|
+
`createBufferedNativeBackboneNodeCoordinatePersistence`:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
```ts
|
|
30
|
+
const persistence = createBufferedNativeBackboneNodeCoordinatePersistence(
|
|
31
|
+
programDirectory,
|
|
32
|
+
{ compactMaxJournalBytes: 64 * 1024 * 1024 },
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Crossing either configured threshold durably publishes one versioned, checksummed
|
|
37
|
+
checkpoint for all three fact sets, switches between fixed A/B WAL generations,
|
|
38
|
+
and records an atomic replay high-water mark before covered WAL data is retired.
|
|
39
|
+
Checkpointing is serialized with flushes, so recovery chooses a fully published
|
|
40
|
+
generation instead of combining partially replaced snapshots.
|
|
41
|
+
|
|
42
|
+
Memory and OPFS persistence, along with custom stores that do not implement the
|
|
43
|
+
atomic replacement, removal, and durability capabilities, continue to reject
|
|
44
|
+
these threshold options. They retain ordinary WAL flush and replay behavior.
|
|
45
|
+
There is intentionally no automatic checkpoint threshold, including for the
|
|
46
|
+
Node helpers.
|
|
47
|
+
|
|
48
|
+
The checkpoint bounds only the coordinate, document-value, and document-signer
|
|
49
|
+
WALs. The entry-block WAL has a separate owner and remains out of scope, so this
|
|
50
|
+
feature does not by itself bound every file in a program directory.
|
|
51
|
+
|
|
52
|
+
Existing directories using the legacy snapshots and WALs open without a manual
|
|
53
|
+
migration. Their first checkpoint becomes forward-only once its staged generation
|
|
54
|
+
and downgrade sentinel are durable. If publication is interrupted after that
|
|
55
|
+
boundary, current recovery validates and promotes the staged generation; before
|
|
56
|
+
the boundary, the complete legacy WAL remains authoritative. The sentinel makes a
|
|
57
|
+
pre-checkpoint package fail closed rather than replay stale legacy files. Rolling
|
|
58
|
+
back therefore requires restoring a pre-migration copy of the directory. This is
|
|
59
|
+
an opt-in, forward-only internal persistence-format migration. It removes no
|
|
60
|
+
public API and does not alter the peer-to-peer wire format; it does add observable
|
|
61
|
+
Node checkpoint capabilities and downgrade behavior.
|
|
62
|
+
|
|
63
|
+
These fact WALs support clean stop/restart. They are not the recovery authority
|
|
30
64
|
for a crash-atomic append across blocks, graph state, heads, coordinates,
|
|
31
65
|
documents, and signer facts.
|
|
32
66
|
|
|
@@ -50,9 +84,10 @@ directory sync. Its first open creates a synced genesis only in an otherwise
|
|
|
50
84
|
empty program directory; a nonempty legacy directory fails with
|
|
51
85
|
`NativeDurabilityMigrationRequiredError` and is never adopted implicitly.
|
|
52
86
|
|
|
53
|
-
Phase one retains
|
|
54
|
-
A/B checkpoints prove staging coverage.
|
|
55
|
-
deferred until a later phase can switch
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
87
|
+
Phase one retains this separate durability-transaction journal and pins genesis
|
|
88
|
+
as its scan base while newer A/B checkpoints prove staging coverage. Compaction
|
|
89
|
+
of that journal is deliberately deferred until a later phase can switch its
|
|
90
|
+
generation and scan base together; the coordinate/document-fact checkpointing
|
|
91
|
+
described above does not alter it. Memory storage is a non-crash-safe reference
|
|
92
|
+
adapter, and OPFS remains unsupported until its lifetime lease and
|
|
93
|
+
worker-termination barriers have a dedicated conformance gate.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ export * from "./durability/node-lease.js";
|
|
|
5
5
|
export * from "./durability/node-storage.js";
|
|
6
6
|
export * from "./durability/storage.js";
|
|
7
7
|
export type RangeResolution = "u32" | "u64";
|
|
8
|
+
type NativePrepareNoNextDocumentIndexCompactTrimFacts = (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number, documentKey: string, documentValuePrefixBytes: Uint8Array, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlan: NativeBackboneSimpleDocumentProjectionPlan | undefined, documentProjectionEncodedDocument: Uint8Array | undefined, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
9
|
+
type NativePrepareNoNextCachedDocumentIndexCompactTrimFacts = (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionEncodedDocument: Uint8Array, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
10
|
+
type NativePrepareNoNextCachedPlainPutPayloadDocumentIndexCompactTrimFacts = (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
11
|
+
type NativePrepareLatestDocumentIndexTrimFacts = (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number | undefined, documentKey: string, documentValuePrefixBytes: Uint8Array, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlan: NativeBackboneSimpleDocumentProjectionPlan | undefined, documentProjectionEncodedDocument: Uint8Array | undefined, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
12
|
+
type NativePrepareLatestCachedDocumentIndexTrimFacts = (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number | undefined, documentKey: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionEncodedDocument: Uint8Array, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
8
13
|
type NativePeerbitBackboneHandle = {
|
|
9
14
|
log_len: () => number;
|
|
10
15
|
block_len: () => number;
|
|
@@ -179,6 +184,7 @@ type NativePeerbitBackboneHandle = {
|
|
|
179
184
|
clear: () => void;
|
|
180
185
|
clear_shared_log: () => void;
|
|
181
186
|
clear_entry_coordinates: () => void;
|
|
187
|
+
get_routing_full_replica_leaders?: (replicas: number, roleAgeMs: number, now: string, peerFilter: string[] | undefined, expandPeerFilter: boolean, selfHash: string, includeSelf: boolean, fullReplicaFallback: boolean, includeStrictFullReplica: boolean) => unknown[] | undefined;
|
|
182
188
|
put_range: (id: string, hash: string, timestamp: string, start1: string, end1: string, start2: string, end2: string, width: string, mode: number) => void;
|
|
183
189
|
delete_range: (id: string) => boolean;
|
|
184
190
|
put_entry_coordinates: (hash: string, gid: string, hashNumber: string, coordinates: string[], assignedToRangeBoundary: boolean, requestedReplicas: number) => void;
|
|
@@ -244,18 +250,24 @@ type NativePeerbitBackboneHandle = {
|
|
|
244
250
|
]>;
|
|
245
251
|
plan_receive_coordinates_for_gids_batch: (entryHashes: string[], gids: string[], hashNumbers: string[], nextHashBatches: string[][], replicaCounts: number[], roleAgeMs: number, now: string, peerFilter: string[] | undefined, expandPeerFilter: boolean, selfHash: string, includeSelf: boolean, fullReplicaFallback: boolean, includeStrictFullReplica: boolean) => Array<[unknown[], unknown[], boolean, boolean, unknown[]]>;
|
|
246
252
|
prepare_plain_entry_commit_facts: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number | undefined) => unknown[];
|
|
253
|
+
prepare_plain_entry_commit_facts_trim_refs?: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number) => unknown[];
|
|
247
254
|
prepare_plain_entry_commit_facts_document_index: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number | undefined, documentKey: string, documentValuePrefixBytes: Uint8Array, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlan: NativeBackboneSimpleDocumentProjectionPlan | undefined, documentProjectionEncodedDocument: Uint8Array | undefined, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
248
255
|
prepare_plain_entry_commit_facts_document_index_cached_plan: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number | undefined, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionEncodedDocument: Uint8Array, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
249
256
|
prepare_plain_entry_commit_no_next_facts_document_index_compact: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, documentKey: string, documentValuePrefixBytes: Uint8Array, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlan: NativeBackboneSimpleDocumentProjectionPlan | undefined, documentProjectionEncodedDocument: Uint8Array | undefined, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
250
257
|
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionEncodedDocument: Uint8Array, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
251
258
|
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_plain_put_payload?: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
252
259
|
prepare_plain_entry_commit_no_next_facts_document_index_trim_hashes: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number, documentKey: string, documentValuePrefixBytes: Uint8Array, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlan: NativeBackboneSimpleDocumentProjectionPlan | undefined, documentProjectionEncodedDocument: Uint8Array | undefined, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
253
|
-
prepare_plain_entry_commit_no_next_facts_document_index_compact_trim_hashes:
|
|
260
|
+
prepare_plain_entry_commit_no_next_facts_document_index_compact_trim_hashes: NativePrepareNoNextDocumentIndexCompactTrimFacts;
|
|
261
|
+
prepare_plain_entry_commit_no_next_facts_document_index_compact_trim_refs?: NativePrepareNoNextDocumentIndexCompactTrimFacts;
|
|
254
262
|
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_trim_hashes: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number, documentKey: string, documentExistingCreated: string, documentByteElementIndexLimit: number, documentDeleteTrimmedHeads: boolean, documentProjectionPlanId: number, documentProjectionEncodedDocument: Uint8Array, documentProjectionSigner: Uint8Array | undefined) => unknown[];
|
|
255
|
-
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_trim_hashes:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
263
|
+
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_trim_hashes: NativePrepareNoNextCachedDocumentIndexCompactTrimFacts;
|
|
264
|
+
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_trim_refs?: NativePrepareNoNextCachedDocumentIndexCompactTrimFacts;
|
|
265
|
+
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_trim_hashes_plain_put_payload?: NativePrepareNoNextCachedPlainPutPayloadDocumentIndexCompactTrimFacts;
|
|
266
|
+
prepare_plain_entry_commit_no_next_facts_document_index_cached_plan_compact_trim_refs_plain_put_payload?: NativePrepareNoNextCachedPlainPutPayloadDocumentIndexCompactTrimFacts;
|
|
267
|
+
prepare_plain_entry_commit_latest_facts_document_index_trim_hashes: NativePrepareLatestDocumentIndexTrimFacts;
|
|
268
|
+
prepare_plain_entry_commit_latest_facts_document_index_trim_refs?: NativePrepareLatestDocumentIndexTrimFacts;
|
|
269
|
+
prepare_plain_entry_commit_latest_facts_document_index_cached_plan_trim_hashes: NativePrepareLatestCachedDocumentIndexTrimFacts;
|
|
270
|
+
prepare_plain_entry_commit_latest_facts_document_index_cached_plan_trim_refs?: NativePrepareLatestCachedDocumentIndexTrimFacts;
|
|
259
271
|
prepare_plain_entry_storage_facts_and_put: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array) => unknown[];
|
|
260
272
|
prepare_plain_entry_storage_facts_trim_and_put: (wallTime: bigint, logical: number, gid: string, next: string[], type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, trimLengthTo: number) => unknown[];
|
|
261
273
|
prepare_plain_no_next_storage_append_transaction: (wallTime: bigint, logical: number, gid: string, type: number, metaData: Uint8Array | undefined, payloadData: Uint8Array, replicas: number, roleAgeMs: number, now: string, selfHash: string, selfReplicating: boolean, resolveTrimmedEntries: boolean) => unknown[];
|
|
@@ -763,6 +775,7 @@ export type NativeBackboneAppendResult = {
|
|
|
763
775
|
assignedToRangeBoundary: boolean;
|
|
764
776
|
trimmed: NativeBackboneTrimmedEntry[];
|
|
765
777
|
trimmedHashes?: string[];
|
|
778
|
+
trimmedGids?: string[];
|
|
766
779
|
documentTrimmedHeadsProcessed?: boolean;
|
|
767
780
|
documentPreviousContext?: NativeBackboneDocumentContextFacts;
|
|
768
781
|
};
|
|
@@ -774,6 +787,7 @@ type NativeBackboneStorageAppendResult = {
|
|
|
774
787
|
assignedToRangeBoundary: boolean;
|
|
775
788
|
trimmed: NativeBackboneTrimmedEntry[];
|
|
776
789
|
trimmedHashes?: string[];
|
|
790
|
+
trimmedGids?: string[];
|
|
777
791
|
documentTrimmedHeadsProcessed?: boolean;
|
|
778
792
|
documentPreviousContext?: NativeBackboneDocumentContextFacts;
|
|
779
793
|
};
|
|
@@ -933,6 +947,12 @@ export type NativeBackboneCoordinatePersistenceStore = {
|
|
|
933
947
|
*/
|
|
934
948
|
readLimited?(name: string, maxBytes: number): Promise<Uint8Array | undefined>;
|
|
935
949
|
write(name: string, bytes: Uint8Array): Promise<void>;
|
|
950
|
+
/**
|
|
951
|
+
* Durably replace one named file without exposing a torn destination. The
|
|
952
|
+
* replacement is not visible until its bytes and containing directory have
|
|
953
|
+
* crossed their physical durability barriers.
|
|
954
|
+
*/
|
|
955
|
+
atomicReplace?(name: string, bytes: Uint8Array): Promise<void>;
|
|
936
956
|
/**
|
|
937
957
|
* Appends `bytes` to the named file. Callers hand over ownership of
|
|
938
958
|
* `bytes` and must not mutate it afterwards: buffering stores keep the
|
|
@@ -1022,7 +1042,7 @@ export type NativeBackboneNodeCoordinatePersistenceOptions = NativeBackboneCoord
|
|
|
1022
1042
|
};
|
|
1023
1043
|
export declare const nativeBackboneCoordinateDropTombstoneFile = "native-backbone-drop.tombstone";
|
|
1024
1044
|
export declare const defaultNativeBackboneCoordinateFlushMaxPendingBytes: number;
|
|
1025
|
-
/**
|
|
1045
|
+
/** Recommended explicit byte threshold for crash-safe Node checkpointing. */
|
|
1026
1046
|
export declare const defaultNativeBackboneCoordinateCompactMaxJournalBytes: number;
|
|
1027
1047
|
type NativeBackboneNodeFs = {
|
|
1028
1048
|
mkdir(path: string, options?: {
|
|
@@ -1031,6 +1051,7 @@ type NativeBackboneNodeFs = {
|
|
|
1031
1051
|
readFile(path: string): Promise<Uint8Array>;
|
|
1032
1052
|
writeFile(path: string, data: Uint8Array): Promise<unknown>;
|
|
1033
1053
|
appendFile(path: string, data: Uint8Array): Promise<unknown>;
|
|
1054
|
+
rename?(from: string, to: string): Promise<unknown>;
|
|
1034
1055
|
/** Explicit capability for pre-allocation-bounded positional reads. */
|
|
1035
1056
|
openBoundedRead?(path: string): Promise<NativeBackboneNodeBoundedReadFileHandle>;
|
|
1036
1057
|
open?(path: string, flags: string): Promise<NativeBackboneNodeAppendFileHandle>;
|
|
@@ -1147,7 +1168,9 @@ declare class NativeBackboneLogGraph {
|
|
|
1147
1168
|
}, _blockStore: unknown): (NativeBackboneCommittedEntry & {
|
|
1148
1169
|
trimmedEntries?: NativeBackboneLogEntry[];
|
|
1149
1170
|
trimmedEntryHashes?: string[];
|
|
1171
|
+
trimmedEntryGids?: string[];
|
|
1150
1172
|
documentTrimmedHeadsProcessed?: boolean;
|
|
1173
|
+
documentPreviousContext?: NativeBackboneDocumentContextFacts;
|
|
1151
1174
|
}) | undefined;
|
|
1152
1175
|
prepareEntryV0PlainEntryAndPut(input: {
|
|
1153
1176
|
clockId: Uint8Array;
|
|
@@ -1467,6 +1490,7 @@ export declare class NativePeerbitBackbone {
|
|
|
1467
1490
|
loadDocumentSignerSnapshotAndJournal(snapshot?: Uint8Array, journal?: Uint8Array): number;
|
|
1468
1491
|
clear(): void;
|
|
1469
1492
|
clearSharedLog(): void;
|
|
1493
|
+
getRoutingFullReplicaLeaders(replicas: number, options?: NativeBackboneFindLeaderOptions): Map<string, NativeBackboneLeaderSample> | undefined;
|
|
1470
1494
|
clearEntryCoordinates(): void;
|
|
1471
1495
|
putRange(range: NativeBackboneRangeInput): void;
|
|
1472
1496
|
deleteRange(id: string): boolean;
|
|
@@ -1580,6 +1604,7 @@ export declare class NativeBackboneNodeCoordinatePersistenceStore implements Nat
|
|
|
1580
1604
|
private appendFailure;
|
|
1581
1605
|
readonly readLimited?: (name: string, maxBytes: number) => Promise<Uint8Array | undefined>;
|
|
1582
1606
|
readonly durableBarrier?: (name?: string) => Promise<void>;
|
|
1607
|
+
readonly atomicReplace?: (name: string, bytes: Uint8Array) => Promise<void>;
|
|
1583
1608
|
constructor(directory: string, fs?: NativeBackboneNodeFs | undefined);
|
|
1584
1609
|
private nodeFs;
|
|
1585
1610
|
private filePath;
|
|
@@ -1589,6 +1614,7 @@ export declare class NativeBackboneNodeCoordinatePersistenceStore implements Nat
|
|
|
1589
1614
|
read(name: string): Promise<Uint8Array | undefined>;
|
|
1590
1615
|
private readWithinLimit;
|
|
1591
1616
|
write(name: string, bytes: Uint8Array): Promise<void>;
|
|
1617
|
+
private replaceAtomically;
|
|
1592
1618
|
append(name: string, bytes: Uint8Array): Promise<void>;
|
|
1593
1619
|
remove(name: string): Promise<void>;
|
|
1594
1620
|
flush(name?: string): Promise<void>;
|
|
@@ -1621,6 +1647,7 @@ export declare class NativeBackboneBufferedCoordinatePersistenceStore implements
|
|
|
1621
1647
|
readonly readLimited?: (name: string, maxBytes: number) => Promise<Uint8Array | undefined>;
|
|
1622
1648
|
readonly supportsRemoval: boolean;
|
|
1623
1649
|
readonly durableBarrier?: (name?: string) => Promise<void>;
|
|
1650
|
+
readonly atomicReplace?: (name: string, bytes: Uint8Array) => Promise<void>;
|
|
1624
1651
|
constructor(inner: NativeBackboneCoordinatePersistenceStore, options?: {
|
|
1625
1652
|
maxBufferedBytes?: number;
|
|
1626
1653
|
});
|
|
@@ -1642,7 +1669,7 @@ export declare class NativeBackboneCoordinatePersistence {
|
|
|
1642
1669
|
readonly flushIntervalMs?: number;
|
|
1643
1670
|
readonly compactMaxJournalBytes?: number;
|
|
1644
1671
|
readonly compactMaxJournalRecords?: number;
|
|
1645
|
-
readonly crashSafeCompaction
|
|
1672
|
+
readonly crashSafeCompaction: boolean;
|
|
1646
1673
|
readonly durableBarrier: boolean;
|
|
1647
1674
|
readonly supportsDrop: boolean;
|
|
1648
1675
|
readonly dropIsTerminal = true;
|
|
@@ -1652,9 +1679,22 @@ export declare class NativeBackboneCoordinatePersistence {
|
|
|
1652
1679
|
private readonly documentJournalFile;
|
|
1653
1680
|
private readonly documentSignerSnapshotFile;
|
|
1654
1681
|
private readonly documentSignerJournalFile;
|
|
1682
|
+
private readonly checkpointConfigurationChecksum;
|
|
1683
|
+
private readonly checkpointStateFile;
|
|
1684
|
+
private readonly checkpointFiles;
|
|
1685
|
+
private readonly checkpointJournalFiles;
|
|
1655
1686
|
private journalInitialized;
|
|
1687
|
+
private journalByteLength;
|
|
1688
|
+
private journalRecordCount;
|
|
1656
1689
|
private documentJournalInitialized;
|
|
1690
|
+
private documentJournalByteLength;
|
|
1691
|
+
private documentJournalRecordCount;
|
|
1657
1692
|
private documentSignerJournalInitialized;
|
|
1693
|
+
private documentSignerJournalByteLength;
|
|
1694
|
+
private documentSignerJournalRecordCount;
|
|
1695
|
+
private checkpointHighwater;
|
|
1696
|
+
private checkpointCompleted?;
|
|
1697
|
+
private checkpointPending?;
|
|
1658
1698
|
private lastFlushMs;
|
|
1659
1699
|
private persistenceQueue;
|
|
1660
1700
|
private persistenceLifecycle;
|
|
@@ -1667,13 +1707,22 @@ export declare class NativeBackboneCoordinatePersistence {
|
|
|
1667
1707
|
constructor(store: NativeBackboneCoordinatePersistenceStore, options?: NativeBackboneCoordinatePersistenceOptions);
|
|
1668
1708
|
/** Durable operation-intent capability for strict shared-log transactions. */
|
|
1669
1709
|
get intentStore(): NativeBackboneCoordinatePersistenceStore;
|
|
1710
|
+
private legacyConfiguredFiles;
|
|
1670
1711
|
private configuredFiles;
|
|
1712
|
+
private checkpointSlot;
|
|
1713
|
+
private activeJournalFiles;
|
|
1671
1714
|
private assertLifecycleActive;
|
|
1672
1715
|
private assertActive;
|
|
1716
|
+
private assertPersistenceHealthy;
|
|
1673
1717
|
private resetJournalTracking;
|
|
1718
|
+
private persistDropTombstone;
|
|
1674
1719
|
private eraseDropFiles;
|
|
1675
1720
|
drop(additionalFiles?: readonly string[]): Promise<void>;
|
|
1676
1721
|
resumeDrop(): Promise<boolean>;
|
|
1722
|
+
private barrierFile;
|
|
1723
|
+
private hasDurableLegacyMigrationSentinel;
|
|
1724
|
+
private installLegacyMigrationSentinel;
|
|
1725
|
+
private requireLegacyMigrationSentinel;
|
|
1677
1726
|
hydrate(backbone: NativePeerbitBackbone): Promise<number>;
|
|
1678
1727
|
private assertHydrating;
|
|
1679
1728
|
private resumeDropInternal;
|
|
@@ -1681,8 +1730,12 @@ export declare class NativeBackboneCoordinatePersistence {
|
|
|
1681
1730
|
flushJournalOnAppend(backbone: NativePeerbitBackbone): number | Promise<number>;
|
|
1682
1731
|
flushJournal(backbone: NativePeerbitBackbone): Promise<number>;
|
|
1683
1732
|
private enqueuePersistence;
|
|
1733
|
+
private shouldCompactJournal;
|
|
1734
|
+
private nextCheckpointGeneration;
|
|
1735
|
+
private publishCheckpoint;
|
|
1736
|
+
private cleanupRetiredCheckpointFiles;
|
|
1684
1737
|
private flushJournalInternal;
|
|
1685
|
-
compact(
|
|
1738
|
+
compact(backbone: NativePeerbitBackbone): Promise<void>;
|
|
1686
1739
|
close(): Promise<void>;
|
|
1687
1740
|
}
|
|
1688
1741
|
export declare class NativeBackboneNodeCoordinatePersistence extends NativeBackboneCoordinatePersistence {
|