fix some basic compile issues
This commit is contained in:
parent
4f353c5528
commit
80d751454a
|
@ -30,6 +30,7 @@ use {
|
|||
},
|
||||
thiserror::Error,
|
||||
};
|
||||
use crate::compressed_secondary_index::prefix_to_bound;
|
||||
|
||||
pub const ITER_BATCH_SIZE: usize = 1000;
|
||||
pub const BINS_DEFAULT: usize = 8192;
|
||||
|
@ -1136,7 +1137,7 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U> {
|
|||
{
|
||||
// TODO: port metrics from do_scan_accounts
|
||||
|
||||
let prefix_set = index.get(index_key);
|
||||
let mut prefix_set = index.get(index_key);
|
||||
// pre-sort prefixes, so they have the same order as bins
|
||||
prefix_set.sort();
|
||||
|
||||
|
@ -1152,7 +1153,7 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U> {
|
|||
for (pk, list) in entries {
|
||||
let list_r = &list.slot_list.read().unwrap();
|
||||
if let Some(index) = self.latest_slot(Some(ancestors), list_r, max_root) {
|
||||
func(&pubkey, (&list_r[index].1, list_r[index].0));
|
||||
func(&index_key, (&list_r[index].1, list_r[index].0));
|
||||
}
|
||||
if config.is_aborted() {
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
use std::{hash::Hasher, mem::transmute, ops::RangeBounds};
|
||||
use std::collections::Bound;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use bv::BitsExt;
|
||||
use dashmap::{lock::RwLock, DashMap, DashSet};
|
||||
use solana_sdk::pubkey::{self, Pubkey};
|
||||
use crate::secondary_index::SecondaryIndexStats;
|
||||
|
||||
|
||||
pub (crate) fn u64_prefix(msg: &[u8]) -> u64 {
|
||||
|
@ -59,12 +62,14 @@ pub (crate) fn group_prefixes(prefix_set: &mut Vec<u64>, group_size_bits: u8) ->
|
|||
groups
|
||||
}
|
||||
|
||||
pub (crate) struct PrefixHasher {
|
||||
// TOOD rename - this is a hasher, not a hash!
|
||||
#[derive(Debug)]
|
||||
pub (crate) struct PrefixHash {
|
||||
hash: u64
|
||||
}
|
||||
|
||||
// TODO: read hashbrown::hash_map
|
||||
impl Hasher for PrefixHasher {
|
||||
impl Hasher for PrefixHash {
|
||||
#[inline]
|
||||
fn write(&mut self, msg: &[u8]) {
|
||||
self.hash = u64_prefix(msg);
|
||||
|
@ -83,8 +88,8 @@ pub struct CompressedSecondaryIndex {
|
|||
metrics_name: &'static str,
|
||||
stats: SecondaryIndexStats,
|
||||
|
||||
pub index: DashMap<Pubkey, DashSet<u64, PrefixHasher>, PrefixHasher>,
|
||||
pub reverse_index: DashMap<u64, RwLock<Vec<u64>>, PrefixHasher>,
|
||||
pub index: DashMap<Pubkey, DashSet<u64, PrefixHash>, PrefixHash>,
|
||||
pub reverse_index: DashMap<u64, RwLock<Vec<u64>>, PrefixHash>,
|
||||
}
|
||||
|
||||
impl CompressedSecondaryIndex {
|
||||
|
|
|
@ -36,7 +36,7 @@ impl PubkeyBinCalculator24 {
|
|||
}
|
||||
|
||||
pub(crate) fn bin_from_u64_prefix(&self, prefix: u64) -> usize {
|
||||
let as_ref = u64.as_bytes();
|
||||
let as_ref = prefix.as_bytes();
|
||||
((as_ref[0] as usize) << 16 | (as_ref[1] as usize) << 8 | (as_ref[2] as usize))
|
||||
>> self.shift_bits
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue