pub struct LruPerCpuHashMap<'a, K: Clone, V: Clone> { /* private fields */ }
Expand description
An LRU per-cpu BPF hash map structure
This provides higher level API for BPF maps whose type is
BPF_MAP_TYPE_LRU_PERCPU_HASH
Implementations§
Source§impl<'base, K: Clone, V: Clone> LruPerCpuHashMap<'base, K, V>
impl<'base, K: Clone, V: Clone> LruPerCpuHashMap<'base, K, V>
pub fn new(base: &Map) -> Result<LruPerCpuHashMap<'_, K, V>>
Sourcepub fn set(&self, key: K, values: PerCpuValues<V>) -> Result<()>
pub fn set(&self, key: K, values: PerCpuValues<V>) -> Result<()>
Set per-cpu values
to the BPF map at key
The number of elements in values
should be equal to the number of
possible CPUs. This requirement is automatically fulfilled when
values
is created by
PerCpuValues::new
Err
can be returned if the number of elements is wrong or underlying
bpf_map_update_elem function returns a negative value.
Sourcepub fn get(&self, key: K) -> Option<PerCpuValues<V>>
pub fn get(&self, key: K) -> Option<PerCpuValues<V>>
Get per-cpu values corresponding to the key
from the BPF map
If key
is found, Some([PerCpuValues](./struct.PerCpuValues.html))
is returned.
Sourcepub fn iter<'a>(&'a self) -> MapIter<'a, K, PerCpuValues<V>> ⓘ
pub fn iter<'a>(&'a self) -> MapIter<'a, K, PerCpuValues<V>> ⓘ
Return an iterator over all items in the map
Auto Trait Implementations§
impl<'a, K, V> Freeze for LruPerCpuHashMap<'a, K, V>
impl<'a, K, V> RefUnwindSafe for LruPerCpuHashMap<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for LruPerCpuHashMap<'a, K, V>
impl<'a, K, V> Sync for LruPerCpuHashMap<'a, K, V>
impl<'a, K, V> Unpin for LruPerCpuHashMap<'a, K, V>where
K: Unpin,
impl<'a, K, V> UnwindSafe for LruPerCpuHashMap<'a, K, V>where
K: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more