pub struct PersistentConsensusState { /* private fields */ }Expand description
Persistent consensus state store backed by vsdb
Implementations§
Source§impl PersistentConsensusState
impl PersistentConsensusState
Sourcepub fn open(data_dir: &Path) -> Result<Self>
pub fn open(data_dir: &Path) -> Result<Self>
Opens an existing consensus state store or creates a fresh one.
Must be called after vsdb::vsdb_set_base_dir.
The instance ID of the internal collection is stored in
data_dir/consensus_state.meta (8 bytes: one little-endian u64).
On first run the file is created; on subsequent runs the collection
is recovered via MapxOrd::from_meta.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new in-memory consensus state without any persistent meta file.
Intended for unit tests only; use Self::open in production.
pub fn save_current_view(&mut self, view: ViewNumber)
pub fn load_current_view(&self) -> Option<ViewNumber>
pub fn save_locked_qc(&mut self, qc: &QuorumCertificate)
pub fn load_locked_qc(&self) -> Option<QuorumCertificate>
pub fn save_highest_qc(&mut self, qc: &QuorumCertificate)
pub fn load_highest_qc(&self) -> Option<QuorumCertificate>
pub fn save_last_committed_height(&mut self, height: Height)
pub fn load_last_committed_height(&self) -> Option<Height>
pub fn save_current_epoch(&mut self, epoch: &Epoch)
pub fn load_current_epoch(&self) -> Option<Epoch>
pub fn save_last_app_hash(&mut self, hash: BlockHash)
pub fn load_last_app_hash(&self) -> Option<BlockHash>
pub fn flush(&self)
Trait Implementations§
Source§impl Default for PersistentConsensusState
impl Default for PersistentConsensusState
Source§impl StatePersistence for PersistentConsensusState
impl StatePersistence for PersistentConsensusState
fn save_current_view(&mut self, view: ViewNumber)
fn save_locked_qc(&mut self, qc: &QuorumCertificate)
fn save_highest_qc(&mut self, qc: &QuorumCertificate)
fn save_last_committed_height(&mut self, height: Height)
fn save_current_epoch(&mut self, epoch: &Epoch)
fn save_last_app_hash(&mut self, hash: BlockHash)
fn flush(&self)
Auto Trait Implementations§
impl !Freeze for PersistentConsensusState
impl RefUnwindSafe for PersistentConsensusState
impl Send for PersistentConsensusState
impl Sync for PersistentConsensusState
impl Unpin for PersistentConsensusState
impl UnsafeUnpin for PersistentConsensusState
impl UnwindSafe for PersistentConsensusState
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