pub struct MemoryStateTransitionStore { /* private fields */ }Expand description
In-memory state transition store (for testing/development) For production, implement FileStateTransitionStore or DatabaseStateTransitionStore
Implementations§
Source§impl MemoryStateTransitionStore
impl MemoryStateTransitionStore
pub fn new() -> Self
Sourcepub fn record_transition(
&self,
transition: StateTransition,
) -> Result<u64, String>
pub fn record_transition( &self, transition: StateTransition, ) -> Result<u64, String>
Record a committed state transition Returns the store index assigned to this transition
Sourcepub fn get_by_transaction_id(
&self,
transaction_id: &str,
) -> Option<StateTransitionRecord>
pub fn get_by_transaction_id( &self, transaction_id: &str, ) -> Option<StateTransitionRecord>
Get a transition by transaction ID
Sourcepub fn get_by_index(&self, store_index: u64) -> Option<StateTransitionRecord>
pub fn get_by_index(&self, store_index: u64) -> Option<StateTransitionRecord>
Get a transition by store index
Sourcepub fn get_range(
&self,
start_index: u64,
end_index: u64,
) -> Vec<StateTransitionRecord>
pub fn get_range( &self, start_index: u64, end_index: u64, ) -> Vec<StateTransitionRecord>
Get transitions in range [start_index, end_index)
Sourcepub fn get_from_version(&self, state_hash: &str) -> Vec<StateTransitionRecord>
pub fn get_from_version(&self, state_hash: &str) -> Vec<StateTransitionRecord>
Find transitions that led from a specific state version
Sourcepub fn get_to_version(&self, state_hash: &str) -> Option<StateTransitionRecord>
pub fn get_to_version(&self, state_hash: &str) -> Option<StateTransitionRecord>
Find the transition that led to a specific state version
Sourcepub fn iter(&self) -> Vec<StateTransitionRecord>
pub fn iter(&self) -> Vec<StateTransitionRecord>
Iterate over all transitions in the store
Sourcepub fn contains_transaction_id(&self, transaction_id: &str) -> bool
pub fn contains_transaction_id(&self, transaction_id: &str) -> bool
Check if a transaction has been recorded
Sourcepub fn get_transition_chain(
&self,
from_state_hash: &str,
) -> Vec<StateTransitionRecord>
pub fn get_transition_chain( &self, from_state_hash: &str, ) -> Vec<StateTransitionRecord>
Get the chain of transitions from a starting state to the current state Returns transitions in order
Trait Implementations§
Source§impl Clone for MemoryStateTransitionStore
impl Clone for MemoryStateTransitionStore
Auto Trait Implementations§
impl Freeze for MemoryStateTransitionStore
impl RefUnwindSafe for MemoryStateTransitionStore
impl Send for MemoryStateTransitionStore
impl Sync for MemoryStateTransitionStore
impl Unpin for MemoryStateTransitionStore
impl UnsafeUnpin for MemoryStateTransitionStore
impl UnwindSafe for MemoryStateTransitionStore
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
Mutably borrows from an owned value. Read more