Skip to main content

NetDb

Struct NetDb 

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

Unified NetDB handle.

Bundles one or more CortEX adapters (tasks, memories, …) behind a single handle. Construct via NetDb::builder.

Implementations§

Source§

impl NetDb

Source

pub fn builder(redex: Redex) -> NetDbBuilder

Start building a NetDB.

Source

pub fn tasks(&self) -> &TasksAdapter

Access the tasks model. Panics if with_tasks() wasn’t called on the builder. Use Self::try_tasks for a checked accessor.

Source

pub fn try_tasks(&self) -> Option<&TasksAdapter>

Checked tasks accessor. Returns None if tasks were not included at build time.

Source

pub fn memories(&self) -> &MemoriesAdapter

Access the memories model. Panics if with_memories() wasn’t called.

Source

pub fn try_memories(&self) -> Option<&MemoriesAdapter>

Checked memories accessor.

Source

pub fn redex(&self) -> &Redex

Borrow the underlying Redex manager. Useful for lifecycle operations (close a specific channel, sweep retention, etc.).

Source

pub fn close(&self) -> Result<(), NetDbError>

Close every enabled adapter. The underlying Redex files stay open on the manager — reopening via another NetDb against the same Redex instance replays or snapshots them. Idempotent.

Both closes are attempted regardless of failure and the FIRST error is surfaced as the function’s return; the SECOND error is logged at warn so a double-failure is observable in tracing without conflating the typed error surface. Pre-fix the second error was dropped silently — operators investigating a close() failure from the typed return would never see the second adapter’s error. The dominant double-failure mode is “underlying redex already closed,” which produces the same error from both adapters and is uninteresting to disambiguate in the typed return; the warn-log makes it observable without adding a new error variant.

Source

pub fn snapshot(&self) -> Result<NetDbSnapshot, NetDbError>

Capture a snapshot of every enabled model. Each model is snapshotted under its own state lock (consistent per-model); there is no cross-model consistency guarantee because each model is a separate RedEX file.

Cross-model ordering caveat. Tasks are snapshotted first, then memories. An ingest that lands in both models between the two calls is captured by the memories snapshot but missed by the tasks snapshot — so the resulting NetDbSnapshot can split a logical “write to both models” across the two halves. A watcher snapshotting between event deliveries needs to either (a) treat each model’s last_seq as the authoritative ordering and reconcile idempotently on restore, or (b) drain both models’ wait_for_seq(known_last) before calling snapshot() to pin a deliberate cut-off. The lock order (tasks → memories) is fixed so any future writer that takes both locks must match this order to avoid deadlock.

Trait Implementations§

Source§

impl Debug for NetDb

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for NetDb

§

impl !RefUnwindSafe for NetDb

§

impl !UnwindSafe for NetDb

§

impl Send for NetDb

§

impl Sync for NetDb

§

impl Unpin for NetDb

§

impl UnsafeUnpin for NetDb

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