Skip to main content

TransactorNode

Struct TransactorNode 

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

A running transactor node hosting every database under one data directory.

Implementations§

Source§

impl TransactorNode

Source

pub fn open(config: NodeConfig) -> Result<Arc<Self>, NodeError>

Opens a node over config.data_dir, recovering every database found there (acquiring its lease, waiting out held leases up to the configured bound).

§Errors

Returns an error when the store cannot be opened or a database cannot be recovered.

Source

pub fn store(&self) -> &Arc<FsStore>

The node’s data-directory store.

Source

pub fn config(&self) -> &NodeConfig

Node configuration.

Source

pub const fn metrics(&self) -> &Metrics

Process observability counters.

Source

pub fn shutdown_watch(&self) -> Receiver<Option<String>>

Watch channel that reports a shutdown reason when the node deposes.

Source

pub fn db_state(&self, name: &str) -> Result<Arc<DbState>, NodeError>

Looks up a hosted database.

§Errors

Returns NodeError::UnknownDb when absent.

Source

pub fn create_db( self: &Arc<Self>, name: &str, schema_edn: &[u8], ) -> Result<bool, NodeError>

Creates a database with the supplied EDN schema forms; returns false when it already exists.

§Errors

Returns an error for invalid names/schema or store failures.

Source

pub fn delete_db(&self, name: &str) -> Result<bool, NodeError>

Deletes a database: unhosts it, releases its lease, and removes its roots and log. Blobs remain until Self::gc_deleted.

§Errors

Returns an error when roots or the log cannot be removed.

Source

pub fn list_dbs(&self) -> Vec<String>

Lists hosted databases.

Source

pub async fn gc_deleted(&self) -> Result<u64, NodeError>

Sweeps blobs unreachable from any live database root (including everything left behind by deleted databases and superseded indexes).

§Errors

Returns an error when the store cannot be enumerated or swept.

Source

pub async fn gc_deleted_with_retention( &self, retention: Duration, ) -> Result<u64, NodeError>

Sweeps unreachable blobs older than the caller-supplied retention.

§Errors

Returns an error when the store cannot be enumerated or swept.

Source

pub async fn transact( &self, name: &str, tx_data: &[u8], ) -> Result<TransactResponse, NodeError>

Validates, appends, applies, and reports one transaction supplied as composite-encoded EDN transaction forms.

§Errors

Returns NodeError for decode/validation failures, lease loss, or storage failures.

Source

pub fn status(&self, name: &str) -> Result<StatusResponse, NodeError>

Current status for a database.

§Errors

Returns NodeError::UnknownDb when absent.

Source

pub async fn sync(&self, name: &str, t: u64) -> Result<u64, NodeError>

Waits until the database basis reaches t, returning the basis seen.

§Errors

Returns NodeError::UnknownDb when absent.

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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