Type Alias massa_db_worker::MassaDB

source ·
pub type MassaDB = RawMassaDB<Slot, SlotSerializer, SlotDeserializer>;
Expand description

Wrapped RocksDB database

In our instance, we use Slot as the ChangeID

Aliased Type§

struct MassaDB {
    pub db: DBCommon<SingleThreaded, DBWithThreadModeInner>,
    pub config: MassaDBConfig,
    pub change_history: BTreeMap<Slot, BTreeMap<Vec<u8>, Option<Vec<u8>>>>,
    pub change_history_versioning: BTreeMap<Slot, BTreeMap<Vec<u8>, Option<Vec<u8>>>>,
    pub change_id_serializer: SlotSerializer,
    pub change_id_deserializer: SlotDeserializer,
    pub current_batch: Arc<Mutex<RawMutex, WriteBatchWithTransaction<false>>>,
    pub change_history_sizes: BTreeMap<Slot, (usize, usize)>,
}

Fields§

§db: DBCommon<SingleThreaded, DBWithThreadModeInner>

The rocksdb instance

§config: MassaDBConfig

configuration for the RawMassaDB

§change_history: BTreeMap<Slot, BTreeMap<Vec<u8>, Option<Vec<u8>>>>

In change_history, we keep the latest changes made to the database, useful for streaming them to a client.

§change_history_versioning: BTreeMap<Slot, BTreeMap<Vec<u8>, Option<Vec<u8>>>>

same as change_history but for versioning

§change_id_serializer: SlotSerializer

A serializer for the ChangeID type

§change_id_deserializer: SlotDeserializer

A deserializer for the ChangeID type

§current_batch: Arc<Mutex<RawMutex, WriteBatchWithTransaction<false>>>

The current RocksDB batch of the database, in a Mutex to share it

§change_history_sizes: BTreeMap<Slot, (usize, usize)>

If metrics are enabled, we keep track of the size of the changes associated to each change_id