Skip to main content

Module backend

Module backend 

Source
Expand description

The sealed execution-backend abstraction and its enum-dispatch front door.

A backend is the persistence engine behind a durable execution: it journals control flow and, for the local backend, owns the dedicated durable.db pool. The ExecutionBackend trait is sealed (it requires [crate::sealed::Sealed]), so only backends declared inside this crate can implement it. External crates never name a concrete backend; they hold a DurableBackendEnum and dispatch through it.

§Why enum dispatch instead of Box<dyn ExecutionBackend>

The journal append path is hot. A trait object would force a virtual call and a heap allocation per dispatch; DurableBackendEnum resolves the backend with a single match and no allocation (the spec’s NEVER list forbids Box<dyn ExecutionBackend> on the dispatch path). Because the trait is sealed, adding methods to it later — when the DurableContext, promise, and timer entry points land — is a non-breaking change.

§Scope

This module defines BackendCapabilities, the sealed ExecutionBackend trait (with its capabilities accessor), and the DurableBackendEnum dispatcher. The execution-open, promise-resolution, and timer-scan methods named in the spec land alongside the DurableContext (the trait can gain them without breaking callers).

Re-exports§

pub use execution_lock::ExecutionLock;
pub use local::CancelOutcome;
pub use local::LocalBackend;

Modules§

execution_lock
Cross-process advisory lock enforcing INV-15’s single-owner-process invariant, held for the lifetime of a crate::DurableContext opened via LocalBackend::open_execution_exclusive.
local
The always-compiled local journal backend.

Structs§

BackendCapabilities
The capabilities a backend advertises so callers can adapt their journaling strategy.
ExecutionSummary
A read-only summary of a single durable execution, for operability surfaces.
RedactedEntry
A redaction-safe view of one journal entry, for the zeph durable show/inspect CLI.

Enums§

DurableBackendEnum
Closed enum dispatch over the compiled-in backends.

Traits§

ExecutionBackend
A durable-execution persistence backend.