Skip to main content

FlatMap

Struct FlatMap 

Source
pub struct FlatMap { /* private fields */ }

Implementations§

Source§

impl FlatMap

Source

pub fn new() -> Self

Source

pub fn from_entries( entries: impl IntoIterator<Item = StoredEntry>, now_ms: u64, ) -> Self

Source

pub fn len(&self) -> usize

Source

pub fn stored_bytes(&self) -> usize

Source

pub fn memory_limit_bytes(&self) -> Option<usize>

Source

pub fn eviction_policy(&self) -> EvictionPolicy

Source

pub fn evictions(&self) -> u64

Source

pub fn is_empty(&self) -> bool

Source

pub fn configure_memory_policy( &mut self, memory_limit_bytes: Option<usize>, eviction_policy: EvictionPolicy, now_ms: u64, )

Source§

impl FlatMap

Source

pub fn delete(&mut self, key: &[u8], now_ms: u64) -> bool

Source

pub fn delete_hashed(&mut self, hash: u64, key: &[u8], _now_ms: u64) -> bool

Source

pub fn delete_hashed_local( &mut self, hash: u64, key: &[u8], now_ms: u64, ) -> bool

Source

pub fn ttl_seconds(&mut self, key: &[u8], now_ms: u64) -> i64

Source

pub fn ttl_millis(&mut self, key: &[u8], now_ms: u64) -> i64

Source

pub fn persist(&mut self, key: &[u8], now_ms: u64) -> bool

Source

pub fn expire(&mut self, key: &[u8], expire_at_ms: u64, now_ms: u64) -> bool

Source

pub fn snapshot_entries(&self, now_ms: u64) -> Vec<StoredEntry>

Source

pub fn process_maintenance(&mut self, now_ms: u64) -> usize

Source

pub fn stats_snapshot( &self, ) -> (TierStatsSnapshot, TierStatsSnapshot, TierStatsSnapshot)

Source§

impl FlatMap

Source

pub fn get_ref_hashed_no_ttl(&mut self, hash: u64, key: &[u8]) -> Option<&[u8]>

Source

pub fn get_ref_hashed_shared( &self, hash: u64, key: &[u8], now_ms: u64, ) -> Option<&[u8]>

&self read path. Skips entry access tracking (LFU/LRU touch). Safe for any caller that does not depend on read-touch tracking — including the shared-store hot path under RwLock::read.

Source

pub fn has_no_ttl_entries(&self) -> bool

Returns true when there are no TTL’d entries — caller can skip a now_millis() call since no entries can expire.

Source

pub fn get_ref_hashed_shared_no_ttl( &self, hash: u64, key: &[u8], ) -> Option<&[u8]>

Source

pub fn with_shared_value_bytes_hashed_no_ttl<F>( &self, hash: u64, key: &[u8], write: &mut F, ) -> bool
where F: FnMut(&SharedBytes),

Source

pub fn get_shared_value_bytes_hashed_no_ttl( &self, hash: u64, key: &[u8], ) -> Option<&SharedBytes>

Source

pub fn get_shared_value_bytes_hashed_tagged_no_ttl( &self, hash: u64, key_tag: u64, key_len: usize, ) -> Option<&SharedBytes>

Source

pub fn with_shared_value_bytes_hashed<F>( &self, hash: u64, key: &[u8], now_ms: u64, write: &mut F, ) -> bool
where F: FnMut(&SharedBytes),

Source

pub fn get_shared_value_bytes_hashed( &self, hash: u64, key: &[u8], now_ms: u64, ) -> Option<&SharedBytes>

Source

pub fn get_value_bytes_hashed( &self, hash: u64, key: &[u8], now_ms: u64, ) -> Option<SharedBytes>

Returns a refcount-only clone of the stored bytes::Bytes. Avoids the Vec<u8> allocation that get_ref_hashed_shared callers do via to_vec. Hot path for multi-direct GET.

Source

pub fn get_value_bytes_hashed_prepared( &self, hash: u64, key: &[u8], key_tag: u64, now_ms: u64, ) -> Option<SharedBytes>

Source

pub fn get_value_bytes_hashed_and_expire( &mut self, hash: u64, key: &[u8], expire_at_ms: u64, now_ms: u64, ) -> Option<SharedBytes>

Returns the current value and updates its expiration while holding the shard write lock. This is the native GETEX primitive.

Source

pub fn with_value_bytes_hashed_and_expire<F>( &mut self, hash: u64, key: &[u8], expire_at_ms: u64, now_ms: u64, write: &mut F, ) -> bool
where F: FnMut(&[u8]),

Calls write with the current value and updates its expiration while holding the shard write lock. This is the borrowed native GETEX path: it avoids the Bytes refcount clone/drop pair needed by get_value_bytes_hashed_and_expire.

Source

pub fn get_ref_hashed_prepared_no_ttl( &mut self, hash: u64, key: &[u8], key_tag: u64, ) -> Option<&[u8]>

Source

pub fn get_ref(&mut self, key: &[u8], now_ms: u64) -> Option<&[u8]>

Source

pub fn get_ref_hashed( &mut self, hash: u64, key: &[u8], now_ms: u64, ) -> Option<&[u8]>

Source

pub fn get_ref_hashed_local( &mut self, hash: u64, key: &[u8], now_ms: u64, ) -> Option<&[u8]>

Source

pub fn get(&mut self, key: &[u8], now_ms: u64) -> Option<Bytes>

Source

pub fn exists(&mut self, key: &[u8], now_ms: u64) -> bool

Source

pub fn begin_read_epoch(&self)

Starts a shard-local read epoch.

While at least one read epoch is active, value replacements and deletes retire old buffers instead of freeing them immediately. That keeps any zero-copy readers pointing at stable memory without introducing shared reference counting.

Source

pub fn end_read_epoch(&self)

Ends a shard-local read epoch and reclaims retired values once the last reader for this shard has exited. Reclamation itself stays on the owner thread and runs lazily from the write path.

Source§

impl FlatMap

Source

pub fn set<K, V>( &mut self, key: K, value: V, expire_at_ms: Option<u64>, now_ms: u64, )
where K: Into<Bytes>, V: Into<Bytes>,

Source

pub fn set_slice( &mut self, key: &[u8], value: &[u8], expire_at_ms: Option<u64>, now_ms: u64, )

Source

pub fn set_bytes_hashed( &mut self, hash: u64, key: &[u8], value: SharedBytes, expire_at_ms: Option<u64>, now_ms: u64, )

Zero-copy SET for the multi-direct hot path: takes value as an already-owned SharedBytes (typically a split_prefix slice from the connection read buffer). Avoids the heap allocation that set_slice_hashed performs to copy value into a new SharedBytes. Key is copied into a Box<[u8]> so the entry retains a tight key allocation (keys are small and don’t benefit from sharing).

Source

pub fn set_hashed<K, V>( &mut self, hash: u64, key: K, value: V, expire_at_ms: Option<u64>, now_ms: u64, )
where K: Into<Bytes>, V: Into<Bytes>,

Source

pub fn set_slice_hashed( &mut self, hash: u64, key: &[u8], value: &[u8], expire_at_ms: Option<u64>, now_ms: u64, )

Source§

impl FlatMap

Source

pub unsafe fn set_slice_hashed_no_ttl_hot( &mut self, hash: u64, key: &[u8], value: &[u8], )

§Safety

The caller must guarantee that this map has exclusive ownership of stored value buffers: no outstanding bytes::Bytes clones and no borrowed value slices may exist while this runs. The 1-shard FCNP server satisfies this by using borrowed response encoding and single-threaded shard ownership.

Source

pub unsafe fn set_slice_hashed_tagged_no_ttl_hot( &mut self, hash: u64, key_tag: u64, key: &[u8], value: &[u8], )

§Safety

Same safety contract as set_slice_hashed_no_ttl_hot. key_tag must be the hash_key_tag_from_hash(hash) value for key.

Source§

impl FlatMap

Source

pub fn set_hashed_local<K, V>( &mut self, hash: u64, key: K, value: V, expire_at_ms: Option<u64>, now_ms: u64, )
where K: Into<Bytes>, V: Into<Bytes>,

Source

pub fn set_slice_hashed_local( &mut self, hash: u64, key: &[u8], value: &[u8], expire_at_ms: Option<u64>, now_ms: u64, )

Source

pub fn set_slice_hashed_tagged_no_ttl_local( &mut self, hash: u64, key_tag: u64, key: &[u8], value: &[u8], )

Source

pub fn set_slice_hashed_tagged_local( &mut self, hash: u64, key_tag: u64, key: &[u8], value: &[u8], expire_at_ms: Option<u64>, now_ms: u64, )

Trait Implementations§

Source§

impl Debug for FlatMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FlatMap

Source§

fn default() -> FlatMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more