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 request_index(&self, name: &str) -> Result<u64, NodeError>
pub async fn request_index(&self, name: &str) -> Result<u64, NodeError>
Publishes indexes for name immediately, bypassing the pacing
policy (the catalog RequestIndex RPC). Returns the resulting index
basis; when the published indexes already cover every committed
transaction, returns the current index basis without publishing.
§Errors
Returns NodeError when the database is unknown, this node is
deposed or standing by, or publication fails.
Sourcepub async fn set_index_policy(
&self,
name: &str,
update: IndexPolicyUpdate,
) -> Result<IndexPolicy, NodeError>
pub async fn set_index_policy( &self, name: &str, update: IndexPolicyUpdate, ) -> Result<IndexPolicy, NodeError>
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 fork_db(
self: &Arc<Self>,
source: &str,
target: &str,
as_of_t: u64,
) -> Result<Option<u64>, NodeError>
pub async fn fork_db( self: &Arc<Self>, source: &str, target: &str, as_of_t: u64, ) -> Result<Option<u64>, NodeError>
Forks source into a new database target whose state duplicates
the source as of transaction as_of_t (0 forks at the current
basis). Only the log prefix is copied; the target replays it and
publishes its own indexes, while blob segments dedupe by content
address. Returns the fork’s basis, or None when target already
exists.
§Errors
Returns an error for an invalid target name, an unknown source, an
as_of_t ahead of the source’s basis, or store/log 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