hotmint-storage
Persistent storage backends for the Hotmint BFT consensus framework.
Implements the BlockStore trait from hotmint-consensus using vsdb (a high-performance embedded KV database backed by MMDB), and provides PersistentConsensusState for crash recovery of critical consensus state.
Components
| Component | Description |
|---|---|
VsdbBlockStore |
Persistent block storage backed by vsdb MapxOrd |
PersistentConsensusState |
Persists view number, locked QC, highest QC, committed height |
Usage
Block Store
use BlockStore;
use VsdbBlockStore;
let store = new;
// genesis block is inserted automatically
// use as a drop-in replacement for MemoryBlockStore
use ;
let shared_store = new;
let engine = new;
Crash Recovery
use ConsensusState;
use PersistentConsensusState;
let pstate = new;
// restore after restart
let mut state = new;
if let Some = pstate.load_current_view
if let Some = pstate.load_locked_qc
if let Some = pstate.load_highest_qc
if let Some = pstate.load_last_committed_height
Data Directory
vsdb stores data in the process working directory by default. Configure a custom location via environment variable or programmatically:
// must be called before any vsdb operation, can only be called once
vsdb_set_base_dir.unwrap;
License
GPL-3.0-only