Skip to main content

Durable

Struct Durable 

Source
pub struct Durable { /* private fields */ }
Expand description

The durability façade: the single writer’s view of the store.

Implementations§

Source§

impl Durable

Source

pub fn new( store: SharedStore, prefix: &str, instance: &str, policy: Policy, log: Option<Logger>, ) -> Durable

Source

pub fn with_fresh(self, fresh: bool) -> Durable

Override the --fresh intent this Durable was built with — for an embedder that drives the façade directly, and for the tests, neither of which goes through the CLI that sets the process-wide default.

Source

pub fn with_config_digest(self, digest: BTreeMap<String, String>) -> Durable

Override the configuration digest (see with_fresh).

Source

pub fn store_kind(&self) -> &'static str

Source

pub fn instance(&self) -> &str

Source

pub fn prefix(&self) -> &str

Source

pub fn key(&self, kind: Kind, id: &str) -> String

Source

pub fn is_degraded(&self) -> bool

Whether the store has failed persistently and the policy chose to go on.

Source

pub fn policy(&self) -> &Policy

Source

pub fn put( &self, kind: Kind, id: &str, state: Value, hash: Option<String>, ) -> Result<u64, StoreError>

Write an entity: allocates the next seq for its key, CAS-puts the envelope, indexes it in the manifest (debounced flush). A conflict on a key this instance already owns is fatal (StoreError::Conflict); on a key first seen now, the stored seq is adopted once (a restore gap).

Source

pub fn get(&self, kind: Kind, id: &str) -> Result<Option<Envelope>, StoreError>

The latest envelope of an entity (tombstones read as absent).

Source

pub fn delete(&self, kind: Kind, id: &str) -> Result<(), StoreError>

Remove an entity: delete when the store supports it, else a tombstone (a put with state: null); drops it from the manifest index.

Source

pub fn list(&self, kind: Kind) -> Result<Vec<KeySeq>, StoreError>

The store’s list for a kind (optional).

Source

pub fn inbox_put(&self, ev: &InboxEvent) -> Result<u64, StoreError>

Write-ahead an event (before it is acted on / acknowledged).

Source

pub fn inbox_done(&self, id: &str) -> Result<(), StoreError>

Mark an event processed: deleted (or tombstoned) — it will not replay.

Source

pub fn timer_arm(&self, t: &TimerRecord) -> Result<u64, StoreError>

Source

pub fn timer_disarm(&self, id: &str) -> Result<(), StoreError>

Source

pub fn manifest(&self) -> Manifest

Source

pub fn manifest_update(&self, f: impl FnOnce(&mut Manifest))

Mutate the manifest (start-node state, budget counters, lifecycle) — flushed debounced.

Source

pub fn flush(&self, force: bool) -> Result<bool, StoreError>

Flush the manifest if dirty and (forced or the debounce elapsed).

Source

pub fn restore(&self) -> Result<Restored, StoreError>

The restore protocol (RFC 0025 §6): read the manifest, then every indexed entity (verifying envelopes), reconcile with list where supported, warm the seq map, bump the generation. A fresh instance (no manifest) writes generation 1.

Under --fresh (RFC 0033 §3.2) the middle is skipped: see restore_fresh.

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, 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