pub struct Connection { /* private fields */ }Expand description
A live peer connection to a transactor-hosted database.
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(config: ConnectConfig) -> Result<Self, PeerError>
pub async fn connect(config: ConnectConfig) -> Result<Self, PeerError>
Sourcepub fn db(&self) -> Db
pub fn db(&self) -> Db
Returns the current local database value without blocking on the transactor.
§Panics
Panics if called before the initial handshake (impossible through
Connection::connect).
Sourcepub fn index_basis_t(&self) -> u64
pub fn index_basis_t(&self) -> u64
Basis of the newest published durable index announced by the transactor.
Sourcepub fn tx_reports(&self) -> Receiver<PeerReport>
pub fn tx_reports(&self) -> Receiver<PeerReport>
Subscribes to reports applied after this call.
Sourcepub fn tx_range(&self, start: u64, end: Option<u64>) -> Vec<TxRecord>
pub fn tx_range(&self, start: u64, end: Option<u64>) -> Vec<TxRecord>
Transaction instants recorded locally for [start, end), paired
with their datoms (the peer-side tx-range).
Sourcepub async fn transact(&self, forms: Vec<Edn>) -> Result<TxResult, PeerError>
pub async fn transact(&self, forms: Vec<Edn>) -> Result<TxResult, PeerError>
Submits a transaction (EDN transaction forms) and waits until it is
applied locally, so a following Connection::db observes it.
§Errors
Returns PeerError for rejected transactions or transport failure.
Sourcepub async fn transact_raw(
&self,
tx_data: Vec<u8>,
) -> Result<TransactResponse, PeerError>
pub async fn transact_raw( &self, tx_data: Vec<u8>, ) -> Result<TransactResponse, PeerError>
Sourcepub async fn sync_to(&self, t: u64) -> Result<Db, PeerError>
pub async fn sync_to(&self, t: u64) -> Result<Db, PeerError>
Waits until the local basis reaches t, returning the database value.
§Errors
Returns PeerError::Closed if the connection task stops.
Sourcepub async fn status(&self) -> Result<StatusResponse, PeerError>
pub async fn status(&self) -> Result<StatusResponse, PeerError>
Sourcepub async fn subscribe_raw(
&self,
from_basis_t: u64,
) -> Result<Streaming<SubscribeItem>, PeerError>
pub async fn subscribe_raw( &self, from_basis_t: u64, ) -> Result<Streaming<SubscribeItem>, PeerError>
Trait Implementations§
Source§impl Drop for Connection
impl Drop for Connection
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
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