pub struct ConsensusInstance { /* private fields */ }Implementations§
Source§impl ConsensusInstance
impl ConsensusInstance
pub fn new(session_lock: SessionLock, consensus: DynConsensus) -> Self
Sourcepub async fn session_blocking(&self) -> ConsensusSessionBlocking<'_>
pub async fn session_blocking(&self) -> ConsensusSessionBlocking<'_>
Returns a blocking session to be used in non async environments.
Users would usually need to call something like futures::executor::block_on in order
to acquire the session, but we prefer leaving this decision to the caller
Sourcepub fn unguarded_session_blocking(&self) -> ConsensusSessionBlocking<'static>
pub fn unguarded_session_blocking(&self) -> ConsensusSessionBlocking<'static>
Returns an unguarded blocking consensus session. There’s no guarantee that data will not be pruned between
two sequential consensus calls. This session doesn’t hold the consensus pruning lock, so it should
be preferred upon session_blocking() when data consistency is not important.
Sourcepub async fn session(&self) -> ConsensusSessionOwned
pub async fn session(&self) -> ConsensusSessionOwned
Returns a consensus session for accessing consensus operations in a bulk. The user can safely assume
that consensus state is consistent between operations, that is, no pruning was performed between the calls.
The returned object is an owned consensus session type which can be cloned and shared across threads.
The sharing ability is useful for spawning blocking operations on a different thread using the same
session object, see ConsensusSessionOwned::spawn_blocking(). The caller is responsible to make sure
that the overall lifetime of this session is not too long (~2 seconds max)
Sourcepub fn unguarded_session(&self) -> ConsensusSessionOwned
pub fn unguarded_session(&self) -> ConsensusSessionOwned
Returns an unguarded consensus session. There’s no guarantee that data will not be pruned between
two sequential consensus calls. This session doesn’t hold the consensus pruning lock, so it should
be preferred upon session() when data consistency is not important.
Trait Implementations§
Source§impl Clone for ConsensusInstance
impl Clone for ConsensusInstance
Source§fn clone(&self) -> ConsensusInstance
fn clone(&self) -> ConsensusInstance
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ConsensusInstance
impl !RefUnwindSafe for ConsensusInstance
impl Send for ConsensusInstance
impl Sync for ConsensusInstance
impl Unpin for ConsensusInstance
impl !UnwindSafe for ConsensusInstance
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
Source§impl<T> CastFrom for Twhere
T: Any + 'static,
impl<T> CastFrom for Twhere
T: Any + 'static,
Source§fn ref_any(&self) -> &(dyn Any + 'static)
fn ref_any(&self) -> &(dyn Any + 'static)
Any, which is backed by the type implementing this trait.Source§fn mut_any(&mut self) -> &mut (dyn Any + 'static)
fn mut_any(&mut self) -> &mut (dyn Any + 'static)
Any, which is backed by the type implementing this trait.Source§impl<T> CastFromSync for T
impl<T> CastFromSync for T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more