implements generic lookups into gossip crds table (#18765)
This commit adds CrdsEntry trait which allows generic lookups into crds table. For example to get ContactInfo or LowestSlot associated with a Pubkey, the lookup code would be respectively: crds.get::<&ContactInfo>(pubkey) crds.get::<&LowestSlot>(pubkey)
This commit is contained in:
@@ -21,7 +21,7 @@ fn new_test_crds_value<R: Rng>(rng: &mut R) -> VersionedCrdsValue {
|
||||
let label = value.label();
|
||||
let mut crds = Crds::default();
|
||||
crds.insert(value, timestamp()).unwrap();
|
||||
crds.get(&label).cloned().unwrap()
|
||||
crds.get::<&VersionedCrdsValue>(&label).cloned().unwrap()
|
||||
}
|
||||
|
||||
fn bench_crds_shards_find(bencher: &mut Bencher, num_values: usize, mask_bits: u32) {
|
||||
|
Reference in New Issue
Block a user