pub struct TransactorNode { /* private fields */ }Expand description
A running transactor node hosting every database under one data directory.
Implementations§
Source§impl TransactorNode
impl TransactorNode
Sourcepub async fn open(config: NodeConfig) -> Result<Arc<Self>, NodeError>
pub async 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.
Sourcepub fn config(&self) -> &NodeConfig
pub fn config(&self) -> &NodeConfig
Node configuration.
Sourcepub fn shutdown_watch(&self) -> Receiver<Option<String>>
pub fn shutdown_watch(&self) -> Receiver<Option<String>>
Watch channel that reports a shutdown reason when the node deposes.
Sourcepub async fn db_state(&self, name: &str) -> Result<Arc<DbState>, NodeError>
pub async fn db_state(&self, name: &str) -> Result<Arc<DbState>, NodeError>
Looks up a hosted database.
§Errors
Returns NodeError::Standby when this HA node is standing by for
the database, NodeError::UnknownDb when absent.
Sourcepub fn standby_dbs(&self) -> Vec<String>
pub fn standby_dbs(&self) -> Vec<String>
Databases this node currently stands by for (HA mode).
Sourcepub async fn create_db(
self: &Arc<Self>,
name: &str,
schema_edn: &[u8],
) -> Result<bool, NodeError>
pub async 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.
Sourcepub async fn delete_db(&self, name: &str) -> Result<bool, NodeError>
pub async 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.
Sourcepub async fn gc_deleted(&self) -> Result<u64, NodeError>
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.
Sourcepub async fn gc_deleted_with_retention(
&self,
retention: Duration,
) -> Result<u64, NodeError>
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.
Sourcepub async fn transact(
&self,
name: &str,
tx_data: &[u8],
) -> Result<TransactResponse, NodeError>
pub async fn transact( &self, name: &str, tx_data: &[u8], ) -> Result<TransactResponse, NodeError>
Sourcepub async fn release_leases(&self)
pub async fn release_leases(&self)
Releases every held write lease (graceful shutdown): the record is expired in place so a standby’s next poll takes over immediately instead of waiting out the TTL. Hosted databases stop accepting work first, so nothing commits after its lease is gone.
Auto Trait Implementations§
impl !Freeze for TransactorNode
impl !RefUnwindSafe for TransactorNode
impl !UnwindSafe for TransactorNode
impl Send for TransactorNode
impl Sync for TransactorNode
impl Unpin for TransactorNode
impl UnsafeUnpin for TransactorNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request