solana_bucket_map::bucket_api

Struct BucketApi

Source
pub struct BucketApi<T: Clone + Copy + PartialEq + 'static> {
    pub stats: Arc<BucketMapStats>,
    /* private fields */
}

Fields§

§stats: Arc<BucketMapStats>

Implementations§

Source§

impl<T: Clone + Copy + PartialEq + Debug> BucketApi<T>

Source

pub fn items_in_range<R>(&self, range: &Option<&R>) -> Vec<BucketItem<T>>
where R: RangeBounds<Pubkey>,

Get the items for bucket

Source

pub fn keys(&self) -> Vec<Pubkey>

Get the Pubkeys

Source

pub fn read_value(&self, key: &Pubkey) -> Option<(Vec<T>, RefCount)>

Get the values for Pubkey key

Source

pub fn bucket_len(&self) -> u64

Source

pub fn delete_key(&self, key: &Pubkey)

Source

pub fn insert(&self, pubkey: &Pubkey, value: (&[T], RefCount))

Source

pub fn grow(&self, err: BucketMapError)

Source

pub fn set_anticipated_count(&self, count: u64)

caller can specify that the index needs to hold approximately count entries soon. This gives a hint to the resizing algorithm and prevents repeated incremental resizes.

Source

pub fn batch_insert_non_duplicates( &self, items: &[(Pubkey, T)], ) -> Vec<(usize, T)>

batch insert of items. Assumption is a single slot list element and ref_count == 1. For any pubkeys that already exist, the index in items of the failed insertion and the existing data (previously put in the index) are returned.

Source

pub fn update<F>(&self, key: &Pubkey, updatefn: F)
where F: FnMut(Option<(&[T], RefCount)>) -> Option<(Vec<T>, RefCount)>,

Source

pub fn try_write( &self, pubkey: &Pubkey, value: (&[T], RefCount), ) -> Result<(), BucketMapError>

Auto Trait Implementations§

§

impl<T> !Freeze for BucketApi<T>

§

impl<T> RefUnwindSafe for BucketApi<T>

§

impl<T> Send for BucketApi<T>
where T: Sync,

§

impl<T> Sync for BucketApi<T>
where T: Sync,

§

impl<T> Unpin for BucketApi<T>

§

impl<T> UnwindSafe for BucketApi<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V