Reduce locking in Blocktree (#4075)

* Reduce lock contention in blocktree

* Store root slot in separate column
This commit is contained in:
Mark E. Sinclair
2019-05-03 16:46:02 -05:00
committed by GitHub
parent f91627a230
commit ed48d8323c
6 changed files with 217 additions and 172 deletions

View File

@ -119,6 +119,36 @@ impl TypedColumn<Kvs> for cf::Orphans {
type Type = bool;
}
impl Column<Kvs> for cf::Root {
const NAME: &'static str = super::ROOT_CF;
type Index = ();
fn key(_: ()) -> Key {
Key::default()
}
fn index(_: &Key) {}
}
impl TypedColumn<Kvs> for cf::Root {
type Type = u64;
}
impl Column<Kvs> for cf::SlotMeta {
const NAME: &'static str = super::META_CF;
type Index = u64;
fn key(slot: u64) -> Key {
let mut key = Key::default();
BigEndian::write_u64(&mut key.0[8..16], slot);
key
}
fn index(key: &Key) -> u64 {
BigEndian::read_u64(&key.0[8..16])
}
}
impl Column<Kvs> for cf::SlotMeta {
const NAME: &'static str = super::META_CF;
type Index = u64;