@optimystic/db-core 1.19.0 → 1.20.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/dist/src/cluster/structs.d.ts +41 -8
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cluster/structs.js +18 -7
- package/dist/src/cluster/structs.js.map +1 -1
- package/dist/src/collection/action.d.ts +29 -0
- package/dist/src/collection/action.d.ts.map +1 -1
- package/dist/src/collection/action.js +6 -0
- package/dist/src/collection/action.js.map +1 -1
- package/dist/src/collection/collection.d.ts +533 -120
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +974 -500
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collection/head-commit.d.ts +110 -0
- package/dist/src/collection/head-commit.d.ts.map +1 -0
- package/dist/src/collection/head-commit.js +65 -0
- package/dist/src/collection/head-commit.js.map +1 -0
- package/dist/src/collection/index.d.ts +2 -0
- package/dist/src/collection/index.d.ts.map +1 -1
- package/dist/src/collection/index.js +2 -0
- package/dist/src/collection/index.js.map +1 -1
- package/dist/src/collection/segments.d.ts +77 -0
- package/dist/src/collection/segments.d.ts.map +1 -0
- package/dist/src/collection/segments.js +110 -0
- package/dist/src/collection/segments.js.map +1 -0
- package/dist/src/collection/struct.d.ts +156 -1
- package/dist/src/collection/struct.d.ts.map +1 -1
- package/dist/src/collection/struct.js +70 -0
- package/dist/src/collection/struct.js.map +1 -1
- package/dist/src/collection/write-attempts.d.ts +245 -0
- package/dist/src/collection/write-attempts.d.ts.map +1 -0
- package/dist/src/collection/write-attempts.js +439 -0
- package/dist/src/collection/write-attempts.js.map +1 -0
- package/dist/src/collections/tree/struct.d.ts +100 -17
- package/dist/src/collections/tree/struct.d.ts.map +1 -1
- package/dist/src/collections/tree/struct.js +38 -7
- package/dist/src/collections/tree/struct.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +17 -5
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +112 -26
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/network/i-repo.d.ts +3 -0
- package/dist/src/network/i-repo.d.ts.map +1 -1
- package/dist/src/network/index.d.ts +3 -0
- package/dist/src/network/index.d.ts.map +1 -1
- package/dist/src/network/index.js +3 -0
- package/dist/src/network/index.js.map +1 -1
- package/dist/src/network/promise-shortfall-error.d.ts +40 -0
- package/dist/src/network/promise-shortfall-error.d.ts.map +1 -0
- package/dist/src/network/promise-shortfall-error.js +67 -0
- package/dist/src/network/promise-shortfall-error.js.map +1 -0
- package/dist/src/network/refuse-solo.d.ts +8 -0
- package/dist/src/network/refuse-solo.d.ts.map +1 -0
- package/dist/src/network/refuse-solo.js +8 -0
- package/dist/src/network/refuse-solo.js.map +1 -0
- package/dist/src/network/stale-failure.d.ts +20 -3
- package/dist/src/network/stale-failure.d.ts.map +1 -1
- package/dist/src/network/stale-failure.js +24 -3
- package/dist/src/network/stale-failure.js.map +1 -1
- package/dist/src/network/struct.d.ts +148 -2
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/network/validity-rejected-error.d.ts +28 -0
- package/dist/src/network/validity-rejected-error.d.ts.map +1 -0
- package/dist/src/network/validity-rejected-error.js +51 -0
- package/dist/src/network/validity-rejected-error.js.map +1 -0
- package/dist/src/offline/entry.d.ts +72 -0
- package/dist/src/offline/entry.d.ts.map +1 -0
- package/dist/src/offline/entry.js +73 -0
- package/dist/src/offline/entry.js.map +1 -0
- package/dist/src/offline/index.d.ts +5 -0
- package/dist/src/offline/index.d.ts.map +1 -0
- package/dist/src/offline/index.js +5 -0
- package/dist/src/offline/index.js.map +1 -0
- package/dist/src/offline/journal.d.ts +61 -0
- package/dist/src/offline/journal.d.ts.map +1 -0
- package/dist/src/offline/journal.js +2 -0
- package/dist/src/offline/journal.js.map +1 -0
- package/dist/src/offline/queue.d.ts +484 -0
- package/dist/src/offline/queue.d.ts.map +1 -0
- package/dist/src/offline/queue.js +1236 -0
- package/dist/src/offline/queue.js.map +1 -0
- package/dist/src/offline/reachability.d.ts +25 -0
- package/dist/src/offline/reachability.d.ts.map +1 -0
- package/dist/src/offline/reachability.js +13 -0
- package/dist/src/offline/reachability.js.map +1 -0
- package/dist/src/offline/status.d.ts +148 -0
- package/dist/src/offline/status.d.ts.map +1 -0
- package/dist/src/offline/status.js +63 -0
- package/dist/src/offline/status.js.map +1 -0
- package/dist/src/offline/wake.d.ts +30 -0
- package/dist/src/offline/wake.d.ts.map +1 -0
- package/dist/src/offline/wake.js +68 -0
- package/dist/src/offline/wake.js.map +1 -0
- package/dist/src/testing/test-transactor.d.ts +29 -0
- package/dist/src/testing/test-transactor.d.ts.map +1 -1
- package/dist/src/testing/test-transactor.js +50 -0
- package/dist/src/testing/test-transactor.js.map +1 -1
- package/dist/src/transaction/commit-failure-class.d.ts +103 -0
- package/dist/src/transaction/commit-failure-class.d.ts.map +1 -0
- package/dist/src/transaction/commit-failure-class.js +96 -0
- package/dist/src/transaction/commit-failure-class.js.map +1 -0
- package/dist/src/transaction/coordinator.d.ts +165 -41
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +605 -300
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transaction/entry-commit.d.ts +139 -0
- package/dist/src/transaction/entry-commit.d.ts.map +1 -0
- package/dist/src/transaction/entry-commit.js +199 -0
- package/dist/src/transaction/entry-commit.js.map +1 -0
- package/dist/src/transaction/index.d.ts +4 -1
- package/dist/src/transaction/index.d.ts.map +1 -1
- package/dist/src/transaction/index.js +1 -0
- package/dist/src/transaction/index.js.map +1 -1
- package/dist/src/transaction/transaction.d.ts +20 -0
- package/dist/src/transaction/transaction.d.ts.map +1 -1
- package/dist/src/transaction/validator.d.ts +7 -0
- package/dist/src/transaction/validator.d.ts.map +1 -1
- package/dist/src/transaction/validator.js +21 -12
- package/dist/src/transaction/validator.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +1 -0
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +61 -28
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/dist/src/transactor/transactor-source.d.ts +22 -11
- package/dist/src/transactor/transactor-source.d.ts.map +1 -1
- package/dist/src/transactor/transactor-source.js +9 -13
- package/dist/src/transactor/transactor-source.js.map +1 -1
- package/dist/src/utility/visit-every.d.ts +14 -0
- package/dist/src/utility/visit-every.d.ts.map +1 -0
- package/dist/src/utility/visit-every.js +27 -0
- package/dist/src/utility/visit-every.js.map +1 -0
- package/package.json +1 -1
- package/src/cluster/structs.ts +42 -7
- package/src/collection/action.ts +34 -0
- package/src/collection/collection.ts +1048 -543
- package/src/collection/head-commit.ts +148 -0
- package/src/collection/index.ts +2 -0
- package/src/collection/segments.ts +149 -0
- package/src/collection/struct.ts +183 -1
- package/src/collection/write-attempts.ts +506 -0
- package/src/collections/tree/struct.ts +97 -17
- package/src/collections/tree/tree.ts +125 -29
- package/src/index.ts +2 -0
- package/src/network/i-repo.ts +3 -0
- package/src/network/index.ts +3 -0
- package/src/network/promise-shortfall-error.ts +69 -0
- package/src/network/refuse-solo.ts +7 -0
- package/src/network/stale-failure.ts +27 -4
- package/src/network/struct.ts +154 -2
- package/src/network/validity-rejected-error.ts +55 -0
- package/src/offline/entry.ts +127 -0
- package/src/offline/index.ts +4 -0
- package/src/offline/journal.ts +60 -0
- package/src/offline/queue.ts +1342 -0
- package/src/offline/reachability.ts +32 -0
- package/src/offline/status.ts +183 -0
- package/src/offline/wake.ts +67 -0
- package/src/testing/test-transactor.ts +53 -0
- package/src/transaction/commit-failure-class.ts +133 -0
- package/src/transaction/coordinator.ts +696 -349
- package/src/transaction/entry-commit.ts +285 -0
- package/src/transaction/index.ts +4 -0
- package/src/transaction/transaction.ts +21 -0
- package/src/transaction/validator.ts +22 -12
- package/src/transactor/network-transactor.ts +62 -28
- package/src/transactor/transactor-source.ts +29 -13
- package/src/utility/visit-every.ts +25 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { addTallies, ZeroTally } from '../collection/action.js';
|
|
2
|
+
export function queuedStatus(entry) {
|
|
3
|
+
return {
|
|
4
|
+
kind: 'queued',
|
|
5
|
+
entryId: entry.id,
|
|
6
|
+
seq: entry.seq,
|
|
7
|
+
collections: entry.collections.map(collection => collection.id),
|
|
8
|
+
queuedAt: entry.queuedAt,
|
|
9
|
+
attempts: entry.attempts,
|
|
10
|
+
inDoubt: entry.inDoubt,
|
|
11
|
+
waitingFor: entry.waitingFor,
|
|
12
|
+
...(entry.lastError === undefined ? {} : { lastError: entry.lastError }),
|
|
13
|
+
...committedField(entry),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** `{ committedCollections }` once part of the entry has committed, `{}` before — the field the
|
|
17
|
+
* `queued` and `failed` statuses and {@link snapshot} carry only when it says something. */
|
|
18
|
+
export function committedField(entry) {
|
|
19
|
+
return entry.committed.size === 0 ? {} : { committedCollections: [...entry.committed.keys()] };
|
|
20
|
+
}
|
|
21
|
+
export function currentStatus(entry) {
|
|
22
|
+
return entry.phase === 'submitting'
|
|
23
|
+
? { kind: 'submitting', entryId: entry.id, attempt: entry.attempts }
|
|
24
|
+
: queuedStatus(entry);
|
|
25
|
+
}
|
|
26
|
+
/** The entry as `OfflineQueue.entries` lists it. */
|
|
27
|
+
export function snapshot(entry) {
|
|
28
|
+
return {
|
|
29
|
+
id: entry.id,
|
|
30
|
+
seq: entry.seq,
|
|
31
|
+
queuedAt: entry.queuedAt,
|
|
32
|
+
collections: entry.collections.map(collection => collection.id),
|
|
33
|
+
...committedField(entry),
|
|
34
|
+
status: currentStatus(entry),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Whether two `queued` statuses differ in anything an application can see. */
|
|
38
|
+
export function queuedStatusChanged(previous, status) {
|
|
39
|
+
return previous === undefined
|
|
40
|
+
|| previous.waitingFor !== status.waitingFor
|
|
41
|
+
|| previous.attempts !== status.attempts
|
|
42
|
+
|| previous.inDoubt !== status.inDoubt
|
|
43
|
+
|| previous.lastError !== status.lastError
|
|
44
|
+
// The committed set only grows, so its size says whether it changed.
|
|
45
|
+
|| previous.committedCollections?.length !== status.committedCollections?.length;
|
|
46
|
+
}
|
|
47
|
+
/** The `effect` of a committed entry ({@link CommittedEffect}): `already-applied` exactly when EVERY
|
|
48
|
+
* collection the entry wrote reported a tally and the tallies sum to `alreadyApplied > 0` and
|
|
49
|
+
* `applied === 0`. A collection whose tally was never heard — one committed before a restart, or one
|
|
50
|
+
* a restore found already committed — may have changed rows, so its absence answers `applied`: a
|
|
51
|
+
* remainder that was wholly already applied must not speak for a half that was not. */
|
|
52
|
+
export function effectOf(entry) {
|
|
53
|
+
let total = ZeroTally;
|
|
54
|
+
for (const collection of entry.collections) {
|
|
55
|
+
const tally = entry.applied.get(collection.id);
|
|
56
|
+
if (tally === undefined)
|
|
57
|
+
return 'applied';
|
|
58
|
+
total = addTallies(total, tally);
|
|
59
|
+
}
|
|
60
|
+
return total.alreadyApplied > 0 && total.applied === 0 ? 'already-applied' : 'applied';
|
|
61
|
+
}
|
|
62
|
+
/** The entry's drive state as the journal records it (`IOfflineJournal.driving`): its action id,
|
|
63
|
+
* the attempts retained under it — with `attempts`, the ones about to be sent, laid over them when
|
|
64
|
+
* given — and the collections already committed. Copies, so the journal serialises a state the
|
|
65
|
+
* drain cannot change under it. */
|
|
66
|
+
export function driveState(entry, attempts) {
|
|
67
|
+
return {
|
|
68
|
+
actionId: entry.actionId,
|
|
69
|
+
attempts: new Map([...entry.retained, ...(attempts ?? [])]),
|
|
70
|
+
committed: new Map(entry.committed),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC;AAED;;;mCAGmC;AACnC,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,QAAqD;IAC7F,OAAO;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3D,SAAS,EAAE,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;KACnC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/offline/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/offline/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Action, ActionId } from '../collection/action.js';
|
|
2
|
+
import type { EntryId } from '../collection/segments.js';
|
|
3
|
+
import type { CollectionId, InFlightAttempt } from '../collection/struct.js';
|
|
4
|
+
import type { WriteDurability } from '../network/struct.js';
|
|
5
|
+
import type { EntryStatus } from './status.js';
|
|
6
|
+
/**
|
|
7
|
+
* The port a durable journal fills (docs/offline-sync.md §Persistence): the queue calls it at every
|
|
8
|
+
* moment the design's write ordering names — after sealing and before `queued` is emitted, before
|
|
9
|
+
* each send, after a partial commit, after an identity renewal, and before each terminal status —
|
|
10
|
+
* so a journal can save queued entries to disk without the drain knowing where. It speaks the
|
|
11
|
+
* queue's vocabulary only (entry ids, collection ids, actions, `InFlightAttempt`s): a journal over a
|
|
12
|
+
* key-value store, which also has to name tables, lives with the Quereus plugin, and a `Tree` or
|
|
13
|
+
* `Diary` application with no SQL can journal through this port too. A queue built without a
|
|
14
|
+
* journal behaves exactly as before.
|
|
15
|
+
*/
|
|
16
|
+
/** One entry as the journal records it at enqueue, written once (docs/offline-sync.md §What is
|
|
17
|
+
* journaled). */
|
|
18
|
+
export type JournalEntryRecord = {
|
|
19
|
+
readonly id: EntryId;
|
|
20
|
+
readonly seq: number;
|
|
21
|
+
readonly queuedAt: number;
|
|
22
|
+
readonly expiresAt?: number;
|
|
23
|
+
/** One per collection the entry sealed a segment in, in sealing order: the segment's actions,
|
|
24
|
+
* verbatim — the array the segment holds, which the journal serialises and never mutates. */
|
|
25
|
+
readonly segments: readonly {
|
|
26
|
+
readonly collectionId: CollectionId;
|
|
27
|
+
readonly actions: readonly Action<unknown>[];
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
/** The drive state of an entry: everything that changes between sends and must be on disk before
|
|
31
|
+
* the next one (docs/offline-sync.md §Identity across attempts). */
|
|
32
|
+
export type JournalDriveState = {
|
|
33
|
+
/** The action id the next submission runs under (renewed after `torn-not-saved`). */
|
|
34
|
+
readonly actionId: ActionId;
|
|
35
|
+
/** The attempts recorded under `actionId` and not yet resolved, per collection — the ones a later
|
|
36
|
+
* cycle resumes from. Empty right after a renewal. */
|
|
37
|
+
readonly attempts: ReadonlyMap<CollectionId, InFlightAttempt>;
|
|
38
|
+
/** The collections a partial commit has already committed, with who holds each. */
|
|
39
|
+
readonly committed: ReadonlyMap<CollectionId, WriteDurability | undefined>;
|
|
40
|
+
};
|
|
41
|
+
/** The two terminal statuses, as the journal is told them before they are emitted. */
|
|
42
|
+
export type JournalSettledStatus = Extract<EntryStatus, {
|
|
43
|
+
kind: 'committed' | 'failed';
|
|
44
|
+
}>;
|
|
45
|
+
export interface IOfflineJournal {
|
|
46
|
+
/** Before the entry's `queued` status is emitted and before `enqueue` resolves. A throw or
|
|
47
|
+
* rejection fails the enqueue: the segments are unsealed and nothing is queued. The journal must
|
|
48
|
+
* flush before resolving. */
|
|
49
|
+
queued(record: JournalEntryRecord): Promise<void>;
|
|
50
|
+
/** Before each send, with the attempts about to go; again after a partial commit and after an
|
|
51
|
+
* identity renewal. Before a send, a throw aborts the cycle with nothing sent (the entry stays
|
|
52
|
+
* queued, not in doubt, re-driven after the backoff). After a partial commit or a renewal a throw
|
|
53
|
+
* is logged (`offline:journal-write-failed`) and the drain goes on; the next send's write repeats
|
|
54
|
+
* the state. The journal must flush before resolving. */
|
|
55
|
+
driving(entryId: EntryId, state: JournalDriveState): Promise<void>;
|
|
56
|
+
/** The entry's terminal status, before it is emitted. A throw is logged, never thrown into the
|
|
57
|
+
* drain: the outcome stands, and a restart resolves the stale record
|
|
58
|
+
* (docs/offline-sync.md §Restore after a restart). */
|
|
59
|
+
settled(status: JournalSettledStatus): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=journal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../../src/offline/journal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;GASG;AAEH;iBACiB;AACjB,MAAM,MAAM,kBAAkB,GAAG;IAChC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QA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