Skip to main content

DurableBackendEnum

Enum DurableBackendEnum 

Source
#[non_exhaustive]
pub enum DurableBackendEnum { Local(Arc<LocalBackend>), }
Expand description

Closed enum dispatch over the compiled-in backends.

Construct it from a concrete backend and hand it across the crate boundary behind an Arc; callers invoke the Journal and ExecutionBackend methods on the enum and the dispatch resolves to the active variant with a single match. The enum is #[non_exhaustive]: the feature-gated Restate variant joins it with the restate feature without breaking in-crate matches.

§Examples

use std::sync::Arc;
use zeph_durable::{BackendCapabilities, DurableBackendEnum};

fn max_payload(backend: &DurableBackendEnum) -> usize {
    use zeph_durable::ExecutionBackend as _;
    backend.capabilities().max_payload
}

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Local(Arc<LocalBackend>)

The always-compiled local backend journaling to a dedicated durable.db.

Held behind an Arc so the same backing instance can be shared with the JournalWriter (which owns the write path) while this enum serves the read path consumed by the ReplayCursor — both observe one durable.db pool.

Implementations§

Source§

impl DurableBackendEnum

Promise, timer, and retention dispatch.

These methods back the DurablePromise / DurableTimerService / DurableRetentionService surfaces. They are inherent on the enum rather than on the sealed ExecutionBackend trait because they are implemented through the local backend’s dedicated durable_promises / durable_timers tables; a future cross-process backend (Restate) would satisfy the same surface through its own SDK primitives, so the closed match here gains a new arm at that point — a compile-time prompt rather than a silent gap.

Source

pub async fn cancel_execution( &self, id: ExecutionId, ) -> Result<CancelOutcome, DurableError>

Cancel a running execution so it is never resumed. See LocalBackend::cancel_execution.

A plain in-process-callable primitive (#6362 trimmed US-002): no CLI or orchestration coupling, just a dispatch to the active backend.

§Errors

Returns any DurableError LocalBackend::cancel_execution can return.

Trait Implementations§

Source§

impl Debug for DurableBackendEnum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ExecutionBackend for DurableBackendEnum

Source§

fn capabilities(&self) -> BackendCapabilities

Return this backend’s stable capability description.
Source§

async fn lookup_committed_result( &self, id: ExecutionId, idem_key: IdempotencyKey, ) -> Result<Option<JournalEntry>, DurableError>

Look up a committed StepResult anywhere in an execution by its IdempotencyKey. Read more
Source§

impl Journal for DurableBackendEnum

Source§

async fn append(&self, entry: JournalEntry) -> Result<JournalSeq, DurableError>

Append an entry and return its database-assigned global sequence number. Read more
Source§

async fn read_execution( &self, id: ExecutionId, ) -> Result<Vec<JournalEntry>, DurableError>

Read every entry of an execution in append order. Read more
Source§

async fn read_execution_range( &self, id: ExecutionId, from_step_id: u32, limit: usize, ) -> Result<Vec<JournalEntry>, DurableError>

Read up to limit entries of an execution starting at from_step_id. Read more
Source§

async fn finalize( &self, id: ExecutionId, status: ExecutionStatus, ) -> Result<(), DurableError>

Transition an execution to a terminal status. Read more
Source§

async fn prune(&self, policy: &RetentionPolicy) -> Result<u64, DurableError>

Prune terminal executions according to policy and return the number of rows deleted. Read more
Source§

async fn sweep_orphans( &self, policy: &RetentionPolicy, ) -> Result<u64, DurableError>

Crash-orphan reclamation (#6254): flock-verify and hard-abort stale running rows. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more