pub struct InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope,{ /* private fields */ }Expand description
In-memory storage for consensus sessions.
Stores all sessions in RAM using a hash map. This is the default storage implementation and works well for testing or single-node setups. Data is lost when the process exits.
Implementations§
Source§impl<Scope> InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope,
impl<Scope> InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope,
Trait Implementations§
Source§impl<Scope> Clone for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope + Clone,
impl<Scope> Clone for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope + Clone,
Source§fn clone(&self) -> InMemoryConsensusStorage<Scope>
fn clone(&self) -> InMemoryConsensusStorage<Scope>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Scope> ConsensusStorage<Scope> for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope + Clone,
impl<Scope> ConsensusStorage<Scope> for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope + Clone,
async fn save_session( &self, scope: &Scope, session: ConsensusSession, ) -> Result<(), ConsensusError>
async fn get_session( &self, scope: &Scope, proposal_id: u32, ) -> Result<Option<ConsensusSession>, ConsensusError>
async fn remove_session( &self, scope: &Scope, proposal_id: u32, ) -> Result<Option<ConsensusSession>, ConsensusError>
async fn list_scope_sessions( &self, scope: &Scope, ) -> Result<Option<Vec<ConsensusSession>>, ConsensusError>
fn stream_scope_sessions<'a>( &'a self, scope: &'a Scope, ) -> impl Stream<Item = Result<ConsensusSession, ConsensusError>> + Send + 'a
async fn replace_scope_sessions( &self, scope: &Scope, sessions_list: Vec<ConsensusSession>, ) -> Result<(), ConsensusError>
async fn list_scopes(&self) -> Result<Option<Vec<Scope>>, ConsensusError>
async fn update_session<R, F>( &self, scope: &Scope, proposal_id: u32, mutator: F, ) -> Result<R, ConsensusError>
async fn update_scope_sessions<F>( &self, scope: &Scope, mutator: F, ) -> Result<(), ConsensusError>
Source§async fn get_scope_config(
&self,
scope: &Scope,
) -> Result<Option<ScopeConfig>, ConsensusError>
async fn get_scope_config( &self, scope: &Scope, ) -> Result<Option<ScopeConfig>, ConsensusError>
Get scope configuration (defaults for proposals in this scope)
Source§async fn set_scope_config(
&self,
scope: &Scope,
config: ScopeConfig,
) -> Result<(), ConsensusError>
async fn set_scope_config( &self, scope: &Scope, config: ScopeConfig, ) -> Result<(), ConsensusError>
Set scope configuration
Source§async fn update_scope_config<F>(
&self,
scope: &Scope,
updater: F,
) -> Result<(), ConsensusError>
async fn update_scope_config<F>( &self, scope: &Scope, updater: F, ) -> Result<(), ConsensusError>
Update scope configuration
Source§impl<Scope> Default for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope,
impl<Scope> Default for InMemoryConsensusStorage<Scope>where
Scope: ConsensusScope,
Auto Trait Implementations§
impl<Scope> Freeze for InMemoryConsensusStorage<Scope>
impl<Scope> !RefUnwindSafe for InMemoryConsensusStorage<Scope>
impl<Scope> Send for InMemoryConsensusStorage<Scope>
impl<Scope> Sync for InMemoryConsensusStorage<Scope>
impl<Scope> Unpin for InMemoryConsensusStorage<Scope>
impl<Scope> !UnwindSafe for InMemoryConsensusStorage<Scope>
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
Mutably borrows from an owned value. Read more
§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)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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> 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>
Converts
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>
Converts
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