@microdelta/history 0.1.0 → 0.2.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/README.md +14 -3
- package/dist/api/history.alpha.d.ts +2 -2
- package/dist/api/history.root.raw.alpha.d.ts +332 -19
- package/dist/api/history.root.raw.beta.d.ts +34 -2
- package/dist/api/history.root.raw.public.d.ts +34 -2
- package/dist/api/history.root.raw.untrimmed.d.ts +332 -19
- package/dist/api/history.shared.alpha.d.ts +328 -17
- package/dist/api/history.shared.beta.d.ts +30 -0
- package/dist/api/history.shared.public.d.ts +30 -0
- package/dist/api/history.shared.untrimmed.d.ts +328 -17
- package/dist/api/history.untrimmed.d.ts +2 -2
- package/dist/src/durable/contracts.d.ts +290 -17
- package/dist/src/durable/contracts.d.ts.map +1 -1
- package/dist/src/durable/errors.d.ts +26 -1
- package/dist/src/durable/errors.d.ts.map +1 -1
- package/dist/src/durable/errors.js +32 -1
- package/dist/src/durable/errors.js.map +1 -1
- package/dist/src/durable/index.d.ts.map +1 -1
- package/dist/src/durable/index.js +275 -95
- package/dist/src/durable/index.js.map +1 -1
- package/dist/src/durable/journal.d.ts +53 -0
- package/dist/src/durable/journal.d.ts.map +1 -0
- package/dist/src/durable/journal.js +174 -0
- package/dist/src/durable/journal.js.map +1 -0
- package/dist/src/durable/records.d.ts +40 -0
- package/dist/src/durable/records.d.ts.map +1 -0
- package/dist/src/durable/records.js +74 -0
- package/dist/src/durable/records.js.map +1 -0
- package/dist/src/durable/schema.d.ts +13 -4
- package/dist/src/durable/schema.d.ts.map +1 -1
- package/dist/src/durable/schema.js +74 -5
- package/dist/src/durable/schema.js.map +1 -1
- package/dist/src/durable/selected-index.d.ts.map +1 -1
- package/dist/src/durable/selected-index.js +3 -1
- package/dist/src/durable/selected-index.js.map +1 -1
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -156,6 +156,8 @@ export declare interface IAcceptanceRecord {
|
|
|
156
156
|
readonly acceptanceId: number;
|
|
157
157
|
/** The accepted exact result. */
|
|
158
158
|
readonly reference: ICompletedResultReference;
|
|
159
|
+
/** The environment namespace whose verification recorded this acceptance. */
|
|
160
|
+
readonly environment: string;
|
|
159
161
|
/** The writer fence under which the acceptance was recorded. */
|
|
160
162
|
readonly fence: number;
|
|
161
163
|
/** Resolution's acceptance evidence, decoded and frozen. */
|
|
@@ -176,8 +178,22 @@ export declare interface IAcceptanceRequest {
|
|
|
176
178
|
readonly reference: ICompletedResultReference;
|
|
177
179
|
/** Resolution's versioned acceptance evidence. */
|
|
178
180
|
readonly evidence: IVersionedRecord;
|
|
179
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Exact completed results the current verification followed. Each must be
|
|
183
|
+
* admissible in the accepting environment: published there, or named by a
|
|
184
|
+
* promotion into it.
|
|
185
|
+
*/
|
|
180
186
|
readonly dependencies: readonly ICompletedResultReference[];
|
|
187
|
+
/**
|
|
188
|
+
* The environment, within the result's analysis, whose current verification
|
|
189
|
+
* accepted the result. It is always explicit and never inferred from the
|
|
190
|
+
* reference: the caller names its own run environment. It may be the
|
|
191
|
+
* environment that published the result, or another environment into which
|
|
192
|
+
* a recorded promotion admits the result. The acceptance then belongs to
|
|
193
|
+
* that environment's namespace alone and never satisfies a lookup in any
|
|
194
|
+
* other environment.
|
|
195
|
+
*/
|
|
196
|
+
readonly environment: string;
|
|
181
197
|
}
|
|
182
198
|
|
|
183
199
|
/** @alpha A path segment whose kind follows the container's operation semantics. */
|
|
@@ -369,6 +385,15 @@ export declare type Identity = {
|
|
|
369
385
|
* larger fence. A host reading that is not a nonnegative safe integer fails
|
|
370
386
|
* the operation without any change. This is a local single-file policy, not a
|
|
371
387
|
* distributed-time or liveness guarantee.
|
|
388
|
+
*
|
|
389
|
+
* Storage contention: every mutation, including acquisition, is one IMMEDIATE
|
|
390
|
+
* SQLite transaction. When another connection, possibly in another process,
|
|
391
|
+
* holds SQLite's write lock past the host's bounded busy wait, nothing
|
|
392
|
+
* changes. Acquisition and renewal, the lease operations a waiter repeats,
|
|
393
|
+
* report it as their `contended` outcome ({@link IWriterContention}), so
|
|
394
|
+
* contention is never mistaken for ownership or staleness (PUB-005). Any other
|
|
395
|
+
* operation fails with Machine's `SqliteBusyError`. Whether to try again is
|
|
396
|
+
* always the caller's policy, never History's.
|
|
372
397
|
* @alpha
|
|
373
398
|
*/
|
|
374
399
|
export declare interface IDurableHistory {
|
|
@@ -376,11 +401,20 @@ export declare interface IDurableHistory {
|
|
|
376
401
|
readonly logicalStore: string;
|
|
377
402
|
/** Exact selected reads over completed results, answered from their generated index. */
|
|
378
403
|
readonly reader: ICompletedResultReader & ICompletedNavigationReader;
|
|
379
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* Acquire the single logical writer, or report the observed unexpired
|
|
406
|
+
* holder, or report storage contention with the recorded writer. Any other
|
|
407
|
+
* failure, such as damaged storage or an unusable clock, is thrown.
|
|
408
|
+
*/
|
|
380
409
|
acquireWriter(request: IWriterAcquisitionRequest): IWriterAcquisition;
|
|
381
|
-
/**
|
|
382
|
-
|
|
383
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Extend a still-valid lease, or report storage contention, which leaves the
|
|
412
|
+
* lease as it was. A stale or expired lease is rejected with
|
|
413
|
+
* `StaleWriterError`. Only the expiry changes: the durable fence is left as
|
|
414
|
+
* it is, never rewritten from the presented lease.
|
|
415
|
+
*/
|
|
416
|
+
renewWriter(lease: IWriterLease, leaseMilliseconds: number): IWriterRenewal;
|
|
417
|
+
/** End a still-valid lease; the durable fence is left as it is, so the next grant still advances it. */
|
|
384
418
|
releaseWriter(lease: IWriterLease): void;
|
|
385
419
|
/** Inspect the recorded holder, if any, without granting authority. */
|
|
386
420
|
currentWriter(): IWriterLease | undefined;
|
|
@@ -403,9 +437,17 @@ export declare interface IDurableHistory {
|
|
|
403
437
|
abandonAttempt(lease: IWriterLease, request: IAbandonRequest): IAttemptRecord;
|
|
404
438
|
/** Report what durably happened to one identified execution, read-only. */
|
|
405
439
|
recoverAttempt(request: IAttemptRequest): IRecoveryOutcome;
|
|
406
|
-
/**
|
|
440
|
+
/**
|
|
441
|
+
* Completed results admissible for one scoped subject and version, latest
|
|
442
|
+
* publication first: those published in the subject's environment and those
|
|
443
|
+
* a recorded promotion admits into it. A promoted result keeps its own exact
|
|
444
|
+
* reference and envelope scope; nothing from any other environment appears.
|
|
445
|
+
*/
|
|
407
446
|
findCandidates(subject: IVersionedSubject): readonly ICompletedEnvelope[];
|
|
408
|
-
/**
|
|
447
|
+
/**
|
|
448
|
+
* The scoped subject's latest publication in its own environment, if any;
|
|
449
|
+
* never rewound by acceptance and never moved by a promotion.
|
|
450
|
+
*/
|
|
409
451
|
readCurrent(subject: IScopedSubject): ICompletedResultReference | undefined;
|
|
410
452
|
/** Read one exact result's metadata without loading its payload. */
|
|
411
453
|
readEnvelope(reference: ICompletedResultReference): ICompletedEnvelope;
|
|
@@ -413,8 +455,25 @@ export declare interface IDurableHistory {
|
|
|
413
455
|
verifyResult(reference: ICompletedResultReference): IResultVerification;
|
|
414
456
|
/** Record a current acceptance of an existing result without touching it or the current pointer. */
|
|
415
457
|
recordAcceptance(lease: IWriterLease, request: IAcceptanceRequest): IAcceptanceRecord;
|
|
416
|
-
/**
|
|
417
|
-
|
|
458
|
+
/**
|
|
459
|
+
* Acceptance records naming one exact result that were recorded in the
|
|
460
|
+
* named environment, in record order. The environment is always explicit:
|
|
461
|
+
* the publishing environment, or one a promotion admits the result into.
|
|
462
|
+
*/
|
|
463
|
+
readAcceptances(reference: ICompletedResultReference, environment: string): readonly IAcceptanceRecord[];
|
|
464
|
+
/**
|
|
465
|
+
* In one commit, record a promotion that admits exact results of other
|
|
466
|
+
* environments into the target environment. Nothing already recorded changes.
|
|
467
|
+
*/
|
|
468
|
+
promoteResults(lease: IWriterLease, request: IPromotionRequest): IPromotionRecord;
|
|
469
|
+
/** Promotion records into one environment, in record order. */
|
|
470
|
+
readPromotions(query: IPromotionQuery): readonly IPromotionRecord[];
|
|
471
|
+
/**
|
|
472
|
+
* Open Run Supervision's operation journal over this store, bound to the
|
|
473
|
+
* declared record formats and versions. The port shares this authority's
|
|
474
|
+
* connection, writer lease and lifetime.
|
|
475
|
+
*/
|
|
476
|
+
openJournal(declaration: IJournalDeclaration): IOperationJournal;
|
|
418
477
|
/** Release the SQLite file; later calls fail. */
|
|
419
478
|
close(): void;
|
|
420
479
|
}
|
|
@@ -443,7 +502,10 @@ export declare interface IDurableHistoryOptions {
|
|
|
443
502
|
* The analysis and environment that scope every subject, attempt and result
|
|
444
503
|
* within one logical store. The same subject text in another analysis or
|
|
445
504
|
* environment is a different scoped subject (RES-001/002). Both are complete
|
|
446
|
-
* opaque non-empty strings compared by exact equality.
|
|
505
|
+
* opaque non-empty strings compared by exact equality. An environment is a
|
|
506
|
+
* namespace within one store (RUN-017): a trial and a production run of the
|
|
507
|
+
* same analysis use different environments of the same file, selected per
|
|
508
|
+
* call rather than process-wide.
|
|
447
509
|
* @alpha
|
|
448
510
|
*/
|
|
449
511
|
export declare interface IHistoryScope {
|
|
@@ -453,14 +515,198 @@ export declare interface IHistoryScope {
|
|
|
453
515
|
readonly environment: string;
|
|
454
516
|
}
|
|
455
517
|
|
|
518
|
+
/**
|
|
519
|
+
* Locates one journal record: its environment namespace, owner-named
|
|
520
|
+
* collection and owner-defined key. The record's identity is exactly this
|
|
521
|
+
* address; its format tag may change between revisions only by
|
|
522
|
+
* compare-and-set.
|
|
523
|
+
* @alpha
|
|
524
|
+
*/
|
|
525
|
+
export declare interface IJournalAddress extends IHistoryScope {
|
|
526
|
+
/** The owner-named non-empty collection, such as Supervision's operations. */
|
|
527
|
+
readonly collection: string;
|
|
528
|
+
/** The owner-defined non-empty key, unique within the namespace and collection. */
|
|
529
|
+
readonly key: string;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* One atomic journal commit in one environment namespace: every write lands
|
|
534
|
+
* in the same transaction, or none does.
|
|
535
|
+
* @alpha
|
|
536
|
+
*/
|
|
537
|
+
export declare interface IJournalCommit extends IHistoryScope {
|
|
538
|
+
/** At least one write, each collection and key pair at most once. */
|
|
539
|
+
readonly writes: readonly IJournalWrite[];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* The formats a journal port is bound to. A stored record of an undeclared
|
|
544
|
+
* format or version is refused rather than returned or overwritten, so a
|
|
545
|
+
* caller never acts on, or clobbers, a record it does not understand.
|
|
546
|
+
* @alpha
|
|
547
|
+
*/
|
|
548
|
+
export declare interface IJournalDeclaration {
|
|
549
|
+
/** At least one declared format, each format named once. */
|
|
550
|
+
readonly formats: readonly IJournalFormat[];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* One owner-defined journal record format and the exact format versions a
|
|
555
|
+
* journal port can read and write. A format is only a record's version tag:
|
|
556
|
+
* it never identifies a record or its collection. History compares the tag
|
|
557
|
+
* and versions for exact equality and never interprets the content.
|
|
558
|
+
* @alpha
|
|
559
|
+
*/
|
|
560
|
+
export declare interface IJournalFormat {
|
|
561
|
+
/** The owner-defined non-empty format identity. */
|
|
562
|
+
readonly format: string;
|
|
563
|
+
/** The positive safe-integer versions of that format this port understands. */
|
|
564
|
+
readonly versions: readonly number[];
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Selects every record of one collection in one environment namespace.
|
|
569
|
+
* @alpha
|
|
570
|
+
*/
|
|
571
|
+
export declare interface IJournalQuery extends IHistoryScope {
|
|
572
|
+
/** The owner-named collection to list. */
|
|
573
|
+
readonly collection: string;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* One immutable revision of a journal record. Revisions of an address start
|
|
578
|
+
* at 1 and increase by one per committed write; earlier revisions are retained
|
|
579
|
+
* and never rewritten.
|
|
580
|
+
* @alpha
|
|
581
|
+
*/
|
|
582
|
+
export declare interface IJournalRecord extends IHistoryScope {
|
|
583
|
+
/** The owner-named collection. */
|
|
584
|
+
readonly collection: string;
|
|
585
|
+
/** The owner-defined key. */
|
|
586
|
+
readonly key: string;
|
|
587
|
+
/** This revision's number within its address, starting at 1. */
|
|
588
|
+
readonly revision: number;
|
|
589
|
+
/** Store-wide never-reused journal write identity, increasing in commit order. */
|
|
590
|
+
readonly sequence: number;
|
|
591
|
+
/** The writer fence under which this revision was committed. */
|
|
592
|
+
readonly fence: number;
|
|
593
|
+
/** The owner-defined record, decoded and frozen, with this revision's version tag. */
|
|
594
|
+
readonly record: IVersionedRecord;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* One compare-and-set write of a journal commit. The expected revision is the
|
|
599
|
+
* revision the caller last read at this address; `0` asserts that the key has
|
|
600
|
+
* never been written in the collection, under any format. The record's
|
|
601
|
+
* format and version are its version tag and must be declared by the port.
|
|
602
|
+
* @alpha
|
|
603
|
+
*/
|
|
604
|
+
export declare interface IJournalWrite {
|
|
605
|
+
/** The owner-named non-empty collection. */
|
|
606
|
+
readonly collection: string;
|
|
607
|
+
/** The owner-defined non-empty key. */
|
|
608
|
+
readonly key: string;
|
|
609
|
+
/** The current revision the write replaces, or `0` for a new key. */
|
|
610
|
+
readonly expectedRevision: number;
|
|
611
|
+
/** The new owner-defined record. */
|
|
612
|
+
readonly record: IVersionedRecord;
|
|
613
|
+
}
|
|
614
|
+
|
|
456
615
|
/** A patch attempted to modify an immutable address or managed CAS version. @public */
|
|
457
616
|
export declare class InvalidStorePatchError extends Error {
|
|
458
617
|
/** Identify a structurally forbidden patch before any columns are changed. @public */
|
|
459
618
|
constructor(message?: string);
|
|
460
619
|
}
|
|
461
620
|
|
|
462
|
-
/**
|
|
463
|
-
|
|
621
|
+
/**
|
|
622
|
+
* A supported observation operation with its own fact meaning. `container-kind`
|
|
623
|
+
* answers record, array or scalar without consuming any container member or
|
|
624
|
+
* scalar content; ordinary scalar reads still retain their literal values.
|
|
625
|
+
* @alpha
|
|
626
|
+
*/
|
|
627
|
+
export declare type IOperation = 'value' | 'own' | 'membership' | 'length' | 'keys' | 'container-kind';
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Run Supervision's operation journal, stored by History (RUN-011/012). It
|
|
631
|
+
* keeps owner-defined operation and deferral records, such as an intent
|
|
632
|
+
* committed before a send or a "not before" deferral, atomically and under
|
|
633
|
+
* writer fencing, without interpreting them: History owns only namespacing,
|
|
634
|
+
* collections, revisions, fencing and the declared-version check. A commit
|
|
635
|
+
* needs the current writer lease and checks holder, fence and unexpired lease
|
|
636
|
+
* in the same transaction as its compare-and-set checks and writes; reads
|
|
637
|
+
* need no lease and never see an uncommitted write.
|
|
638
|
+
* @alpha
|
|
639
|
+
*/
|
|
640
|
+
export declare interface IOperationJournal {
|
|
641
|
+
/** The frozen formats and versions this port was opened with. */
|
|
642
|
+
readonly formats: readonly IJournalFormat[];
|
|
643
|
+
/**
|
|
644
|
+
* Commit every write in one transaction. The whole commit is refused,
|
|
645
|
+
* unchanged, for a stale lease, an undeclared format or version, a current
|
|
646
|
+
* revision whose stored format or version this port does not understand
|
|
647
|
+
* (checked first, since such a caller cannot have read it), or an expected
|
|
648
|
+
* revision that is not the address's current revision.
|
|
649
|
+
*/
|
|
650
|
+
commit(lease: IWriterLease, request: IJournalCommit): readonly IJournalRecord[];
|
|
651
|
+
/** The current revision at one address, or undefined if the key was never written there. */
|
|
652
|
+
read(address: IJournalAddress): IJournalRecord | undefined;
|
|
653
|
+
/** The current revision of every key in one collection, in order of first write. */
|
|
654
|
+
list(query: IJournalQuery): readonly IJournalRecord[];
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Selects promotion records into one target environment, optionally only
|
|
659
|
+
* those naming one exact result.
|
|
660
|
+
* @alpha
|
|
661
|
+
*/
|
|
662
|
+
export declare interface IPromotionQuery {
|
|
663
|
+
/** The analysis and environment whose admitting promotions to read. */
|
|
664
|
+
readonly target: IHistoryScope;
|
|
665
|
+
/** When present, only promotions that name this exact result. */
|
|
666
|
+
readonly reference?: ICompletedResultReference;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* One immutable promotion record. It admits the named results as candidates,
|
|
671
|
+
* dependencies and acceptance targets in its target environment and changes
|
|
672
|
+
* nothing else: each result keeps its exact reference, envelope, provenance
|
|
673
|
+
* and acceptances, and no current head moves in any environment. The target
|
|
674
|
+
* environment's later verifications record their own acceptances.
|
|
675
|
+
* @alpha
|
|
676
|
+
*/
|
|
677
|
+
export declare interface IPromotionRecord {
|
|
678
|
+
/** Store-wide never-reused promotion identity, increasing in record order. */
|
|
679
|
+
readonly promotionId: number;
|
|
680
|
+
/** The analysis and environment the results were admitted into. */
|
|
681
|
+
readonly target: IHistoryScope;
|
|
682
|
+
/** The writer fence under which the promotion was recorded. */
|
|
683
|
+
readonly fence: number;
|
|
684
|
+
/** The promoter's evidence, decoded and frozen. */
|
|
685
|
+
readonly evidence: IVersionedRecord;
|
|
686
|
+
/** The admitted exact results, each in its own publishing scope, in recorded order. */
|
|
687
|
+
readonly references: readonly ICompletedResultReference[];
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Asks History to admit exact completed results of other environments into
|
|
692
|
+
* one target environment of the same analysis (RUN-017). A trial result
|
|
693
|
+
* satisfies a production lookup only through such a recorded promotion. The
|
|
694
|
+
* target names where the results are admitted; each reference keeps naming
|
|
695
|
+
* its own publishing environment. The evidence is the promoter's versioned
|
|
696
|
+
* record of who promoted what and why; History stores it opaquely.
|
|
697
|
+
* @alpha
|
|
698
|
+
*/
|
|
699
|
+
export declare interface IPromotionRequest {
|
|
700
|
+
/** The analysis and environment the results are admitted into. */
|
|
701
|
+
readonly target: IHistoryScope;
|
|
702
|
+
/**
|
|
703
|
+
* Distinct exact completed results of the target's analysis, none published
|
|
704
|
+
* in the target environment, in the promoter's order.
|
|
705
|
+
*/
|
|
706
|
+
readonly references: readonly ICompletedResultReference[];
|
|
707
|
+
/** The promoter's versioned evidence for this promotion. */
|
|
708
|
+
readonly evidence: IVersionedRecord;
|
|
709
|
+
}
|
|
464
710
|
|
|
465
711
|
/**
|
|
466
712
|
* Read-only recovery of one identified execution. Recovery reports what
|
|
@@ -564,7 +810,8 @@ export declare type ISelectedFingerprintResolution = {
|
|
|
564
810
|
* a lazy view, never a whole-object observation, so no member, identity or
|
|
565
811
|
* serialized subtree is implied. Array length is carried so a view need not ask
|
|
566
812
|
* again, but it becomes observation evidence only when a consumer reads it.
|
|
567
|
-
*
|
|
813
|
+
* Shape envelopes are never placed inside {@link ISelectedFact.fact}; Tracking
|
|
814
|
+
* may separately observe the bounded `container-kind` discriminant.
|
|
568
815
|
* @alpha
|
|
569
816
|
*/
|
|
570
817
|
export declare type ISelectedNode =
|
|
@@ -626,7 +873,8 @@ declare interface ISnapshotCapability {
|
|
|
626
873
|
* directory, a missing parent directory, a file that is not a SQLite database,
|
|
627
874
|
* or a location that cannot hold a persistent write-ahead-logged database,
|
|
628
875
|
* including `:memory:` and the empty path. Opening never silently weakens the
|
|
629
|
-
* host's durable configuration.
|
|
876
|
+
* host's durable configuration. Processes that open one new store at the same
|
|
877
|
+
* time all succeed within the bounded busy wait or fail with `SqliteBusyError`.
|
|
630
878
|
* @alpha
|
|
631
879
|
*/
|
|
632
880
|
export declare interface ISqliteCapability {
|
|
@@ -640,7 +888,8 @@ export declare interface ISqliteCapability {
|
|
|
640
888
|
* configuration for every connection: write-ahead logging, FULL synchronous
|
|
641
889
|
* commits, enforced foreign keys and a bounded wait on a locked database.
|
|
642
890
|
* Callers supply every SQL statement and schema; the connection has no
|
|
643
|
-
* knowledge of what the tables mean.
|
|
891
|
+
* knowledge of what the tables mean. A statement, exec or transaction that
|
|
892
|
+
* cannot get a lock within the bounded wait fails with `SqliteBusyError`.
|
|
644
893
|
*
|
|
645
894
|
* Transactions are synchronous, top-level and IMMEDIATE: the write lock is
|
|
646
895
|
* taken before the callback runs, the callback's writes commit together when
|
|
@@ -834,7 +1083,7 @@ export declare interface IVersionedSubject extends IScopedSubject {
|
|
|
834
1083
|
/**
|
|
835
1084
|
* The outcome of asking for the single logical writer. `held` reports an
|
|
836
1085
|
* observed unexpired holder, not a failed compare-and-swap (PUB-005), and
|
|
837
|
-
* grants nothing.
|
|
1086
|
+
* grants nothing; `contended` reports that storage was too busy to decide.
|
|
838
1087
|
* @alpha
|
|
839
1088
|
*/
|
|
840
1089
|
export declare type IWriterAcquisition = {
|
|
@@ -849,7 +1098,7 @@ export declare type IWriterAcquisition = {
|
|
|
849
1098
|
readonly holder: string;
|
|
850
1099
|
/** When that holder's lease expires, in History's clock domain. */
|
|
851
1100
|
readonly expiresAt: number;
|
|
852
|
-
};
|
|
1101
|
+
} | IWriterContention;
|
|
853
1102
|
|
|
854
1103
|
/** A request for the writer lease. @alpha */
|
|
855
1104
|
export declare interface IWriterAcquisitionRequest {
|
|
@@ -859,6 +1108,28 @@ export declare interface IWriterAcquisitionRequest {
|
|
|
859
1108
|
readonly leaseMilliseconds: number;
|
|
860
1109
|
}
|
|
861
1110
|
|
|
1111
|
+
/**
|
|
1112
|
+
* Storage contention on a lease operation: another connection, possibly in
|
|
1113
|
+
* another process, held SQLite's write lock past the host's bounded busy wait,
|
|
1114
|
+
* so History could not decide and changed nothing, not even the clock
|
|
1115
|
+
* high-water. It is a fact about storage, never about ownership (PUB-005): it
|
|
1116
|
+
* neither grants nor refuses, and whether to try again is the caller's policy.
|
|
1117
|
+
* @alpha
|
|
1118
|
+
*/
|
|
1119
|
+
export declare interface IWriterContention {
|
|
1120
|
+
/** History could not take SQLite's write lock in time. */
|
|
1121
|
+
readonly kind: 'contended';
|
|
1122
|
+
/**
|
|
1123
|
+
* The writer recorded at that moment, read without the write lock: its
|
|
1124
|
+
* holder, fence and expiry as stored, whether or not the lease has expired.
|
|
1125
|
+
* Undefined when no holder is recorded, or when that read was itself busy;
|
|
1126
|
+
* History never guesses a holder.
|
|
1127
|
+
*/
|
|
1128
|
+
readonly writer: IWriterLease | undefined;
|
|
1129
|
+
/** The host's diagnostic of the contention; it carries no stored values. */
|
|
1130
|
+
readonly detail: string;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
862
1133
|
/**
|
|
863
1134
|
* Proof of current single-logical-writer ownership. The holder is an opaque
|
|
864
1135
|
* caller identity; the fence is the store-wide token issued at acquisition,
|
|
@@ -877,6 +1148,46 @@ export declare interface IWriterLease {
|
|
|
877
1148
|
readonly expiresAt: number;
|
|
878
1149
|
}
|
|
879
1150
|
|
|
1151
|
+
/**
|
|
1152
|
+
* The outcome of renewing a lease the caller holds: `renewed` with the later
|
|
1153
|
+
* expiry, or `contended` when storage was too busy to decide, in which case
|
|
1154
|
+
* the lease is exactly as it was and is neither renewed nor refused. A stale
|
|
1155
|
+
* or expired lease is not an outcome but a refusal (`StaleWriterError`).
|
|
1156
|
+
* @alpha
|
|
1157
|
+
*/
|
|
1158
|
+
export declare type IWriterRenewal = {
|
|
1159
|
+
/** The lease was extended. */
|
|
1160
|
+
readonly kind: 'renewed';
|
|
1161
|
+
/** The same holder and fence with the new expiry. */
|
|
1162
|
+
readonly lease: IWriterLease;
|
|
1163
|
+
} | IWriterContention;
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* A journal commit's compare-and-set expectation does not hold: the presented
|
|
1167
|
+
* expected revision is not the key's current revision (a new-key expectation
|
|
1168
|
+
* met an existing key, or an update met a later or absent revision). The
|
|
1169
|
+
* whole commit was rolled back unchanged; the caller must re-read before
|
|
1170
|
+
* deciding again.
|
|
1171
|
+
* @alpha
|
|
1172
|
+
*/
|
|
1173
|
+
export declare class JournalConflictError extends Error {
|
|
1174
|
+
/** Create a compare-and-set rejection with a diagnostic message. */
|
|
1175
|
+
constructor(message: string);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* A journal record's format or format version is not one the journal port
|
|
1180
|
+
* declared. On a write the record is refused; on a read or list the stored
|
|
1181
|
+
* record is refused rather than returned; a commit over a current revision of
|
|
1182
|
+
* an undeclared version is refused rather than overwriting it. History never
|
|
1183
|
+
* interprets or converts the content of another format version.
|
|
1184
|
+
* @alpha
|
|
1185
|
+
*/
|
|
1186
|
+
export declare class JournalVersionError extends Error {
|
|
1187
|
+
/** Create an undeclared-version refusal with a diagnostic message. */
|
|
1188
|
+
constructor(message: string);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
880
1191
|
/** Options for the isolated, non-durable test backend. @public */
|
|
881
1192
|
export declare interface MemoryStoreOptions {
|
|
882
1193
|
/** Metadata compatibility identifier; the initial store format uses sha256. */
|
|
@@ -151,6 +151,20 @@ export declare type Identity = {
|
|
|
151
151
|
|
|
152
152
|
/* Excluded from this release type: IHistoryScope */
|
|
153
153
|
|
|
154
|
+
/* Excluded from this release type: IJournalAddress */
|
|
155
|
+
|
|
156
|
+
/* Excluded from this release type: IJournalCommit */
|
|
157
|
+
|
|
158
|
+
/* Excluded from this release type: IJournalDeclaration */
|
|
159
|
+
|
|
160
|
+
/* Excluded from this release type: IJournalFormat */
|
|
161
|
+
|
|
162
|
+
/* Excluded from this release type: IJournalQuery */
|
|
163
|
+
|
|
164
|
+
/* Excluded from this release type: IJournalRecord */
|
|
165
|
+
|
|
166
|
+
/* Excluded from this release type: IJournalWrite */
|
|
167
|
+
|
|
154
168
|
/** A patch attempted to modify an immutable address or managed CAS version. @public */
|
|
155
169
|
export declare class InvalidStorePatchError extends Error {
|
|
156
170
|
/** Identify a structurally forbidden patch before any columns are changed. @public */
|
|
@@ -159,6 +173,14 @@ export declare class InvalidStorePatchError extends Error {
|
|
|
159
173
|
|
|
160
174
|
/* Excluded from this release type: IOperation */
|
|
161
175
|
|
|
176
|
+
/* Excluded from this release type: IOperationJournal */
|
|
177
|
+
|
|
178
|
+
/* Excluded from this release type: IPromotionQuery */
|
|
179
|
+
|
|
180
|
+
/* Excluded from this release type: IPromotionRecord */
|
|
181
|
+
|
|
182
|
+
/* Excluded from this release type: IPromotionRequest */
|
|
183
|
+
|
|
162
184
|
/* Excluded from this release type: IRecoveryOutcome */
|
|
163
185
|
|
|
164
186
|
/* Excluded from this release type: IResultVerification */
|
|
@@ -225,8 +247,16 @@ declare interface ISnapshotCapability {
|
|
|
225
247
|
|
|
226
248
|
/* Excluded from this release type: IWriterAcquisitionRequest */
|
|
227
249
|
|
|
250
|
+
/* Excluded from this release type: IWriterContention */
|
|
251
|
+
|
|
228
252
|
/* Excluded from this release type: IWriterLease */
|
|
229
253
|
|
|
254
|
+
/* Excluded from this release type: IWriterRenewal */
|
|
255
|
+
|
|
256
|
+
/* Excluded from this release type: JournalConflictError */
|
|
257
|
+
|
|
258
|
+
/* Excluded from this release type: JournalVersionError */
|
|
259
|
+
|
|
230
260
|
/** Options for the isolated, non-durable test backend. @public */
|
|
231
261
|
export declare interface MemoryStoreOptions {
|
|
232
262
|
/** Metadata compatibility identifier; the initial store format uses sha256. */
|
|
@@ -151,6 +151,20 @@ export declare type Identity = {
|
|
|
151
151
|
|
|
152
152
|
/* Excluded from this release type: IHistoryScope */
|
|
153
153
|
|
|
154
|
+
/* Excluded from this release type: IJournalAddress */
|
|
155
|
+
|
|
156
|
+
/* Excluded from this release type: IJournalCommit */
|
|
157
|
+
|
|
158
|
+
/* Excluded from this release type: IJournalDeclaration */
|
|
159
|
+
|
|
160
|
+
/* Excluded from this release type: IJournalFormat */
|
|
161
|
+
|
|
162
|
+
/* Excluded from this release type: IJournalQuery */
|
|
163
|
+
|
|
164
|
+
/* Excluded from this release type: IJournalRecord */
|
|
165
|
+
|
|
166
|
+
/* Excluded from this release type: IJournalWrite */
|
|
167
|
+
|
|
154
168
|
/** A patch attempted to modify an immutable address or managed CAS version. @public */
|
|
155
169
|
export declare class InvalidStorePatchError extends Error {
|
|
156
170
|
/** Identify a structurally forbidden patch before any columns are changed. @public */
|
|
@@ -159,6 +173,14 @@ export declare class InvalidStorePatchError extends Error {
|
|
|
159
173
|
|
|
160
174
|
/* Excluded from this release type: IOperation */
|
|
161
175
|
|
|
176
|
+
/* Excluded from this release type: IOperationJournal */
|
|
177
|
+
|
|
178
|
+
/* Excluded from this release type: IPromotionQuery */
|
|
179
|
+
|
|
180
|
+
/* Excluded from this release type: IPromotionRecord */
|
|
181
|
+
|
|
182
|
+
/* Excluded from this release type: IPromotionRequest */
|
|
183
|
+
|
|
162
184
|
/* Excluded from this release type: IRecoveryOutcome */
|
|
163
185
|
|
|
164
186
|
/* Excluded from this release type: IResultVerification */
|
|
@@ -225,8 +247,16 @@ declare interface ISnapshotCapability {
|
|
|
225
247
|
|
|
226
248
|
/* Excluded from this release type: IWriterAcquisitionRequest */
|
|
227
249
|
|
|
250
|
+
/* Excluded from this release type: IWriterContention */
|
|
251
|
+
|
|
228
252
|
/* Excluded from this release type: IWriterLease */
|
|
229
253
|
|
|
254
|
+
/* Excluded from this release type: IWriterRenewal */
|
|
255
|
+
|
|
256
|
+
/* Excluded from this release type: JournalConflictError */
|
|
257
|
+
|
|
258
|
+
/* Excluded from this release type: JournalVersionError */
|
|
259
|
+
|
|
230
260
|
/** Options for the isolated, non-durable test backend. @public */
|
|
231
261
|
export declare interface MemoryStoreOptions {
|
|
232
262
|
/** Metadata compatibility identifier; the initial store format uses sha256. */
|