mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-17 18:58:23 +00:00
Drop unused EthSpec generic from Stores (#9281)
Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
@@ -4,28 +4,24 @@ use crate::{
|
||||
};
|
||||
use parking_lot::RwLock;
|
||||
use std::collections::{BTreeMap, HashSet};
|
||||
use std::marker::PhantomData;
|
||||
use types::*;
|
||||
|
||||
type DBMap = BTreeMap<BytesKey, Vec<u8>>;
|
||||
|
||||
/// A thread-safe `BTreeMap` wrapper.
|
||||
pub struct MemoryStore<E: EthSpec> {
|
||||
pub struct MemoryStore {
|
||||
db: RwLock<DBMap>,
|
||||
_phantom: PhantomData<E>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> MemoryStore<E> {
|
||||
impl MemoryStore {
|
||||
/// Create a new, empty database.
|
||||
pub fn open() -> Self {
|
||||
Self {
|
||||
db: RwLock::new(BTreeMap::new()),
|
||||
_phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
|
||||
impl KeyValueStore for MemoryStore {
|
||||
/// Get the value of some key from the database. Returns `None` if the key does not exist.
|
||||
fn get_bytes(&self, col: DBColumn, key: &[u8]) -> Result<Option<Vec<u8>>, Error> {
|
||||
let column_key = BytesKey::from_vec(get_key_for_col(col, key));
|
||||
@@ -148,4 +144,4 @@ impl<E: EthSpec> KeyValueStore<E> for MemoryStore<E> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> ItemStore<E> for MemoryStore<E> {}
|
||||
impl ItemStore for MemoryStore {}
|
||||
|
||||
Reference in New Issue
Block a user