New state pruning algorithm

This commit is contained in:
Michael Sproul
2022-03-02 15:40:56 +11:00
parent ebe8e30171
commit 64f0e3e13d
6 changed files with 165 additions and 75 deletions

View File

@@ -75,6 +75,15 @@ pub trait KeyValueStore<E: EthSpec>: Sync + Send + Sized + 'static {
/// Compact the database, freeing space used by deleted items.
fn compact(&self) -> Result<(), Error>;
/// Iterate through all values in a particular column.
fn iter_column<'a>(
&'a self,
_column: DBColumn,
) -> Box<dyn Iterator<Item = Result<(Hash256, Vec<u8>), Error>> + 'a> {
// Default impl for non LevelDB databases
Box::new(std::iter::empty())
}
}
pub fn get_key_for_col(column: &str, key: &[u8]) -> Vec<u8> {
@@ -144,6 +153,7 @@ pub enum StoreOp<'a, E: EthSpec> {
DeleteStateTemporaryFlag(Hash256),
DeleteBlock(Hash256),
DeleteState(Hash256, Option<Slot>),
KeyValueOp(KeyValueStoreOp),
}
/// A unique column identifier.