@smthrs/engine-store 0.0.0-stage → 1.0.0-rc.4
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/CHANGELOG.md +247 -0
- package/LICENSE +21 -0
- package/README.md +146 -2
- package/dist/cjs/ArtifactGc.d.ts +235 -0
- package/dist/cjs/ArtifactGc.d.ts.map +1 -0
- package/dist/cjs/ArtifactGc.js +183 -0
- package/dist/cjs/ArtifactGc.js.map +7 -0
- package/dist/cjs/ArtifactSync.d.ts +164 -0
- package/dist/cjs/ArtifactSync.d.ts.map +1 -0
- package/dist/cjs/ArtifactSync.js +144 -0
- package/dist/cjs/ArtifactSync.js.map +7 -0
- package/dist/cjs/CacheSync.d.ts +112 -0
- package/dist/cjs/CacheSync.d.ts.map +1 -0
- package/dist/cjs/CacheSync.js +64 -0
- package/dist/cjs/CacheSync.js.map +7 -0
- package/dist/cjs/DeferredClockFold.d.ts +354 -0
- package/dist/cjs/DeferredClockFold.d.ts.map +1 -0
- package/dist/cjs/DeferredClockFold.js +335 -0
- package/dist/cjs/DeferredClockFold.js.map +7 -0
- package/dist/cjs/DisasterRecovery.d.ts +431 -0
- package/dist/cjs/DisasterRecovery.d.ts.map +1 -0
- package/dist/cjs/DisasterRecovery.js +453 -0
- package/dist/cjs/DisasterRecovery.js.map +7 -0
- package/dist/cjs/DurableEngineState.d.ts +776 -0
- package/dist/cjs/DurableEngineState.d.ts.map +1 -0
- package/dist/cjs/DurableEngineState.js +1536 -0
- package/dist/cjs/DurableEngineState.js.map +7 -0
- package/dist/cjs/EngineStore.d.ts +158 -0
- package/dist/cjs/EngineStore.d.ts.map +1 -0
- package/dist/cjs/EngineStore.js +398 -0
- package/dist/cjs/EngineStore.js.map +7 -0
- package/dist/cjs/EngineStoreMetrics.d.ts +276 -0
- package/dist/cjs/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/cjs/EngineStoreMetrics.js +135 -0
- package/dist/cjs/EngineStoreMetrics.js.map +7 -0
- package/dist/cjs/Errors.d.ts +22 -0
- package/dist/cjs/Errors.d.ts.map +1 -0
- package/dist/cjs/Errors.js +39 -0
- package/dist/cjs/Errors.js.map +7 -0
- package/dist/cjs/EventTypes.d.ts +27 -0
- package/dist/cjs/EventTypes.d.ts.map +1 -0
- package/dist/cjs/EventTypes.js +37 -0
- package/dist/cjs/EventTypes.js.map +7 -0
- package/dist/cjs/ExecutionFacts.d.ts +59 -0
- package/dist/cjs/ExecutionFacts.d.ts.map +1 -0
- package/dist/cjs/ExecutionFacts.js +123 -0
- package/dist/cjs/ExecutionFacts.js.map +7 -0
- package/dist/cjs/ExecutionSnapshot.d.ts +117 -0
- package/dist/cjs/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/cjs/ExecutionSnapshot.js +111 -0
- package/dist/cjs/ExecutionSnapshot.js.map +7 -0
- package/dist/cjs/Inconsistency.d.ts +154 -0
- package/dist/cjs/Inconsistency.d.ts.map +1 -0
- package/dist/cjs/Inconsistency.js +135 -0
- package/dist/cjs/Inconsistency.js.map +7 -0
- package/dist/cjs/Migrations.d.ts +56 -0
- package/dist/cjs/Migrations.d.ts.map +1 -0
- package/dist/cjs/Migrations.js +78 -0
- package/dist/cjs/Migrations.js.map +7 -0
- package/dist/cjs/OwnerIdentity.d.ts +91 -0
- package/dist/cjs/OwnerIdentity.d.ts.map +1 -0
- package/dist/cjs/OwnerIdentity.js +65 -0
- package/dist/cjs/OwnerIdentity.js.map +7 -0
- package/dist/cjs/PlanInputStore.d.ts +110 -0
- package/dist/cjs/PlanInputStore.d.ts.map +1 -0
- package/dist/cjs/PlanInputStore.js +224 -0
- package/dist/cjs/PlanInputStore.js.map +7 -0
- package/dist/cjs/PlanMergeStore.d.ts +113 -0
- package/dist/cjs/PlanMergeStore.d.ts.map +1 -0
- package/dist/cjs/PlanMergeStore.js +255 -0
- package/dist/cjs/PlanMergeStore.js.map +7 -0
- package/dist/cjs/PlanScheduler.d.ts +363 -0
- package/dist/cjs/PlanScheduler.d.ts.map +1 -0
- package/dist/cjs/PlanScheduler.js +1090 -0
- package/dist/cjs/PlanScheduler.js.map +7 -0
- package/dist/cjs/Reconciliation.d.ts +175 -0
- package/dist/cjs/Reconciliation.d.ts.map +1 -0
- package/dist/cjs/Reconciliation.js +119 -0
- package/dist/cjs/Reconciliation.js.map +7 -0
- package/dist/cjs/ReplayOnly.d.ts +91 -0
- package/dist/cjs/ReplayOnly.d.ts.map +1 -0
- package/dist/cjs/ReplayOnly.js +52 -0
- package/dist/cjs/ReplayOnly.js.map +7 -0
- package/dist/cjs/Retention.d.ts +113 -0
- package/dist/cjs/Retention.d.ts.map +1 -0
- package/dist/cjs/Retention.js +99 -0
- package/dist/cjs/Retention.js.map +7 -0
- package/dist/cjs/RunCatalogRead.d.ts +17 -0
- package/dist/cjs/RunCatalogRead.d.ts.map +1 -0
- package/dist/cjs/RunCatalogRead.js +33 -0
- package/dist/cjs/RunCatalogRead.js.map +7 -0
- package/dist/cjs/RunChangeFeed.d.ts +75 -0
- package/dist/cjs/RunChangeFeed.d.ts.map +1 -0
- package/dist/cjs/RunChangeFeed.js +96 -0
- package/dist/cjs/RunChangeFeed.js.map +7 -0
- package/dist/cjs/RunState.d.ts +116 -0
- package/dist/cjs/RunState.d.ts.map +1 -0
- package/dist/cjs/RunState.js +76 -0
- package/dist/cjs/RunState.js.map +7 -0
- package/dist/cjs/Selection.d.ts +495 -0
- package/dist/cjs/Selection.d.ts.map +1 -0
- package/dist/cjs/Selection.js +288 -0
- package/dist/cjs/Selection.js.map +7 -0
- package/dist/cjs/SelectionStore.d.ts +141 -0
- package/dist/cjs/SelectionStore.d.ts.map +1 -0
- package/dist/cjs/SelectionStore.js +229 -0
- package/dist/cjs/SelectionStore.js.map +7 -0
- package/dist/cjs/StepBoundary.d.ts +501 -0
- package/dist/cjs/StepBoundary.d.ts.map +1 -0
- package/dist/cjs/StepBoundary.js +619 -0
- package/dist/cjs/StepBoundary.js.map +7 -0
- package/dist/cjs/StepCacheFold.d.ts +148 -0
- package/dist/cjs/StepCacheFold.d.ts.map +1 -0
- package/dist/cjs/StepCacheFold.js +131 -0
- package/dist/cjs/StepCacheFold.js.map +7 -0
- package/dist/cjs/StepSandbox.d.ts +78 -0
- package/dist/cjs/StepSandbox.d.ts.map +1 -0
- package/dist/cjs/StepSandbox.js +75 -0
- package/dist/cjs/StepSandbox.js.map +7 -0
- package/dist/cjs/WakeBus.d.ts +116 -0
- package/dist/cjs/WakeBus.d.ts.map +1 -0
- package/dist/cjs/WakeBus.js +89 -0
- package/dist/cjs/WakeBus.js.map +7 -0
- package/dist/cjs/WorkspaceSandbox.d.ts +619 -0
- package/dist/cjs/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/cjs/WorkspaceSandbox.js +711 -0
- package/dist/cjs/WorkspaceSandbox.js.map +7 -0
- package/dist/cjs/index.d.ts +157 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +95 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ActionPersistence.d.ts +276 -0
- package/dist/cjs/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/ActionPersistence.js +1395 -0
- package/dist/cjs/internal/ActionPersistence.js.map +7 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts +38 -0
- package/dist/cjs/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/cjs/internal/ArtifactRoots.js +89 -0
- package/dist/cjs/internal/ArtifactRoots.js.map +7 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts +53 -0
- package/dist/cjs/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptAdmission.js +52 -0
- package/dist/cjs/internal/AttemptAdmission.js.map +7 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/cjs/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptLifecycle.js +112 -0
- package/dist/cjs/internal/AttemptLifecycle.js.map +7 -0
- package/dist/cjs/internal/AttemptProbe.d.ts +53 -0
- package/dist/cjs/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/cjs/internal/AttemptProbe.js +66 -0
- package/dist/cjs/internal/AttemptProbe.js.map +7 -0
- package/dist/cjs/internal/CacheAdmission.d.ts +79 -0
- package/dist/cjs/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAdmission.js +71 -0
- package/dist/cjs/internal/CacheAdmission.js.map +7 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/cjs/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeHistory.js +61 -0
- package/dist/cjs/internal/CacheAgeHistory.js.map +7 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/cjs/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js +73 -0
- package/dist/cjs/internal/CacheAgeVerdicts.js.map +7 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/cjs/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/cjs/internal/CacheOutputPolicy.js +75 -0
- package/dist/cjs/internal/CacheOutputPolicy.js.map +7 -0
- package/dist/cjs/internal/CachePublication.d.ts +97 -0
- package/dist/cjs/internal/CachePublication.d.ts.map +1 -0
- package/dist/cjs/internal/CachePublication.js +80 -0
- package/dist/cjs/internal/CachePublication.js.map +7 -0
- package/dist/cjs/internal/CallFacts.d.ts +15 -0
- package/dist/cjs/internal/CallFacts.d.ts.map +1 -0
- package/dist/cjs/internal/CallFacts.js +97 -0
- package/dist/cjs/internal/CallFacts.js.map +7 -0
- package/dist/cjs/internal/CopiedRecord.d.ts +61 -0
- package/dist/cjs/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/cjs/internal/CopiedRecord.js +134 -0
- package/dist/cjs/internal/CopiedRecord.js.map +7 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts +108 -0
- package/dist/cjs/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/cjs/internal/DeferredPersistence.js +270 -0
- package/dist/cjs/internal/DeferredPersistence.js.map +7 -0
- package/dist/cjs/internal/EffectRecords.d.ts +92 -0
- package/dist/cjs/internal/EffectRecords.d.ts.map +1 -0
- package/dist/cjs/internal/EffectRecords.js +63 -0
- package/dist/cjs/internal/EffectRecords.js.map +7 -0
- package/dist/cjs/internal/EngineJj.d.ts +30 -0
- package/dist/cjs/internal/EngineJj.d.ts.map +1 -0
- package/dist/cjs/internal/EngineJj.js +42 -0
- package/dist/cjs/internal/EngineJj.js.map +7 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts +68 -0
- package/dist/cjs/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/cjs/internal/EngineStateSchema.js +58 -0
- package/dist/cjs/internal/EngineStateSchema.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js +201 -0
- package/dist/cjs/internal/ExecutionSnapshotRead.js.map +7 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js +105 -0
- package/dist/cjs/internal/ExecutionSnapshotRelations.js.map +7 -0
- package/dist/cjs/internal/ExitEncoding.d.ts +180 -0
- package/dist/cjs/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/cjs/internal/ExitEncoding.js +236 -0
- package/dist/cjs/internal/ExitEncoding.js.map +7 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/cjs/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js +51 -0
- package/dist/cjs/internal/FileBoundarySnapshot.js.map +7 -0
- package/dist/cjs/internal/FileEnumeration.d.ts +127 -0
- package/dist/cjs/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/cjs/internal/FileEnumeration.js +194 -0
- package/dist/cjs/internal/FileEnumeration.js.map +7 -0
- package/dist/cjs/internal/HostReflection.d.ts +80 -0
- package/dist/cjs/internal/HostReflection.d.ts.map +1 -0
- package/dist/cjs/internal/HostReflection.js +43 -0
- package/dist/cjs/internal/HostReflection.js.map +7 -0
- package/dist/cjs/internal/JournalRecords.d.ts +325 -0
- package/dist/cjs/internal/JournalRecords.d.ts.map +1 -0
- package/dist/cjs/internal/JournalRecords.js +122 -0
- package/dist/cjs/internal/JournalRecords.js.map +7 -0
- package/dist/cjs/internal/NodeJournal.d.ts +157 -0
- package/dist/cjs/internal/NodeJournal.d.ts.map +1 -0
- package/dist/cjs/internal/NodeJournal.js +192 -0
- package/dist/cjs/internal/NodeJournal.js.map +7 -0
- package/dist/cjs/internal/Ordering.d.ts +14 -0
- package/dist/cjs/internal/Ordering.d.ts.map +1 -0
- package/dist/cjs/internal/Ordering.js +25 -0
- package/dist/cjs/internal/Ordering.js.map +7 -0
- package/dist/cjs/internal/PlanInputs.d.ts +14 -0
- package/dist/cjs/internal/PlanInputs.d.ts.map +1 -0
- package/dist/cjs/internal/PlanInputs.js +78 -0
- package/dist/cjs/internal/PlanInputs.js.map +7 -0
- package/dist/cjs/internal/PlanMerges.d.ts +178 -0
- package/dist/cjs/internal/PlanMerges.d.ts.map +1 -0
- package/dist/cjs/internal/PlanMerges.js +125 -0
- package/dist/cjs/internal/PlanMerges.js.map +7 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/cjs/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/cjs/internal/ProvenanceSlot.js +53 -0
- package/dist/cjs/internal/ProvenanceSlot.js.map +7 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts +88 -0
- package/dist/cjs/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/cjs/internal/ResultEnvelope.js +90 -0
- package/dist/cjs/internal/ResultEnvelope.js.map +7 -0
- package/dist/cjs/internal/RetentionOps.d.ts +414 -0
- package/dist/cjs/internal/RetentionOps.d.ts.map +1 -0
- package/dist/cjs/internal/RetentionOps.js +354 -0
- package/dist/cjs/internal/RetentionOps.js.map +7 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts +118 -0
- package/dist/cjs/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/cjs/internal/RunCatalogOps.js +85 -0
- package/dist/cjs/internal/RunCatalogOps.js.map +7 -0
- package/dist/cjs/internal/RunCoordinator.d.ts +78 -0
- package/dist/cjs/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/cjs/internal/RunCoordinator.js +123 -0
- package/dist/cjs/internal/RunCoordinator.js.map +7 -0
- package/dist/cjs/internal/RunDriver.d.ts +192 -0
- package/dist/cjs/internal/RunDriver.d.ts.map +1 -0
- package/dist/cjs/internal/RunDriver.js +1586 -0
- package/dist/cjs/internal/RunDriver.js.map +7 -0
- package/dist/cjs/internal/RunLifecycle.d.ts +22 -0
- package/dist/cjs/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/cjs/internal/RunLifecycle.js +63 -0
- package/dist/cjs/internal/RunLifecycle.js.map +7 -0
- package/dist/cjs/internal/RunListing.d.ts +78 -0
- package/dist/cjs/internal/RunListing.d.ts.map +1 -0
- package/dist/cjs/internal/RunListing.js +171 -0
- package/dist/cjs/internal/RunListing.js.map +7 -0
- package/dist/cjs/internal/RunListingError.d.ts +35 -0
- package/dist/cjs/internal/RunListingError.d.ts.map +1 -0
- package/dist/cjs/internal/RunListingError.js +47 -0
- package/dist/cjs/internal/RunListingError.js.map +7 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts +73 -0
- package/dist/cjs/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/cjs/internal/RuntimeGraph.js +180 -0
- package/dist/cjs/internal/RuntimeGraph.js.map +7 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts +80 -0
- package/dist/cjs/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/cjs/internal/SandboxedExecution.js +104 -0
- package/dist/cjs/internal/SandboxedExecution.js.map +7 -0
- package/dist/cjs/internal/StateTransaction.d.ts +44 -0
- package/dist/cjs/internal/StateTransaction.d.ts.map +1 -0
- package/dist/cjs/internal/StateTransaction.js +52 -0
- package/dist/cjs/internal/StateTransaction.js.map +7 -0
- package/dist/cjs/internal/StepFacts.d.ts +14 -0
- package/dist/cjs/internal/StepFacts.d.ts.map +1 -0
- package/dist/cjs/internal/StepFacts.js +58 -0
- package/dist/cjs/internal/StepFacts.js.map +7 -0
- package/dist/cjs/internal/TypedEvents.d.ts +14 -0
- package/dist/cjs/internal/TypedEvents.d.ts.map +1 -0
- package/dist/cjs/internal/TypedEvents.js +37 -0
- package/dist/cjs/internal/TypedEvents.js.map +7 -0
- package/dist/cjs/migrations/0001_initial.d.ts +17 -0
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -0
- package/dist/cjs/migrations/0001_initial.js +61 -0
- package/dist/cjs/migrations/0001_initial.js.map +7 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts +15 -0
- package/dist/cjs/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/cjs/migrations/0002_selection_store.js +56 -0
- package/dist/cjs/migrations/0002_selection_store.js.map +7 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/cjs/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/cjs/migrations/0003_plan_inputs.js +90 -0
- package/dist/cjs/migrations/0003_plan_inputs.js.map +7 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/cjs/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/cjs/migrations/0004_plan_environment.js +56 -0
- package/dist/cjs/migrations/0004_plan_environment.js.map +7 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/cjs/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/cjs/migrations/0005_plan_merges.js +82 -0
- package/dist/cjs/migrations/0005_plan_merges.js.map +7 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/cjs/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/cjs/migrations/0006_execution_listing.js +101 -0
- package/dist/cjs/migrations/0006_execution_listing.js.map +7 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js +40 -0
- package/dist/cjs/migrations/0007_run_parent_sequence.js.map +7 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js +45 -0
- package/dist/cjs/migrations/0008_deferred_consumption.js.map +7 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js +141 -0
- package/dist/cjs/migrations/0009_deferred_clock_facts.js.map +7 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js +41 -0
- package/dist/cjs/migrations/0010_pending_cancellation.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/TestStores.d.ts +89 -0
- package/dist/cjs/test/TestStores.d.ts.map +1 -0
- package/dist/cjs/test/TestStores.js +98 -0
- package/dist/cjs/test/TestStores.js.map +7 -0
- package/dist/esm/ArtifactGc.d.ts +235 -0
- package/dist/esm/ArtifactGc.d.ts.map +1 -0
- package/dist/esm/ArtifactGc.js +268 -0
- package/dist/esm/ArtifactGc.js.map +1 -0
- package/dist/esm/ArtifactSync.d.ts +164 -0
- package/dist/esm/ArtifactSync.d.ts.map +1 -0
- package/dist/esm/ArtifactSync.js +176 -0
- package/dist/esm/ArtifactSync.js.map +1 -0
- package/dist/esm/CacheSync.d.ts +112 -0
- package/dist/esm/CacheSync.d.ts.map +1 -0
- package/dist/esm/CacheSync.js +94 -0
- package/dist/esm/CacheSync.js.map +1 -0
- package/dist/esm/DeferredClockFold.d.ts +354 -0
- package/dist/esm/DeferredClockFold.d.ts.map +1 -0
- package/dist/esm/DeferredClockFold.js +472 -0
- package/dist/esm/DeferredClockFold.js.map +1 -0
- package/dist/esm/DisasterRecovery.d.ts +431 -0
- package/dist/esm/DisasterRecovery.d.ts.map +1 -0
- package/dist/esm/DisasterRecovery.js +523 -0
- package/dist/esm/DisasterRecovery.js.map +1 -0
- package/dist/esm/DurableEngineState.d.ts +776 -0
- package/dist/esm/DurableEngineState.d.ts.map +1 -0
- package/dist/esm/DurableEngineState.js +1648 -0
- package/dist/esm/DurableEngineState.js.map +1 -0
- package/dist/esm/EngineStore.d.ts +158 -0
- package/dist/esm/EngineStore.d.ts.map +1 -0
- package/dist/esm/EngineStore.js +403 -0
- package/dist/esm/EngineStore.js.map +1 -0
- package/dist/esm/EngineStoreMetrics.d.ts +276 -0
- package/dist/esm/EngineStoreMetrics.d.ts.map +1 -0
- package/dist/esm/EngineStoreMetrics.js +260 -0
- package/dist/esm/EngineStoreMetrics.js.map +1 -0
- package/dist/esm/Errors.d.ts +22 -0
- package/dist/esm/Errors.d.ts.map +1 -0
- package/dist/esm/Errors.js +22 -0
- package/dist/esm/Errors.js.map +1 -0
- package/dist/esm/EventTypes.d.ts +27 -0
- package/dist/esm/EventTypes.d.ts.map +1 -0
- package/dist/esm/EventTypes.js +27 -0
- package/dist/esm/EventTypes.js.map +1 -0
- package/dist/esm/ExecutionFacts.d.ts +59 -0
- package/dist/esm/ExecutionFacts.d.ts.map +1 -0
- package/dist/esm/ExecutionFacts.js +96 -0
- package/dist/esm/ExecutionFacts.js.map +1 -0
- package/dist/esm/ExecutionSnapshot.d.ts +117 -0
- package/dist/esm/ExecutionSnapshot.d.ts.map +1 -0
- package/dist/esm/ExecutionSnapshot.js +95 -0
- package/dist/esm/ExecutionSnapshot.js.map +1 -0
- package/dist/esm/Inconsistency.d.ts +154 -0
- package/dist/esm/Inconsistency.d.ts.map +1 -0
- package/dist/esm/Inconsistency.js +133 -0
- package/dist/esm/Inconsistency.js.map +1 -0
- package/dist/esm/Migrations.d.ts +56 -0
- package/dist/esm/Migrations.d.ts.map +1 -0
- package/dist/esm/Migrations.js +91 -0
- package/dist/esm/Migrations.js.map +1 -0
- package/dist/esm/OwnerIdentity.d.ts +91 -0
- package/dist/esm/OwnerIdentity.d.ts.map +1 -0
- package/dist/esm/OwnerIdentity.js +99 -0
- package/dist/esm/OwnerIdentity.js.map +1 -0
- package/dist/esm/PlanInputStore.d.ts +110 -0
- package/dist/esm/PlanInputStore.d.ts.map +1 -0
- package/dist/esm/PlanInputStore.js +207 -0
- package/dist/esm/PlanInputStore.js.map +1 -0
- package/dist/esm/PlanMergeStore.d.ts +113 -0
- package/dist/esm/PlanMergeStore.d.ts.map +1 -0
- package/dist/esm/PlanMergeStore.js +244 -0
- package/dist/esm/PlanMergeStore.js.map +1 -0
- package/dist/esm/PlanScheduler.d.ts +363 -0
- package/dist/esm/PlanScheduler.d.ts.map +1 -0
- package/dist/esm/PlanScheduler.js +1321 -0
- package/dist/esm/PlanScheduler.js.map +1 -0
- package/dist/esm/Reconciliation.d.ts +175 -0
- package/dist/esm/Reconciliation.d.ts.map +1 -0
- package/dist/esm/Reconciliation.js +175 -0
- package/dist/esm/Reconciliation.js.map +1 -0
- package/dist/esm/ReplayOnly.d.ts +91 -0
- package/dist/esm/ReplayOnly.d.ts.map +1 -0
- package/dist/esm/ReplayOnly.js +59 -0
- package/dist/esm/ReplayOnly.js.map +1 -0
- package/dist/esm/Retention.d.ts +113 -0
- package/dist/esm/Retention.d.ts.map +1 -0
- package/dist/esm/Retention.js +139 -0
- package/dist/esm/Retention.js.map +1 -0
- package/dist/esm/RunCatalogRead.d.ts +17 -0
- package/dist/esm/RunCatalogRead.d.ts.map +1 -0
- package/dist/esm/RunCatalogRead.js +17 -0
- package/dist/esm/RunCatalogRead.js.map +1 -0
- package/dist/esm/RunChangeFeed.d.ts +75 -0
- package/dist/esm/RunChangeFeed.d.ts.map +1 -0
- package/dist/esm/RunChangeFeed.js +81 -0
- package/dist/esm/RunChangeFeed.js.map +1 -0
- package/dist/esm/RunState.d.ts +116 -0
- package/dist/esm/RunState.d.ts.map +1 -0
- package/dist/esm/RunState.js +109 -0
- package/dist/esm/RunState.js.map +1 -0
- package/dist/esm/Selection.d.ts +495 -0
- package/dist/esm/Selection.d.ts.map +1 -0
- package/dist/esm/Selection.js +482 -0
- package/dist/esm/Selection.js.map +1 -0
- package/dist/esm/SelectionStore.d.ts +141 -0
- package/dist/esm/SelectionStore.d.ts.map +1 -0
- package/dist/esm/SelectionStore.js +215 -0
- package/dist/esm/SelectionStore.js.map +1 -0
- package/dist/esm/StepBoundary.d.ts +501 -0
- package/dist/esm/StepBoundary.d.ts.map +1 -0
- package/dist/esm/StepBoundary.js +919 -0
- package/dist/esm/StepBoundary.js.map +1 -0
- package/dist/esm/StepCacheFold.d.ts +148 -0
- package/dist/esm/StepCacheFold.d.ts.map +1 -0
- package/dist/esm/StepCacheFold.js +201 -0
- package/dist/esm/StepCacheFold.js.map +1 -0
- package/dist/esm/StepSandbox.d.ts +78 -0
- package/dist/esm/StepSandbox.d.ts.map +1 -0
- package/dist/esm/StepSandbox.js +70 -0
- package/dist/esm/StepSandbox.js.map +1 -0
- package/dist/esm/WakeBus.d.ts +116 -0
- package/dist/esm/WakeBus.d.ts.map +1 -0
- package/dist/esm/WakeBus.js +121 -0
- package/dist/esm/WakeBus.js.map +1 -0
- package/dist/esm/WorkspaceSandbox.d.ts +619 -0
- package/dist/esm/WorkspaceSandbox.d.ts.map +1 -0
- package/dist/esm/WorkspaceSandbox.js +985 -0
- package/dist/esm/WorkspaceSandbox.js.map +1 -0
- package/dist/esm/index.d.ts +157 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +157 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ActionPersistence.d.ts +276 -0
- package/dist/esm/internal/ActionPersistence.d.ts.map +1 -0
- package/dist/esm/internal/ActionPersistence.js +2306 -0
- package/dist/esm/internal/ActionPersistence.js.map +1 -0
- package/dist/esm/internal/ArtifactRoots.d.ts +38 -0
- package/dist/esm/internal/ArtifactRoots.d.ts.map +1 -0
- package/dist/esm/internal/ArtifactRoots.js +76 -0
- package/dist/esm/internal/ArtifactRoots.js.map +1 -0
- package/dist/esm/internal/AttemptAdmission.d.ts +53 -0
- package/dist/esm/internal/AttemptAdmission.d.ts.map +1 -0
- package/dist/esm/internal/AttemptAdmission.js +52 -0
- package/dist/esm/internal/AttemptAdmission.js.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts +245 -0
- package/dist/esm/internal/AttemptLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/AttemptLifecycle.js +104 -0
- package/dist/esm/internal/AttemptLifecycle.js.map +1 -0
- package/dist/esm/internal/AttemptProbe.d.ts +53 -0
- package/dist/esm/internal/AttemptProbe.d.ts.map +1 -0
- package/dist/esm/internal/AttemptProbe.js +83 -0
- package/dist/esm/internal/AttemptProbe.js.map +1 -0
- package/dist/esm/internal/CacheAdmission.d.ts +79 -0
- package/dist/esm/internal/CacheAdmission.d.ts.map +1 -0
- package/dist/esm/internal/CacheAdmission.js +72 -0
- package/dist/esm/internal/CacheAdmission.js.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts +27 -0
- package/dist/esm/internal/CacheAgeHistory.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeHistory.js +49 -0
- package/dist/esm/internal/CacheAgeHistory.js.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts +15 -0
- package/dist/esm/internal/CacheAgeVerdicts.d.ts.map +1 -0
- package/dist/esm/internal/CacheAgeVerdicts.js +54 -0
- package/dist/esm/internal/CacheAgeVerdicts.js.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts +24 -0
- package/dist/esm/internal/CacheOutputPolicy.d.ts.map +1 -0
- package/dist/esm/internal/CacheOutputPolicy.js +73 -0
- package/dist/esm/internal/CacheOutputPolicy.js.map +1 -0
- package/dist/esm/internal/CachePublication.d.ts +97 -0
- package/dist/esm/internal/CachePublication.d.ts.map +1 -0
- package/dist/esm/internal/CachePublication.js +116 -0
- package/dist/esm/internal/CachePublication.js.map +1 -0
- package/dist/esm/internal/CallFacts.d.ts +15 -0
- package/dist/esm/internal/CallFacts.d.ts.map +1 -0
- package/dist/esm/internal/CallFacts.js +83 -0
- package/dist/esm/internal/CallFacts.js.map +1 -0
- package/dist/esm/internal/CopiedRecord.d.ts +61 -0
- package/dist/esm/internal/CopiedRecord.d.ts.map +1 -0
- package/dist/esm/internal/CopiedRecord.js +165 -0
- package/dist/esm/internal/CopiedRecord.js.map +1 -0
- package/dist/esm/internal/DeferredPersistence.d.ts +108 -0
- package/dist/esm/internal/DeferredPersistence.d.ts.map +1 -0
- package/dist/esm/internal/DeferredPersistence.js +240 -0
- package/dist/esm/internal/DeferredPersistence.js.map +1 -0
- package/dist/esm/internal/EffectRecords.d.ts +92 -0
- package/dist/esm/internal/EffectRecords.d.ts.map +1 -0
- package/dist/esm/internal/EffectRecords.js +94 -0
- package/dist/esm/internal/EffectRecords.js.map +1 -0
- package/dist/esm/internal/EngineJj.d.ts +30 -0
- package/dist/esm/internal/EngineJj.d.ts.map +1 -0
- package/dist/esm/internal/EngineJj.js +29 -0
- package/dist/esm/internal/EngineJj.js.map +1 -0
- package/dist/esm/internal/EngineStateSchema.d.ts +68 -0
- package/dist/esm/internal/EngineStateSchema.d.ts.map +1 -0
- package/dist/esm/internal/EngineStateSchema.js +53 -0
- package/dist/esm/internal/EngineStateSchema.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts +162 -0
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js +218 -0
- package/dist/esm/internal/ExecutionSnapshotRead.js.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts +39 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts.map +1 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js +81 -0
- package/dist/esm/internal/ExecutionSnapshotRelations.js.map +1 -0
- package/dist/esm/internal/ExitEncoding.d.ts +180 -0
- package/dist/esm/internal/ExitEncoding.d.ts.map +1 -0
- package/dist/esm/internal/ExitEncoding.js +361 -0
- package/dist/esm/internal/ExitEncoding.js.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts +14 -0
- package/dist/esm/internal/FileBoundarySnapshot.d.ts.map +1 -0
- package/dist/esm/internal/FileBoundarySnapshot.js +29 -0
- package/dist/esm/internal/FileBoundarySnapshot.js.map +1 -0
- package/dist/esm/internal/FileEnumeration.d.ts +127 -0
- package/dist/esm/internal/FileEnumeration.d.ts.map +1 -0
- package/dist/esm/internal/FileEnumeration.js +236 -0
- package/dist/esm/internal/FileEnumeration.js.map +1 -0
- package/dist/esm/internal/HostReflection.d.ts +80 -0
- package/dist/esm/internal/HostReflection.d.ts.map +1 -0
- package/dist/esm/internal/HostReflection.js +98 -0
- package/dist/esm/internal/HostReflection.js.map +1 -0
- package/dist/esm/internal/JournalRecords.d.ts +325 -0
- package/dist/esm/internal/JournalRecords.d.ts.map +1 -0
- package/dist/esm/internal/JournalRecords.js +306 -0
- package/dist/esm/internal/JournalRecords.js.map +1 -0
- package/dist/esm/internal/NodeJournal.d.ts +157 -0
- package/dist/esm/internal/NodeJournal.d.ts.map +1 -0
- package/dist/esm/internal/NodeJournal.js +298 -0
- package/dist/esm/internal/NodeJournal.js.map +1 -0
- package/dist/esm/internal/Ordering.d.ts +14 -0
- package/dist/esm/internal/Ordering.d.ts.map +1 -0
- package/dist/esm/internal/Ordering.js +14 -0
- package/dist/esm/internal/Ordering.js.map +1 -0
- package/dist/esm/internal/PlanInputs.d.ts +14 -0
- package/dist/esm/internal/PlanInputs.d.ts.map +1 -0
- package/dist/esm/internal/PlanInputs.js +57 -0
- package/dist/esm/internal/PlanInputs.js.map +1 -0
- package/dist/esm/internal/PlanMerges.d.ts +178 -0
- package/dist/esm/internal/PlanMerges.d.ts.map +1 -0
- package/dist/esm/internal/PlanMerges.js +113 -0
- package/dist/esm/internal/PlanMerges.js.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts +30 -0
- package/dist/esm/internal/ProvenanceSlot.d.ts.map +1 -0
- package/dist/esm/internal/ProvenanceSlot.js +39 -0
- package/dist/esm/internal/ProvenanceSlot.js.map +1 -0
- package/dist/esm/internal/ResultEnvelope.d.ts +88 -0
- package/dist/esm/internal/ResultEnvelope.d.ts.map +1 -0
- package/dist/esm/internal/ResultEnvelope.js +83 -0
- package/dist/esm/internal/ResultEnvelope.js.map +1 -0
- package/dist/esm/internal/RetentionOps.d.ts +414 -0
- package/dist/esm/internal/RetentionOps.d.ts.map +1 -0
- package/dist/esm/internal/RetentionOps.js +576 -0
- package/dist/esm/internal/RetentionOps.js.map +1 -0
- package/dist/esm/internal/RunCatalogOps.d.ts +118 -0
- package/dist/esm/internal/RunCatalogOps.d.ts.map +1 -0
- package/dist/esm/internal/RunCatalogOps.js +120 -0
- package/dist/esm/internal/RunCatalogOps.js.map +1 -0
- package/dist/esm/internal/RunCoordinator.d.ts +78 -0
- package/dist/esm/internal/RunCoordinator.d.ts.map +1 -0
- package/dist/esm/internal/RunCoordinator.js +115 -0
- package/dist/esm/internal/RunCoordinator.js.map +1 -0
- package/dist/esm/internal/RunDriver.d.ts +192 -0
- package/dist/esm/internal/RunDriver.d.ts.map +1 -0
- package/dist/esm/internal/RunDriver.js +2334 -0
- package/dist/esm/internal/RunDriver.js.map +1 -0
- package/dist/esm/internal/RunLifecycle.d.ts +22 -0
- package/dist/esm/internal/RunLifecycle.d.ts.map +1 -0
- package/dist/esm/internal/RunLifecycle.js +49 -0
- package/dist/esm/internal/RunLifecycle.js.map +1 -0
- package/dist/esm/internal/RunListing.d.ts +78 -0
- package/dist/esm/internal/RunListing.d.ts.map +1 -0
- package/dist/esm/internal/RunListing.js +146 -0
- package/dist/esm/internal/RunListing.js.map +1 -0
- package/dist/esm/internal/RunListingError.d.ts +35 -0
- package/dist/esm/internal/RunListingError.d.ts.map +1 -0
- package/dist/esm/internal/RunListingError.js +27 -0
- package/dist/esm/internal/RunListingError.js.map +1 -0
- package/dist/esm/internal/RuntimeGraph.d.ts +73 -0
- package/dist/esm/internal/RuntimeGraph.d.ts.map +1 -0
- package/dist/esm/internal/RuntimeGraph.js +182 -0
- package/dist/esm/internal/RuntimeGraph.js.map +1 -0
- package/dist/esm/internal/SandboxedExecution.d.ts +80 -0
- package/dist/esm/internal/SandboxedExecution.d.ts.map +1 -0
- package/dist/esm/internal/SandboxedExecution.js +107 -0
- package/dist/esm/internal/SandboxedExecution.js.map +1 -0
- package/dist/esm/internal/StateTransaction.d.ts +44 -0
- package/dist/esm/internal/StateTransaction.d.ts.map +1 -0
- package/dist/esm/internal/StateTransaction.js +54 -0
- package/dist/esm/internal/StateTransaction.js.map +1 -0
- package/dist/esm/internal/StepFacts.d.ts +14 -0
- package/dist/esm/internal/StepFacts.d.ts.map +1 -0
- package/dist/esm/internal/StepFacts.js +35 -0
- package/dist/esm/internal/StepFacts.js.map +1 -0
- package/dist/esm/internal/TypedEvents.d.ts +14 -0
- package/dist/esm/internal/TypedEvents.d.ts.map +1 -0
- package/dist/esm/internal/TypedEvents.js +14 -0
- package/dist/esm/internal/TypedEvents.js.map +1 -0
- package/dist/esm/migrations/0001_initial.d.ts +17 -0
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -0
- package/dist/esm/migrations/0001_initial.js +41 -0
- package/dist/esm/migrations/0001_initial.js.map +1 -0
- package/dist/esm/migrations/0002_selection_store.d.ts +15 -0
- package/dist/esm/migrations/0002_selection_store.d.ts.map +1 -0
- package/dist/esm/migrations/0002_selection_store.js +34 -0
- package/dist/esm/migrations/0002_selection_store.js.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts +13 -0
- package/dist/esm/migrations/0003_plan_inputs.d.ts.map +1 -0
- package/dist/esm/migrations/0003_plan_inputs.js +70 -0
- package/dist/esm/migrations/0003_plan_inputs.js.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts +14 -0
- package/dist/esm/migrations/0004_plan_environment.d.ts.map +1 -0
- package/dist/esm/migrations/0004_plan_environment.js +33 -0
- package/dist/esm/migrations/0004_plan_environment.js.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts +14 -0
- package/dist/esm/migrations/0005_plan_merges.d.ts.map +1 -0
- package/dist/esm/migrations/0005_plan_merges.js +59 -0
- package/dist/esm/migrations/0005_plan_merges.js.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts +15 -0
- package/dist/esm/migrations/0006_execution_listing.d.ts.map +1 -0
- package/dist/esm/migrations/0006_execution_listing.js +81 -0
- package/dist/esm/migrations/0006_execution_listing.js.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts +15 -0
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts.map +1 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js +18 -0
- package/dist/esm/migrations/0007_run_parent_sequence.js.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts +16 -0
- package/dist/esm/migrations/0008_deferred_consumption.d.ts.map +1 -0
- package/dist/esm/migrations/0008_deferred_consumption.js +24 -0
- package/dist/esm/migrations/0008_deferred_consumption.js.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts +24 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts.map +1 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js +127 -0
- package/dist/esm/migrations/0009_deferred_clock_facts.js.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts +15 -0
- package/dist/esm/migrations/0010_pending_cancellation.d.ts.map +1 -0
- package/dist/esm/migrations/0010_pending_cancellation.js +19 -0
- package/dist/esm/migrations/0010_pending_cancellation.js.map +1 -0
- package/dist/esm/test/TestStores.d.ts +89 -0
- package/dist/esm/test/TestStores.d.ts.map +1 -0
- package/dist/esm/test/TestStores.js +103 -0
- package/dist/esm/test/TestStores.js.map +1 -0
- package/docs/README.md +113 -0
- package/docs/api.md +1494 -0
- package/docs/concepts/attempts-and-replay.md +149 -0
- package/docs/concepts/cache-admission.md +265 -0
- package/docs/concepts/call-facts.md +86 -0
- package/docs/concepts/durable-waits.md +175 -0
- package/docs/concepts/execution-facts.md +90 -0
- package/docs/concepts/ownership-and-fencing.md +128 -0
- package/docs/concepts/step-boundaries.md +148 -0
- package/docs/concepts/workspace-transactions.md +199 -0
- package/docs/event-types.md +14 -0
- package/docs/guides/back-up-and-restore.md +164 -0
- package/docs/guides/collect-unreferenced-artifacts.md +128 -0
- package/docs/guides/compose-a-durable-engine.md +146 -0
- package/docs/guides/coordinate-two-processes.md +120 -0
- package/docs/guides/defer-work-with-selection.md +171 -0
- package/docs/guides/delete-old-run-history.md +154 -0
- package/docs/guides/drive-a-plan.md +314 -0
- package/docs/guides/observe-engine-metrics.md +98 -0
- package/docs/guides/observe-executions.md +187 -0
- package/docs/guides/reclaim-runs-from-a-dead-host.md +133 -0
- package/docs/guides/share-a-cache-across-machines.md +134 -0
- package/docs/guides/testing.md +123 -0
- package/docs/installation.md +102 -0
- package/docs/quickstart.md +215 -0
- package/docs/troubleshooting.md +347 -0
- package/package.json +438 -3
- package/src/ArtifactGc.ts +408 -0
- package/src/ArtifactSync.ts +278 -0
- package/src/CacheSync.ts +131 -0
- package/src/DeferredClockFold.ts +586 -0
- package/src/DisasterRecovery.ts +888 -0
- package/src/DurableEngineState.ts +2656 -0
- package/src/EngineStore.ts +656 -0
- package/src/EngineStoreMetrics.ts +331 -0
- package/src/Errors.ts +28 -0
- package/src/EventTypes.ts +27 -0
- package/src/ExecutionFacts.ts +125 -0
- package/src/ExecutionSnapshot.ts +186 -0
- package/src/Inconsistency.ts +253 -0
- package/src/Migrations.ts +95 -0
- package/src/OwnerIdentity.ts +125 -0
- package/src/PlanInputStore.ts +292 -0
- package/src/PlanMergeStore.ts +330 -0
- package/src/PlanScheduler.ts +1806 -0
- package/src/Reconciliation.ts +224 -0
- package/src/ReplayOnly.ts +95 -0
- package/src/Retention.ts +214 -0
- package/src/RunCatalogRead.ts +27 -0
- package/src/RunChangeFeed.ts +125 -0
- package/src/RunState.ts +137 -0
- package/src/Selection.ts +683 -0
- package/src/SelectionStore.ts +353 -0
- package/src/StepBoundary.ts +1165 -0
- package/src/StepCacheFold.ts +244 -0
- package/src/StepSandbox.ts +110 -0
- package/src/WakeBus.ts +167 -0
- package/src/WorkspaceSandbox.ts +1604 -0
- package/src/index.ts +185 -0
- package/src/internal/ActionPersistence.ts +2687 -0
- package/src/internal/ArtifactRoots.ts +92 -0
- package/src/internal/AttemptAdmission.ts +76 -0
- package/src/internal/AttemptLifecycle.ts +163 -0
- package/src/internal/AttemptProbe.ts +90 -0
- package/src/internal/CacheAdmission.ts +133 -0
- package/src/internal/CacheAgeHistory.ts +58 -0
- package/src/internal/CacheAgeVerdicts.ts +61 -0
- package/src/internal/CacheOutputPolicy.ts +82 -0
- package/src/internal/CachePublication.ts +153 -0
- package/src/internal/CallFacts.ts +87 -0
- package/src/internal/CopiedRecord.ts +201 -0
- package/src/internal/DeferredPersistence.ts +459 -0
- package/src/internal/EffectRecords.ts +136 -0
- package/src/internal/EngineJj.ts +30 -0
- package/src/internal/EngineStateSchema.ts +92 -0
- package/src/internal/ExecutionSnapshotRead.ts +300 -0
- package/src/internal/ExecutionSnapshotRelations.ts +121 -0
- package/src/internal/ExitEncoding.ts +453 -0
- package/src/internal/FileBoundarySnapshot.ts +39 -0
- package/src/internal/FileEnumeration.ts +334 -0
- package/src/internal/HostReflection.ts +128 -0
- package/src/internal/JournalRecords.ts +396 -0
- package/src/internal/NodeJournal.ts +340 -0
- package/src/internal/Ordering.ts +14 -0
- package/src/internal/PlanInputs.ts +62 -0
- package/src/internal/PlanMerges.ts +123 -0
- package/src/internal/ProvenanceSlot.ts +52 -0
- package/src/internal/ResultEnvelope.ts +118 -0
- package/src/internal/RetentionOps.ts +865 -0
- package/src/internal/RunCatalogOps.ts +174 -0
- package/src/internal/RunCoordinator.ts +215 -0
- package/src/internal/RunDriver.ts +3154 -0
- package/src/internal/RunLifecycle.ts +53 -0
- package/src/internal/RunListing.ts +210 -0
- package/src/internal/RunListingError.ts +37 -0
- package/src/internal/RuntimeGraph.ts +253 -0
- package/src/internal/SandboxedExecution.ts +165 -0
- package/src/internal/StateTransaction.ts +71 -0
- package/src/internal/StepFacts.ts +36 -0
- package/src/internal/TypedEvents.ts +29 -0
- package/src/migrations/0001_initial.ts +51 -0
- package/src/migrations/0002_selection_store.ts +38 -0
- package/src/migrations/0003_plan_inputs.ts +75 -0
- package/src/migrations/0004_plan_environment.ts +34 -0
- package/src/migrations/0005_plan_merges.ts +60 -0
- package/src/migrations/0006_execution_listing.ts +86 -0
- package/src/migrations/0007_run_parent_sequence.ts +19 -0
- package/src/migrations/0008_deferred_consumption.ts +27 -0
- package/src/migrations/0009_deferred_clock_facts.ts +163 -0
- package/src/migrations/0010_pending_cancellation.ts +20 -0
- package/src/test/TestStores.ts +145 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two-tier artifact protocol the step cache rides on: publish before the
|
|
3
|
+
* entry, fetch on demand after it.
|
|
4
|
+
*
|
|
5
|
+
* This is the seam that makes a shared cache safe. A cache entry references
|
|
6
|
+
* its large outputs by digest, so an entry that becomes observable while one
|
|
7
|
+
* of those artifacts is still missing hands the next machine a hit it cannot
|
|
8
|
+
* materialize. Bazel states the constraint at
|
|
9
|
+
* `reference/bazel/.../remote/UploadManifest.java:630-633` — "action results
|
|
10
|
+
* may fail to validate server-side if they are accessed before all blobs they
|
|
11
|
+
* refer to are present" — and enforces it by ordering:
|
|
12
|
+
* `findMissingDigests` → upload the missing → upload the `ActionResult` LAST.
|
|
13
|
+
* {@link Service.publish} is that ordering, and `ActionPersistence` calls it
|
|
14
|
+
* before `CacheStore.put`.
|
|
15
|
+
*
|
|
16
|
+
* The read direction is the same protocol in reverse, and how eagerly it runs
|
|
17
|
+
* is the {@link DownloadPolicy}, declared on the shared tier itself
|
|
18
|
+
* (`RemoteArtifacts.Options.downloadPolicy`) and split across two seams.
|
|
19
|
+
* `all` fetches every referenced artifact into this host's store while
|
|
20
|
+
* admitting the replay. `toplevel` and `minimal` fetch nothing here: one
|
|
21
|
+
* batched probe establishes that the shared tier can serve them and the
|
|
22
|
+
* transfer is left to the first read through `CombinedArtifacts`, which then
|
|
23
|
+
* writes the blob back under `toplevel` and does not under `minimal`. This is
|
|
24
|
+
* Bazel's `RemoteOutputChecker` dial
|
|
25
|
+
* (`--remote_download_{all,toplevel,minimal}`) split the way our two seams
|
|
26
|
+
* split: what a replay prefetches is this module's decision, what a read
|
|
27
|
+
* materializes is the combined store's.
|
|
28
|
+
*
|
|
29
|
+
* Governing design: `packages/smithers/flows/artifacts/docs/api.md`.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
*/
|
|
33
|
+
import * as ArtifactStore from "@smthrs/artifacts/ArtifactStore";
|
|
34
|
+
import * as RemoteArtifacts from "@smthrs/artifacts/RemoteArtifacts";
|
|
35
|
+
import * as Context from "effect/Context";
|
|
36
|
+
import type * as Crypto from "effect/Crypto";
|
|
37
|
+
import * as Effect from "effect/Effect";
|
|
38
|
+
import * as Layer from "effect/Layer";
|
|
39
|
+
import * as Schema from "effect/Schema";
|
|
40
|
+
declare const ArtifactPublicationFailed_base: Schema.Class<ArtifactPublicationFailed, Schema.TaggedStruct<"@smthrs/engine-store/ArtifactPublicationFailed", {
|
|
41
|
+
readonly code: Schema.Literal<"artifact_publication_failed">;
|
|
42
|
+
readonly digests: Schema.$Array<Schema.String>;
|
|
43
|
+
readonly message: Schema.String;
|
|
44
|
+
readonly cause: Schema.optional<Schema.Union<readonly [typeof ArtifactStore.ArtifactStoreError, typeof ArtifactStore.ArtifactMissing, typeof ArtifactStore.ArtifactCorruption]>>;
|
|
45
|
+
}>, import("effect/Cause").YieldableError>;
|
|
46
|
+
/**
|
|
47
|
+
* A referenced artifact could not be made durable in the shared tier, so the
|
|
48
|
+
* cache entry that references it must not be published.
|
|
49
|
+
*
|
|
50
|
+
* Failing here is the point: silently publishing the entry anyway is exactly
|
|
51
|
+
* the state the REAPI ordering constraint exists to prevent.
|
|
52
|
+
*
|
|
53
|
+
* @since 0.1.0
|
|
54
|
+
* @category errors
|
|
55
|
+
*/
|
|
56
|
+
export declare class ArtifactPublicationFailed extends ArtifactPublicationFailed_base {
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* How eagerly a replay materializes the artifacts it references.
|
|
60
|
+
*
|
|
61
|
+
* `all` downloads every referenced artifact into this host's local store while
|
|
62
|
+
* the replay is admitted, so every later read is local and a shared tier that
|
|
63
|
+
* goes down afterwards costs nothing. `minimal` downloads none of them: it
|
|
64
|
+
* establishes that each digest is resolvable — locally, or from the shared tier
|
|
65
|
+
* — and lets the first actual read fetch the bytes.
|
|
66
|
+
*
|
|
67
|
+
* `minimal` is only sound when the store the replay reads through can reach the
|
|
68
|
+
* shared tier, which means `CombinedArtifacts` with the same remote tier. Under
|
|
69
|
+
* a purely local `ArtifactStore` an admitted `minimal` replay would later read
|
|
70
|
+
* an artifact this host never fetched.
|
|
71
|
+
*
|
|
72
|
+
* @since 0.1.0
|
|
73
|
+
* @category models
|
|
74
|
+
*/
|
|
75
|
+
export type DownloadPolicy = RemoteArtifacts.DownloadPolicy;
|
|
76
|
+
/**
|
|
77
|
+
* The two directions of the artifact protocol: {@link Service.publish} before a
|
|
78
|
+
* cache entry becomes observable, {@link Service.hydrate} when a replay needs
|
|
79
|
+
* bytes this host does not have.
|
|
80
|
+
*
|
|
81
|
+
* The asymmetry in their error types is the design: publishing may fail,
|
|
82
|
+
* because publishing an entry whose artifacts are missing is the unsafe state;
|
|
83
|
+
* hydrating never fails, because a shared tier that is down should cost a run
|
|
84
|
+
* a cache hit, not the run itself.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @category services
|
|
88
|
+
*/
|
|
89
|
+
export interface Service {
|
|
90
|
+
/**
|
|
91
|
+
* Makes every digest durable in the shared tier, in REAPI order:
|
|
92
|
+
* `findMissing`, upload what is missing, then confirm nothing is missing
|
|
93
|
+
* any more. Returns only once the shared tier can serve all of them.
|
|
94
|
+
*/
|
|
95
|
+
readonly publish: (digests: ReadonlyArray<string>) => Effect.Effect<void, ArtifactPublicationFailed, Crypto.Crypto>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetches the digests this host is missing from the shared tier and writes
|
|
98
|
+
* them into the local store, reporting whether every digest is now locally
|
|
99
|
+
* resolvable.
|
|
100
|
+
*
|
|
101
|
+
* Best-effort by construction: `false` means "replay still cannot be
|
|
102
|
+
* satisfied", which the caller turns into a real execution. A shared tier
|
|
103
|
+
* that is down must never fail a run that can simply do the work.
|
|
104
|
+
*/
|
|
105
|
+
readonly hydrate: (digests: ReadonlyArray<string>) => Effect.Effect<boolean, never, Crypto.Crypto>;
|
|
106
|
+
}
|
|
107
|
+
declare const ArtifactSync_base: Context.ServiceClass<ArtifactSync, "@smthrs/engine-store/ArtifactSync", Service>;
|
|
108
|
+
/**
|
|
109
|
+
* Service tag for the two-tier artifact protocol.
|
|
110
|
+
*
|
|
111
|
+
* @since 0.1.0
|
|
112
|
+
* @category services
|
|
113
|
+
*/
|
|
114
|
+
export declare class ArtifactSync extends ArtifactSync_base {
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The single-tier implementation: there is no shared artifact store, so there
|
|
118
|
+
* is nothing to publish and nothing to fetch.
|
|
119
|
+
*
|
|
120
|
+
* This is the default `ActionPersistence` falls back to when the tag is
|
|
121
|
+
* absent, which is what keeps a purely local composition free of any
|
|
122
|
+
* remote-cache machinery.
|
|
123
|
+
*
|
|
124
|
+
* @since 0.1.0
|
|
125
|
+
* @category constructors
|
|
126
|
+
*/
|
|
127
|
+
export declare const makeLocal: () => Service;
|
|
128
|
+
/**
|
|
129
|
+
* Provides the single-tier (no shared artifact store) protocol.
|
|
130
|
+
*
|
|
131
|
+
* @since 0.1.0
|
|
132
|
+
* @category layers
|
|
133
|
+
*/
|
|
134
|
+
export declare const layerLocal: Layer.Layer<ArtifactSync>;
|
|
135
|
+
/**
|
|
136
|
+
* Builds the two-tier protocol over a local and a shared artifact store.
|
|
137
|
+
*
|
|
138
|
+
* @since 0.1.0
|
|
139
|
+
* @category constructors
|
|
140
|
+
*/
|
|
141
|
+
export declare const make: (options: {
|
|
142
|
+
readonly local: ArtifactStore.Service;
|
|
143
|
+
readonly remote: ArtifactStore.Service;
|
|
144
|
+
/**
|
|
145
|
+
* Defaults to the policy the shared tier declares, and to `all` for a tier
|
|
146
|
+
* that declares none: every referenced artifact is fetched at hydrate.
|
|
147
|
+
*/
|
|
148
|
+
readonly downloadPolicy?: DownloadPolicy | undefined;
|
|
149
|
+
}) => Service;
|
|
150
|
+
/**
|
|
151
|
+
* Provides the two-tier protocol, taking the local store from the
|
|
152
|
+
* `ArtifactStore` tag and the shared store from the supplied effect.
|
|
153
|
+
*
|
|
154
|
+
* The two tiers cannot both be layers: they inhabit the same tag, so composing
|
|
155
|
+
* them would shadow one with the other.
|
|
156
|
+
*
|
|
157
|
+
* @since 0.1.0
|
|
158
|
+
* @category layers
|
|
159
|
+
*/
|
|
160
|
+
export declare const layer: <E, R>(remote: Effect.Effect<ArtifactStore.Service, E, R>, options?: {
|
|
161
|
+
readonly downloadPolicy?: DownloadPolicy | undefined;
|
|
162
|
+
} | undefined) => Layer.Layer<ArtifactSync, E, ArtifactStore.ArtifactStore | R>;
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=ArtifactSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArtifactSync.d.ts","sourceRoot":"","sources":["../../src/ArtifactSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,aAAa,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAA;AACpE,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;;;;;;;AAEvC;;;;;;;;;GASG;AACH,qBAAa,yBAA0B,SAAQ,8BAc9C;CAAG;AAEJ;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,cAAc,CAAA;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IAClE;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,EAAE,CAChB,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,KAC3B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAClD;;AAED;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,iBAA6E;CAAG;AAElH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,QAAO,OAG3B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,CAA4C,CAAA;AAE7F;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS;IAC5B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAA;IACtC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;CACrD,KAAG,OAmFH,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EACxB,QAAQ,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,EAClD,UAAU;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,KAC7E,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,EAAE,aAAa,CAAC,aAAa,GAAG,CAAC,CAW5D,CAAA"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two-tier artifact protocol the step cache rides on: publish before the
|
|
3
|
+
* entry, fetch on demand after it.
|
|
4
|
+
*
|
|
5
|
+
* This is the seam that makes a shared cache safe. A cache entry references
|
|
6
|
+
* its large outputs by digest, so an entry that becomes observable while one
|
|
7
|
+
* of those artifacts is still missing hands the next machine a hit it cannot
|
|
8
|
+
* materialize. Bazel states the constraint at
|
|
9
|
+
* `reference/bazel/.../remote/UploadManifest.java:630-633` — "action results
|
|
10
|
+
* may fail to validate server-side if they are accessed before all blobs they
|
|
11
|
+
* refer to are present" — and enforces it by ordering:
|
|
12
|
+
* `findMissingDigests` → upload the missing → upload the `ActionResult` LAST.
|
|
13
|
+
* {@link Service.publish} is that ordering, and `ActionPersistence` calls it
|
|
14
|
+
* before `CacheStore.put`.
|
|
15
|
+
*
|
|
16
|
+
* The read direction is the same protocol in reverse, and how eagerly it runs
|
|
17
|
+
* is the {@link DownloadPolicy}, declared on the shared tier itself
|
|
18
|
+
* (`RemoteArtifacts.Options.downloadPolicy`) and split across two seams.
|
|
19
|
+
* `all` fetches every referenced artifact into this host's store while
|
|
20
|
+
* admitting the replay. `toplevel` and `minimal` fetch nothing here: one
|
|
21
|
+
* batched probe establishes that the shared tier can serve them and the
|
|
22
|
+
* transfer is left to the first read through `CombinedArtifacts`, which then
|
|
23
|
+
* writes the blob back under `toplevel` and does not under `minimal`. This is
|
|
24
|
+
* Bazel's `RemoteOutputChecker` dial
|
|
25
|
+
* (`--remote_download_{all,toplevel,minimal}`) split the way our two seams
|
|
26
|
+
* split: what a replay prefetches is this module's decision, what a read
|
|
27
|
+
* materializes is the combined store's.
|
|
28
|
+
*
|
|
29
|
+
* Governing design: `packages/smithers/flows/artifacts/docs/api.md`.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
*/
|
|
33
|
+
import * as ArtifactStore from "@smthrs/artifacts/ArtifactStore";
|
|
34
|
+
import * as RemoteArtifacts from "@smthrs/artifacts/RemoteArtifacts";
|
|
35
|
+
import * as Context from "effect/Context";
|
|
36
|
+
import * as Effect from "effect/Effect";
|
|
37
|
+
import * as Layer from "effect/Layer";
|
|
38
|
+
import * as Schema from "effect/Schema";
|
|
39
|
+
/**
|
|
40
|
+
* A referenced artifact could not be made durable in the shared tier, so the
|
|
41
|
+
* cache entry that references it must not be published.
|
|
42
|
+
*
|
|
43
|
+
* Failing here is the point: silently publishing the entry anyway is exactly
|
|
44
|
+
* the state the REAPI ordering constraint exists to prevent.
|
|
45
|
+
*
|
|
46
|
+
* @since 0.1.0
|
|
47
|
+
* @category errors
|
|
48
|
+
*/
|
|
49
|
+
export class ArtifactPublicationFailed extends Schema.TaggedError()("@smthrs/engine-store/ArtifactPublicationFailed", {
|
|
50
|
+
code: Schema.Literal("artifact_publication_failed"),
|
|
51
|
+
digests: Schema.Array(Schema.String),
|
|
52
|
+
message: Schema.String,
|
|
53
|
+
cause: Schema.optional(Schema.Union([
|
|
54
|
+
ArtifactStore.ArtifactStoreError,
|
|
55
|
+
ArtifactStore.ArtifactMissing,
|
|
56
|
+
ArtifactStore.ArtifactCorruption
|
|
57
|
+
]))
|
|
58
|
+
}) {
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Service tag for the two-tier artifact protocol.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.1.0
|
|
64
|
+
* @category services
|
|
65
|
+
*/
|
|
66
|
+
export class ArtifactSync extends Context.Service()("@smthrs/engine-store/ArtifactSync") {
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The single-tier implementation: there is no shared artifact store, so there
|
|
70
|
+
* is nothing to publish and nothing to fetch.
|
|
71
|
+
*
|
|
72
|
+
* This is the default `ActionPersistence` falls back to when the tag is
|
|
73
|
+
* absent, which is what keeps a purely local composition free of any
|
|
74
|
+
* remote-cache machinery.
|
|
75
|
+
*
|
|
76
|
+
* @since 0.1.0
|
|
77
|
+
* @category constructors
|
|
78
|
+
*/
|
|
79
|
+
export const makeLocal = () => ({
|
|
80
|
+
publish: Effect.fn("ArtifactSync.publish")(() => Effect.void),
|
|
81
|
+
hydrate: Effect.fn("ArtifactSync.hydrate")((digests) => Effect.succeed(digests.length === 0))
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Provides the single-tier (no shared artifact store) protocol.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @category layers
|
|
88
|
+
*/
|
|
89
|
+
export const layerLocal = Layer.succeed(ArtifactSync)(makeLocal());
|
|
90
|
+
/**
|
|
91
|
+
* Builds the two-tier protocol over a local and a shared artifact store.
|
|
92
|
+
*
|
|
93
|
+
* @since 0.1.0
|
|
94
|
+
* @category constructors
|
|
95
|
+
*/
|
|
96
|
+
export const make = (options) => {
|
|
97
|
+
const { local, remote } = options;
|
|
98
|
+
const downloadPolicy = options.downloadPolicy ?? RemoteArtifacts.downloadPolicyOf(remote) ?? "all";
|
|
99
|
+
const publicationFailed = (digests, message, cause) => new ArtifactPublicationFailed({ code: "artifact_publication_failed", digests, message, cause });
|
|
100
|
+
return {
|
|
101
|
+
publish: Effect.fn("ArtifactSync.publish")(function* (digests) {
|
|
102
|
+
if (digests.length === 0)
|
|
103
|
+
return;
|
|
104
|
+
const missing = yield* remote.findMissing(digests).pipe(Effect.mapError((cause) => publicationFailed(digests, "the shared tier refused a probe", cause)));
|
|
105
|
+
for (const digest of missing) {
|
|
106
|
+
const bytes = yield* local.get(digest).pipe(Effect.mapError((cause) =>
|
|
107
|
+
// The blob is referenced by evidence this host just produced, so
|
|
108
|
+
// it should be in this host's own store. If it is not, the
|
|
109
|
+
// evidence is not publishable — and saying so is far better than
|
|
110
|
+
// publishing an entry nobody can replay.
|
|
111
|
+
publicationFailed([digest], "this host cannot read the artifact it recorded", cause)));
|
|
112
|
+
yield* remote.put(bytes).pipe(Effect.mapError((cause) => publicationFailed([digest], "the shared tier refused an upload", cause)));
|
|
113
|
+
}
|
|
114
|
+
if (missing.length === 0)
|
|
115
|
+
return;
|
|
116
|
+
// The confirming re-probe is not paranoia: a tier that accepted the
|
|
117
|
+
// upload but did not durably store it is exactly the state that makes a
|
|
118
|
+
// published entry unreplayable, and it is cheap to rule out — one
|
|
119
|
+
// batched round trip over the set we just wrote.
|
|
120
|
+
const stillMissing = yield* remote.findMissing(missing).pipe(Effect.mapError((cause) => publicationFailed(missing, "the shared tier refused a probe", cause)));
|
|
121
|
+
if (stillMissing.length > 0) {
|
|
122
|
+
return yield* Effect.fail(publicationFailed(stillMissing, "the shared tier did not retain the uploaded artifacts"));
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
hydrate: Effect.fn("ArtifactSync.hydrate")(function* (digests) {
|
|
126
|
+
// Every refusal below falls back to re-executing the step, which is
|
|
127
|
+
// correct and silent. The warning is the operator's only signal that a
|
|
128
|
+
// tier stopped serving replays.
|
|
129
|
+
const fallBack = (message, digests) => (cause) => Effect.logWarning(`artifact hydration falls back to re-execution: ${message}: ${digests.join(", ")}`).pipe(Effect.annotateLogs({ reason: cause.message }));
|
|
130
|
+
const missing = yield* local.findMissing(digests).pipe(Effect.tapError(fallBack("the local tier refused a probe", digests)), Effect.option);
|
|
131
|
+
if (missing._tag === "None")
|
|
132
|
+
return false;
|
|
133
|
+
if (downloadPolicy !== "all") {
|
|
134
|
+
if (missing.value.length === 0)
|
|
135
|
+
return true;
|
|
136
|
+
// One batched probe, no body transfer: the answer these policies owe
|
|
137
|
+
// the caller is "can this replay be satisfied", and `findMissing`
|
|
138
|
+
// answers exactly that. A tier that refuses the probe is
|
|
139
|
+
// indistinguishable from one that holds nothing, so the replay is
|
|
140
|
+
// refused either way.
|
|
141
|
+
const elsewhere = yield* remote.findMissing(missing.value).pipe(Effect.tapError(fallBack("the shared tier refused a probe", missing.value)), Effect.option);
|
|
142
|
+
return elsewhere._tag === "Some" && elsewhere.value.length === 0;
|
|
143
|
+
}
|
|
144
|
+
for (const digest of missing.value) {
|
|
145
|
+
// Read-through, one artifact at a time and only on demand: the remote
|
|
146
|
+
// read is digest-verified by `RemoteArtifacts`, and the local `put`
|
|
147
|
+
// re-addresses the bytes, so a tier serving wrong content cannot get
|
|
148
|
+
// them written into this workspace.
|
|
149
|
+
const written = yield* remote.get(digest).pipe(Effect.flatMap((bytes) => local.put(bytes)), Effect.tapError(fallBack("the artifact could not be fetched", [digest])), Effect.option);
|
|
150
|
+
if (written._tag === "None")
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
})
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Provides the two-tier protocol, taking the local store from the
|
|
159
|
+
* `ArtifactStore` tag and the shared store from the supplied effect.
|
|
160
|
+
*
|
|
161
|
+
* The two tiers cannot both be layers: they inhabit the same tag, so composing
|
|
162
|
+
* them would shadow one with the other.
|
|
163
|
+
*
|
|
164
|
+
* @since 0.1.0
|
|
165
|
+
* @category layers
|
|
166
|
+
*/
|
|
167
|
+
export const layer = (remote, options) => Layer.effect(ArtifactSync)(Effect.gen(function* () {
|
|
168
|
+
const local = yield* ArtifactStore.ArtifactStore;
|
|
169
|
+
const shared = yield* remote;
|
|
170
|
+
return make({
|
|
171
|
+
local,
|
|
172
|
+
remote: shared,
|
|
173
|
+
...(options?.downloadPolicy === undefined ? {} : { downloadPolicy: options.downloadPolicy })
|
|
174
|
+
});
|
|
175
|
+
}));
|
|
176
|
+
//# sourceMappingURL=ArtifactSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArtifactSync.js","sourceRoot":"","sources":["../../src/ArtifactSync.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * The two-tier artifact protocol the step cache rides on: publish before the\n * entry, fetch on demand after it.\n *\n * This is the seam that makes a shared cache safe. A cache entry references\n * its large outputs by digest, so an entry that becomes observable while one\n * of those artifacts is still missing hands the next machine a hit it cannot\n * materialize. Bazel states the constraint at\n * `reference/bazel/.../remote/UploadManifest.java:630-633` — \"action results\n * may fail to validate server-side if they are accessed before all blobs they\n * refer to are present\" — and enforces it by ordering:\n * `findMissingDigests` → upload the missing → upload the `ActionResult` LAST.\n * {@link Service.publish} is that ordering, and `ActionPersistence` calls it\n * before `CacheStore.put`.\n *\n * The read direction is the same protocol in reverse, and how eagerly it runs\n * is the {@link DownloadPolicy}, declared on the shared tier itself\n * (`RemoteArtifacts.Options.downloadPolicy`) and split across two seams.\n * `all` fetches every referenced artifact into this host's store while\n * admitting the replay. `toplevel` and `minimal` fetch nothing here: one\n * batched probe establishes that the shared tier can serve them and the\n * transfer is left to the first read through `CombinedArtifacts`, which then\n * writes the blob back under `toplevel` and does not under `minimal`. This is\n * Bazel's `RemoteOutputChecker` dial\n * (`--remote_download_{all,toplevel,minimal}`) split the way our two seams\n * split: what a replay prefetches is this module's decision, what a read\n * materializes is the combined store's.\n *\n * Governing design: `packages/smithers/flows/artifacts/docs/api.md`.\n *\n * @since 0.1.0\n */\n\nimport * as ArtifactStore from \"@smthrs/artifacts/ArtifactStore\"\nimport * as RemoteArtifacts from \"@smthrs/artifacts/RemoteArtifacts\"\nimport * as Context from \"effect/Context\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\n\n/**\n * A referenced artifact could not be made durable in the shared tier, so the\n * cache entry that references it must not be published.\n *\n * Failing here is the point: silently publishing the entry anyway is exactly\n * the state the REAPI ordering constraint exists to prevent.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class ArtifactPublicationFailed extends Schema.TaggedError<ArtifactPublicationFailed>()(\n \"@smthrs/engine-store/ArtifactPublicationFailed\",\n {\n code: Schema.Literal(\"artifact_publication_failed\"),\n digests: Schema.Array(Schema.String),\n message: Schema.String,\n cause: Schema.optional(\n Schema.Union([\n ArtifactStore.ArtifactStoreError,\n ArtifactStore.ArtifactMissing,\n ArtifactStore.ArtifactCorruption\n ])\n )\n }\n) {}\n\n/**\n * How eagerly a replay materializes the artifacts it references.\n *\n * `all` downloads every referenced artifact into this host's local store while\n * the replay is admitted, so every later read is local and a shared tier that\n * goes down afterwards costs nothing. `minimal` downloads none of them: it\n * establishes that each digest is resolvable — locally, or from the shared tier\n * — and lets the first actual read fetch the bytes.\n *\n * `minimal` is only sound when the store the replay reads through can reach the\n * shared tier, which means `CombinedArtifacts` with the same remote tier. Under\n * a purely local `ArtifactStore` an admitted `minimal` replay would later read\n * an artifact this host never fetched.\n *\n * @since 0.1.0\n * @category models\n */\nexport type DownloadPolicy = RemoteArtifacts.DownloadPolicy\n\n/**\n * The two directions of the artifact protocol: {@link Service.publish} before a\n * cache entry becomes observable, {@link Service.hydrate} when a replay needs\n * bytes this host does not have.\n *\n * The asymmetry in their error types is the design: publishing may fail,\n * because publishing an entry whose artifacts are missing is the unsafe state;\n * hydrating never fails, because a shared tier that is down should cost a run\n * a cache hit, not the run itself.\n *\n * @since 0.1.0\n * @category services\n */\nexport interface Service {\n /**\n * Makes every digest durable in the shared tier, in REAPI order:\n * `findMissing`, upload what is missing, then confirm nothing is missing\n * any more. Returns only once the shared tier can serve all of them.\n */\n readonly publish: (\n digests: ReadonlyArray<string>\n ) => Effect.Effect<void, ArtifactPublicationFailed, Crypto.Crypto>\n /**\n * Fetches the digests this host is missing from the shared tier and writes\n * them into the local store, reporting whether every digest is now locally\n * resolvable.\n *\n * Best-effort by construction: `false` means \"replay still cannot be\n * satisfied\", which the caller turns into a real execution. A shared tier\n * that is down must never fail a run that can simply do the work.\n */\n readonly hydrate: (\n digests: ReadonlyArray<string>\n ) => Effect.Effect<boolean, never, Crypto.Crypto>\n}\n\n/**\n * Service tag for the two-tier artifact protocol.\n *\n * @since 0.1.0\n * @category services\n */\nexport class ArtifactSync extends Context.Service<ArtifactSync, Service>()(\"@smthrs/engine-store/ArtifactSync\") {}\n\n/**\n * The single-tier implementation: there is no shared artifact store, so there\n * is nothing to publish and nothing to fetch.\n *\n * This is the default `ActionPersistence` falls back to when the tag is\n * absent, which is what keeps a purely local composition free of any\n * remote-cache machinery.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const makeLocal = (): Service => ({\n publish: Effect.fn(\"ArtifactSync.publish\")(() => Effect.void),\n hydrate: Effect.fn(\"ArtifactSync.hydrate\")((digests) => Effect.succeed(digests.length === 0))\n})\n\n/**\n * Provides the single-tier (no shared artifact store) protocol.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerLocal: Layer.Layer<ArtifactSync> = Layer.succeed(ArtifactSync)(makeLocal())\n\n/**\n * Builds the two-tier protocol over a local and a shared artifact store.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const make = (options: {\n readonly local: ArtifactStore.Service\n readonly remote: ArtifactStore.Service\n /**\n * Defaults to the policy the shared tier declares, and to `all` for a tier\n * that declares none: every referenced artifact is fetched at hydrate.\n */\n readonly downloadPolicy?: DownloadPolicy | undefined\n}): Service => {\n const { local, remote } = options\n const downloadPolicy = options.downloadPolicy ?? RemoteArtifacts.downloadPolicyOf(remote) ?? \"all\"\n const publicationFailed = (\n digests: ReadonlyArray<string>,\n message: string,\n cause?: ArtifactStore.ArtifactStoreError | ArtifactStore.ArtifactMissing | ArtifactStore.ArtifactCorruption\n ) => new ArtifactPublicationFailed({ code: \"artifact_publication_failed\", digests, message, cause })\n return {\n publish: Effect.fn(\"ArtifactSync.publish\")(function*(digests) {\n if (digests.length === 0) return\n const missing = yield* remote.findMissing(digests).pipe(\n Effect.mapError((cause) => publicationFailed(digests, \"the shared tier refused a probe\", cause))\n )\n for (const digest of missing) {\n const bytes = yield* local.get(digest).pipe(\n Effect.mapError((cause) =>\n // The blob is referenced by evidence this host just produced, so\n // it should be in this host's own store. If it is not, the\n // evidence is not publishable — and saying so is far better than\n // publishing an entry nobody can replay.\n publicationFailed([digest], \"this host cannot read the artifact it recorded\", cause)\n )\n )\n yield* remote.put(bytes).pipe(\n Effect.mapError((cause) => publicationFailed([digest], \"the shared tier refused an upload\", cause))\n )\n }\n if (missing.length === 0) return\n // The confirming re-probe is not paranoia: a tier that accepted the\n // upload but did not durably store it is exactly the state that makes a\n // published entry unreplayable, and it is cheap to rule out — one\n // batched round trip over the set we just wrote.\n const stillMissing = yield* remote.findMissing(missing).pipe(\n Effect.mapError((cause) => publicationFailed(missing, \"the shared tier refused a probe\", cause))\n )\n if (stillMissing.length > 0) {\n return yield* Effect.fail(\n publicationFailed(stillMissing, \"the shared tier did not retain the uploaded artifacts\")\n )\n }\n }),\n hydrate: Effect.fn(\"ArtifactSync.hydrate\")(function*(digests) {\n // Every refusal below falls back to re-executing the step, which is\n // correct and silent. The warning is the operator's only signal that a\n // tier stopped serving replays.\n const fallBack = (message: string, digests: ReadonlyArray<string>) => (cause: { readonly message: string }) =>\n Effect.logWarning(`artifact hydration falls back to re-execution: ${message}: ${digests.join(\", \")}`).pipe(\n Effect.annotateLogs({ reason: cause.message })\n )\n const missing = yield* local.findMissing(digests).pipe(\n Effect.tapError(fallBack(\"the local tier refused a probe\", digests)),\n Effect.option\n )\n if (missing._tag === \"None\") return false\n if (downloadPolicy !== \"all\") {\n if (missing.value.length === 0) return true\n // One batched probe, no body transfer: the answer these policies owe\n // the caller is \"can this replay be satisfied\", and `findMissing`\n // answers exactly that. A tier that refuses the probe is\n // indistinguishable from one that holds nothing, so the replay is\n // refused either way.\n const elsewhere = yield* remote.findMissing(missing.value).pipe(\n Effect.tapError(fallBack(\"the shared tier refused a probe\", missing.value)),\n Effect.option\n )\n return elsewhere._tag === \"Some\" && elsewhere.value.length === 0\n }\n for (const digest of missing.value) {\n // Read-through, one artifact at a time and only on demand: the remote\n // read is digest-verified by `RemoteArtifacts`, and the local `put`\n // re-addresses the bytes, so a tier serving wrong content cannot get\n // them written into this workspace.\n const written = yield* remote.get(digest).pipe(\n Effect.flatMap((bytes) => local.put(bytes)),\n Effect.tapError(fallBack(\"the artifact could not be fetched\", [digest])),\n Effect.option\n )\n if (written._tag === \"None\") return false\n }\n return true\n })\n }\n}\n\n/**\n * Provides the two-tier protocol, taking the local store from the\n * `ArtifactStore` tag and the shared store from the supplied effect.\n *\n * The two tiers cannot both be layers: they inhabit the same tag, so composing\n * them would shadow one with the other.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layer = <E, R>(\n remote: Effect.Effect<ArtifactStore.Service, E, R>,\n options?: { readonly downloadPolicy?: DownloadPolicy | undefined } | undefined\n): Layer.Layer<ArtifactSync, E, ArtifactStore.ArtifactStore | R> =>\n Layer.effect(ArtifactSync)(\n Effect.gen(function*() {\n const local = yield* ArtifactStore.ArtifactStore\n const shared = yield* remote\n return make({\n local,\n remote: shared,\n ...(options?.downloadPolicy === undefined ? {} : { downloadPolicy: options.downloadPolicy })\n })\n })\n )\n"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared step-result tier's publication seam: the remote half of a cache
|
|
3
|
+
* `put`, run *after* the transaction that made the local row durable.
|
|
4
|
+
*
|
|
5
|
+
* `ArtifactSync` is the same idea for the artifact tier, and the two together
|
|
6
|
+
* are the REAPI ordering constraint
|
|
7
|
+
* (`reference/bazel/.../remote/UploadManifest.java:630-633`): blobs first, the
|
|
8
|
+
* entry that references them last.
|
|
9
|
+
*
|
|
10
|
+
* This tag exists because of *where* the local row is written.
|
|
11
|
+
* `ActionPersistence` commits the cache row and the journal record that
|
|
12
|
+
* explains it in one `DurableWriter` transaction, and nothing that is not
|
|
13
|
+
* storage work may be held across one — the action body, the Jj snapshot, and
|
|
14
|
+
* the boundary prepare/settle all already stay outside. A `CacheStore` whose
|
|
15
|
+
* `put` also writes a shared HTTP tier would put a network round trip inside
|
|
16
|
+
* that transaction, blocking every other writer for its duration and rolling
|
|
17
|
+
* the local row back when a *shared cache* is unreachable. So the local put
|
|
18
|
+
* stays inside and the shared put becomes this service, invoked once the
|
|
19
|
+
* transaction has committed. Compose it with
|
|
20
|
+
* `CombinedCacheStore` in `"deferred"` publication mode, which is the mode that
|
|
21
|
+
* leaves the shared write to this seam.
|
|
22
|
+
*
|
|
23
|
+
* Publication is **best-effort by construction**. A shared cache is an
|
|
24
|
+
* accelerator, and the work it would have shared is already durably recorded on
|
|
25
|
+
* this host: failing a completed run because an optional tier is unreachable
|
|
26
|
+
* trades a real result for an unavailable one. A refused publication is
|
|
27
|
+
* journaled by the caller instead, which is the same treatment an unverified
|
|
28
|
+
* read set gets — visible, not silent.
|
|
29
|
+
*
|
|
30
|
+
* Governing design: `packages/smithers/flows/step-cache/docs/api.md`.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
*/
|
|
34
|
+
import type { CacheStore } from "@smthrs/step-cache";
|
|
35
|
+
import * as Context from "effect/Context";
|
|
36
|
+
import * as Effect from "effect/Effect";
|
|
37
|
+
import * as Layer from "effect/Layer";
|
|
38
|
+
import * as Option from "effect/Option";
|
|
39
|
+
/**
|
|
40
|
+
* The one operation the shared-cache publication seam exposes.
|
|
41
|
+
*
|
|
42
|
+
* It is a single method rather than a store interface on purpose: everything
|
|
43
|
+
* about reading, keying, and invalidating a cache entry belongs to
|
|
44
|
+
* `CacheStore`, and all this seam does is take an already-durable local entry
|
|
45
|
+
* and try to share it.
|
|
46
|
+
*
|
|
47
|
+
* @since 0.1.0
|
|
48
|
+
* @category services
|
|
49
|
+
*/
|
|
50
|
+
export interface Service {
|
|
51
|
+
/**
|
|
52
|
+
* Publishes a cache entry to the shared tier, reporting the refusal rather
|
|
53
|
+
* than failing: `Option.none()` means the entry is now shared, and
|
|
54
|
+
* `Option.some(error)` means it is not and why.
|
|
55
|
+
*
|
|
56
|
+
* Callers must only reach here once every artifact the entry references is
|
|
57
|
+
* durable in the shared artifact tier — that is `ArtifactSync.publish`'s job,
|
|
58
|
+
* and it runs first.
|
|
59
|
+
*/
|
|
60
|
+
readonly publishEntry: (entry: CacheStore.CacheEntry) => Effect.Effect<Option.Option<CacheStore.CacheStoreError>>;
|
|
61
|
+
}
|
|
62
|
+
declare const CacheSync_base: Context.ServiceClass<CacheSync, "@smthrs/engine-store/CacheSync", Service>;
|
|
63
|
+
/**
|
|
64
|
+
* Service tag for the shared step-result publication seam.
|
|
65
|
+
*
|
|
66
|
+
* @since 0.1.0
|
|
67
|
+
* @category services
|
|
68
|
+
*/
|
|
69
|
+
export declare class CacheSync extends CacheSync_base {
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The single-tier implementation: there is no shared step-result tier, so a
|
|
73
|
+
* recorded entry is already everywhere it will ever be.
|
|
74
|
+
*
|
|
75
|
+
* This is the default `ActionPersistence` falls back to when the tag is
|
|
76
|
+
* absent, which is what keeps a purely local composition free of any
|
|
77
|
+
* remote-cache machinery.
|
|
78
|
+
*
|
|
79
|
+
* @since 0.1.0
|
|
80
|
+
* @category constructors
|
|
81
|
+
*/
|
|
82
|
+
export declare const makeLocal: () => Service;
|
|
83
|
+
/**
|
|
84
|
+
* Provides the single-tier (no shared step-result store) publication seam.
|
|
85
|
+
*
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @category layers
|
|
88
|
+
*/
|
|
89
|
+
export declare const layerLocal: Layer.Layer<CacheSync>;
|
|
90
|
+
/**
|
|
91
|
+
* Builds the publication seam over a shared step-result store — typically
|
|
92
|
+
* `RemoteCacheStore`.
|
|
93
|
+
*
|
|
94
|
+
* @since 0.1.0
|
|
95
|
+
* @category constructors
|
|
96
|
+
*/
|
|
97
|
+
export declare const make: (options: {
|
|
98
|
+
readonly remote: CacheStore.Service;
|
|
99
|
+
}) => Service;
|
|
100
|
+
/**
|
|
101
|
+
* Provides the publication seam over the supplied shared store.
|
|
102
|
+
*
|
|
103
|
+
* The shared store arrives as an *effect* rather than a layer because it
|
|
104
|
+
* inhabits the same `CacheStore` tag as the local one: composing both as layers
|
|
105
|
+
* would shadow one with the other.
|
|
106
|
+
*
|
|
107
|
+
* @since 0.1.0
|
|
108
|
+
* @category layers
|
|
109
|
+
*/
|
|
110
|
+
export declare const layer: <E, R>(remote: Effect.Effect<CacheStore.Service, E, R>) => Layer.Layer<CacheSync, E, R>;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=CacheSync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheSync.d.ts","sourceRoot":"","sources":["../../src/CacheSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,EAAE,CACrB,KAAK,EAAE,UAAU,CAAC,UAAU,KACzB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA;CAC9D;;AAED;;;;;GAKG;AACH,qBAAa,SAAU,SAAQ,cAAuE;CAAG;AAEzG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,QAAO,OAE3B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAyC,CAAA;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAA;CAAE,KAAG,OAYtE,CAAA;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EACxB,QAAQ,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,KAC9C,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAsF,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared step-result tier's publication seam: the remote half of a cache
|
|
3
|
+
* `put`, run *after* the transaction that made the local row durable.
|
|
4
|
+
*
|
|
5
|
+
* `ArtifactSync` is the same idea for the artifact tier, and the two together
|
|
6
|
+
* are the REAPI ordering constraint
|
|
7
|
+
* (`reference/bazel/.../remote/UploadManifest.java:630-633`): blobs first, the
|
|
8
|
+
* entry that references them last.
|
|
9
|
+
*
|
|
10
|
+
* This tag exists because of *where* the local row is written.
|
|
11
|
+
* `ActionPersistence` commits the cache row and the journal record that
|
|
12
|
+
* explains it in one `DurableWriter` transaction, and nothing that is not
|
|
13
|
+
* storage work may be held across one — the action body, the Jj snapshot, and
|
|
14
|
+
* the boundary prepare/settle all already stay outside. A `CacheStore` whose
|
|
15
|
+
* `put` also writes a shared HTTP tier would put a network round trip inside
|
|
16
|
+
* that transaction, blocking every other writer for its duration and rolling
|
|
17
|
+
* the local row back when a *shared cache* is unreachable. So the local put
|
|
18
|
+
* stays inside and the shared put becomes this service, invoked once the
|
|
19
|
+
* transaction has committed. Compose it with
|
|
20
|
+
* `CombinedCacheStore` in `"deferred"` publication mode, which is the mode that
|
|
21
|
+
* leaves the shared write to this seam.
|
|
22
|
+
*
|
|
23
|
+
* Publication is **best-effort by construction**. A shared cache is an
|
|
24
|
+
* accelerator, and the work it would have shared is already durably recorded on
|
|
25
|
+
* this host: failing a completed run because an optional tier is unreachable
|
|
26
|
+
* trades a real result for an unavailable one. A refused publication is
|
|
27
|
+
* journaled by the caller instead, which is the same treatment an unverified
|
|
28
|
+
* read set gets — visible, not silent.
|
|
29
|
+
*
|
|
30
|
+
* Governing design: `packages/smithers/flows/step-cache/docs/api.md`.
|
|
31
|
+
*
|
|
32
|
+
* @since 0.1.0
|
|
33
|
+
*/
|
|
34
|
+
import * as Context from "effect/Context";
|
|
35
|
+
import * as Effect from "effect/Effect";
|
|
36
|
+
import * as Layer from "effect/Layer";
|
|
37
|
+
import * as Option from "effect/Option";
|
|
38
|
+
/**
|
|
39
|
+
* Service tag for the shared step-result publication seam.
|
|
40
|
+
*
|
|
41
|
+
* @since 0.1.0
|
|
42
|
+
* @category services
|
|
43
|
+
*/
|
|
44
|
+
export class CacheSync extends Context.Service()("@smthrs/engine-store/CacheSync") {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The single-tier implementation: there is no shared step-result tier, so a
|
|
48
|
+
* recorded entry is already everywhere it will ever be.
|
|
49
|
+
*
|
|
50
|
+
* This is the default `ActionPersistence` falls back to when the tag is
|
|
51
|
+
* absent, which is what keeps a purely local composition free of any
|
|
52
|
+
* remote-cache machinery.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.1.0
|
|
55
|
+
* @category constructors
|
|
56
|
+
*/
|
|
57
|
+
export const makeLocal = () => ({
|
|
58
|
+
publishEntry: Effect.fn("CacheSync.publishEntry")(() => Effect.succeed(Option.none()))
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Provides the single-tier (no shared step-result store) publication seam.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.1.0
|
|
64
|
+
* @category layers
|
|
65
|
+
*/
|
|
66
|
+
export const layerLocal = Layer.succeed(CacheSync)(makeLocal());
|
|
67
|
+
/**
|
|
68
|
+
* Builds the publication seam over a shared step-result store — typically
|
|
69
|
+
* `RemoteCacheStore`.
|
|
70
|
+
*
|
|
71
|
+
* @since 0.1.0
|
|
72
|
+
* @category constructors
|
|
73
|
+
*/
|
|
74
|
+
export const make = (options) => ({
|
|
75
|
+
publishEntry: Effect.fn("CacheSync.publishEntry")((entry) =>
|
|
76
|
+
// A `Conflict` from the shared tier is not a refusal to report: it means
|
|
77
|
+
// another machine recorded the key first, which is exactly the
|
|
78
|
+
// first-writer-wins outcome the shared tier exists to arbitrate. Only a
|
|
79
|
+
// genuine failure — the tier is down, refused the body, answered with a
|
|
80
|
+
// status this client cannot classify — is worth journaling.
|
|
81
|
+
options.remote.put(entry).pipe(Effect.as(Option.none()), Effect.catch((error) => Effect.succeed(Option.some(error)))))
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Provides the publication seam over the supplied shared store.
|
|
85
|
+
*
|
|
86
|
+
* The shared store arrives as an *effect* rather than a layer because it
|
|
87
|
+
* inhabits the same `CacheStore` tag as the local one: composing both as layers
|
|
88
|
+
* would shadow one with the other.
|
|
89
|
+
*
|
|
90
|
+
* @since 0.1.0
|
|
91
|
+
* @category layers
|
|
92
|
+
*/
|
|
93
|
+
export const layer = (remote) => Layer.effect(CacheSync)(Effect.map(remote, (shared) => make({ remote: shared })));
|
|
94
|
+
//# sourceMappingURL=CacheSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CacheSync.js","sourceRoot":"","sources":["../../src/CacheSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AA4BvC;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,OAAO,CAAC,OAAO,EAAsB,CAAC,gCAAgC,CAAC;CAAG;AAEzG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAY,EAAE,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;CACvF,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAA2B,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,CAAC,CAAA;AAEvF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAgD,EAAW,EAAE,CAAC,CAAC;IAClF,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAA4B,EAAE,EAAE;IACjF,yEAAyE;IACzE,+DAA+D;IAC/D,wEAAwE;IACxE,wEAAwE;IACxE,4DAA4D;IAC5D,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAC5B,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAA8B,CAAC,EACpD,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC5D,CACF;CACF,CAAC,CAAA;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,MAA+C,EACjB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The shared step-result tier's publication seam: the remote half of a cache\n * `put`, run *after* the transaction that made the local row durable.\n *\n * `ArtifactSync` is the same idea for the artifact tier, and the two together\n * are the REAPI ordering constraint\n * (`reference/bazel/.../remote/UploadManifest.java:630-633`): blobs first, the\n * entry that references them last.\n *\n * This tag exists because of *where* the local row is written.\n * `ActionPersistence` commits the cache row and the journal record that\n * explains it in one `DurableWriter` transaction, and nothing that is not\n * storage work may be held across one — the action body, the Jj snapshot, and\n * the boundary prepare/settle all already stay outside. A `CacheStore` whose\n * `put` also writes a shared HTTP tier would put a network round trip inside\n * that transaction, blocking every other writer for its duration and rolling\n * the local row back when a *shared cache* is unreachable. So the local put\n * stays inside and the shared put becomes this service, invoked once the\n * transaction has committed. Compose it with\n * `CombinedCacheStore` in `\"deferred\"` publication mode, which is the mode that\n * leaves the shared write to this seam.\n *\n * Publication is **best-effort by construction**. A shared cache is an\n * accelerator, and the work it would have shared is already durably recorded on\n * this host: failing a completed run because an optional tier is unreachable\n * trades a real result for an unavailable one. A refused publication is\n * journaled by the caller instead, which is the same treatment an unverified\n * read set gets — visible, not silent.\n *\n * Governing design: `packages/smithers/flows/step-cache/docs/api.md`.\n *\n * @since 0.1.0\n */\n\nimport type { CacheStore } from \"@smthrs/step-cache\"\nimport * as Context from \"effect/Context\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Option from \"effect/Option\"\n\n/**\n * The one operation the shared-cache publication seam exposes.\n *\n * It is a single method rather than a store interface on purpose: everything\n * about reading, keying, and invalidating a cache entry belongs to\n * `CacheStore`, and all this seam does is take an already-durable local entry\n * and try to share it.\n *\n * @since 0.1.0\n * @category services\n */\nexport interface Service {\n /**\n * Publishes a cache entry to the shared tier, reporting the refusal rather\n * than failing: `Option.none()` means the entry is now shared, and\n * `Option.some(error)` means it is not and why.\n *\n * Callers must only reach here once every artifact the entry references is\n * durable in the shared artifact tier — that is `ArtifactSync.publish`'s job,\n * and it runs first.\n */\n readonly publishEntry: (\n entry: CacheStore.CacheEntry\n ) => Effect.Effect<Option.Option<CacheStore.CacheStoreError>>\n}\n\n/**\n * Service tag for the shared step-result publication seam.\n *\n * @since 0.1.0\n * @category services\n */\nexport class CacheSync extends Context.Service<CacheSync, Service>()(\"@smthrs/engine-store/CacheSync\") {}\n\n/**\n * The single-tier implementation: there is no shared step-result tier, so a\n * recorded entry is already everywhere it will ever be.\n *\n * This is the default `ActionPersistence` falls back to when the tag is\n * absent, which is what keeps a purely local composition free of any\n * remote-cache machinery.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const makeLocal = (): Service => ({\n publishEntry: Effect.fn(\"CacheSync.publishEntry\")(() => Effect.succeed(Option.none()))\n})\n\n/**\n * Provides the single-tier (no shared step-result store) publication seam.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerLocal: Layer.Layer<CacheSync> = Layer.succeed(CacheSync)(makeLocal())\n\n/**\n * Builds the publication seam over a shared step-result store — typically\n * `RemoteCacheStore`.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const make = (options: { readonly remote: CacheStore.Service }): Service => ({\n publishEntry: Effect.fn(\"CacheSync.publishEntry\")((entry: CacheStore.CacheEntry) =>\n // A `Conflict` from the shared tier is not a refusal to report: it means\n // another machine recorded the key first, which is exactly the\n // first-writer-wins outcome the shared tier exists to arbitrate. Only a\n // genuine failure — the tier is down, refused the body, answered with a\n // status this client cannot classify — is worth journaling.\n options.remote.put(entry).pipe(\n Effect.as(Option.none<CacheStore.CacheStoreError>()),\n Effect.catch((error) => Effect.succeed(Option.some(error)))\n )\n )\n})\n\n/**\n * Provides the publication seam over the supplied shared store.\n *\n * The shared store arrives as an *effect* rather than a layer because it\n * inhabits the same `CacheStore` tag as the local one: composing both as layers\n * would shadow one with the other.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layer = <E, R>(\n remote: Effect.Effect<CacheStore.Service, E, R>\n): Layer.Layer<CacheSync, E, R> => Layer.effect(CacheSync)(Effect.map(remote, (shared) => make({ remote: shared })))\n"]}
|