mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Store changes to persist data columns (#6073)
* Store changes to persist data columns. Co-authored-by: dapplion <35266934+dapplion@users.noreply.github.com> * Update to use `eip7594_fork_epoch` for data column slot in Store. * Fix formatting. * Merge branch 'unstable' into data-columns-store # Conflicts: # beacon_node/store/src/lib.rs # consensus/types/src/chain_spec.rs * Minor refactor. * Merge branch 'unstable' into data-columns-store # Conflicts: # beacon_node/store/src/metrics.rs * Init data colum info at PeerDAS epoch instead of Deneb fork epoch. Address review comments. * Remove Deneb-related comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
get_key_for_col, leveldb_store::BytesKey, ColumnIter, ColumnKeyIter, DBColumn, Error,
|
||||
ItemStore, Key, KeyValueStore, KeyValueStoreOp,
|
||||
ItemStore, Key, KeyValueStore, KeyValueStoreOp, RawKeyIter,
|
||||
};
|
||||
use parking_lot::{Mutex, MutexGuard, RwLock};
|
||||
use std::collections::BTreeMap;
|
||||
@@ -100,6 +100,18 @@ impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn iter_raw_keys(&self, column: DBColumn, prefix: &[u8]) -> RawKeyIter {
|
||||
let start_key = BytesKey::from_vec(get_key_for_col(column.as_str(), prefix));
|
||||
let keys = self
|
||||
.db
|
||||
.read()
|
||||
.range(start_key.clone()..)
|
||||
.take_while(|(k, _)| k.starts_with(&start_key))
|
||||
.filter_map(|(k, _)| k.remove_column_variable(column).map(|k| k.to_vec()))
|
||||
.collect::<Vec<_>>();
|
||||
Box::new(keys.into_iter().map(Ok))
|
||||
}
|
||||
|
||||
fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
|
||||
Box::new(self.iter_column(column).map(|res| res.map(|(k, _)| k)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user