Skip to main content

NetDbBuilder

Struct NetDbBuilder 

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

Builder for NetDb.

Implementations§

Source§

impl NetDbBuilder

Source

pub fn origin(self, origin_hash: u64) -> NetDbBuilder

Set the producer origin_hash stamped on every EventMeta by the bundled adapters.

Source

pub fn persistent(self, persistent: bool) -> NetDbBuilder

When true, every enabled model’s underlying RedEX file uses persistent: true. Requires the Redex to have been constructed with with_persistent_dir(...).

Source

pub fn with_tasks(self) -> NetDbBuilder

Include the tasks model.

Source

pub fn with_memories(self) -> NetDbBuilder

Include the memories model.

Source

pub async fn build(self) -> Result<NetDb, NetDbError>

Build the NetDb. Opens each enabled model against the underlying Redex.

§Failure atomicity

If the second adapter open fails, the first adapter is closed before the error propagates so no orphan fold task outlives the failed build. The Redex is dropped with the builder on the error path — callers who want to retry without losing shared state should construct a new Redex (retry on the same manager is not available since the builder consumes it by value).

The atomicity guarantee itself is code-level: the close-on-error block below is the authoritative source of truth. Integration tests exercise the observable error path but cannot directly observe the closed first-adapter after the Redex has been dropped.

Source

pub async fn build_from_snapshot( self, snapshot: &NetDbSnapshot, ) -> Result<NetDb, NetDbError>

Like Self::build, but restore each enabled model from the corresponding entry in snapshot. A model enabled via with_*() whose snapshot entry is None in the bundle is opened from scratch via the normal open path (equivalent to Self::build for that model).

Same failure-atomicity guarantee as Self::build — a second-adapter failure closes the first before the error propagates. See build’s docs for the caveat that the failing Redex is dropped with the builder.

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