Skip to main content

LocalEmbeddedStore

Struct LocalEmbeddedStore 

Source
pub struct LocalEmbeddedStore { /* private fields */ }
Expand description

Worker-owned view of the shards assigned to one local server worker.

This is the sharded counterpart to EmbeddedStore. An EmbeddedStore can be split into one WorkerLocalEmbeddedStore per worker. Each handle owns only its assigned shards and exposes local operations through &mut self, letting hot paths skip shared RwLock traffic when the key or session route belongs to this worker.

Methods ending in _if_local return LocalRouteError when a key/session routes to another worker. Methods ending in _local assume the caller has already checked routing and use debug assertions for that contract.

Implementations§

Source§

impl WorkerLocalEmbeddedStore

Source

pub fn from_owned_worker(inner: OwnedEmbeddedWorkerShards) -> Self

Wrap the shard bundle assigned to one worker.

Source

pub fn worker_shard_count(&self) -> usize

Source

pub fn shard_count(&self) -> usize

Source

pub fn route_mode(&self) -> EmbeddedRouteMode

Source

pub fn owns_shard(&self, shard_id: usize) -> bool

Source

pub fn route_key(&self, key: &[u8]) -> EmbeddedKeyRoute

Source

pub fn prepare_point_key(&self, key: &[u8]) -> PreparedPointKey

Source

pub fn prepare_point_key_if_local( &self, key: &[u8], ) -> Result<PreparedPointKey, LocalRouteError>

Source

pub fn route_session(&self, session_prefix: &[u8]) -> EmbeddedSessionRoute

Source

pub fn key_is_local(&self, key: &[u8]) -> bool

Source

pub fn session_is_local(&self, session_prefix: &[u8]) -> bool

Source

pub fn stream_session_transfer<B, F>( &mut self, request: &CudaSessionTransferRequest, on_chunk: F, ) -> ControlFlow<B, CudaSessionTransferStats>
where F: for<'a> FnMut(CudaSessionChunkEvent<'a>) -> ControlFlow<B>,

Source

pub fn stream_session_transfer_if_local<B, F>( &mut self, request: &CudaSessionTransferRequest, on_chunk: F, ) -> Result<ControlFlow<B, CudaSessionTransferStats>, LocalRouteError>
where F: for<'a> FnMut(CudaSessionChunkEvent<'a>) -> ControlFlow<B>,

Source§

impl WorkerLocalEmbeddedStore

Source

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

Source

pub fn delete_if_local(&mut self, key: &[u8]) -> Result<bool, LocalRouteError>

Source

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

Source

pub fn exists_if_local(&mut self, key: &[u8]) -> Result<bool, LocalRouteError>

Source

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

Source

pub fn ttl_seconds_if_local( &mut self, key: &[u8], ) -> Result<i64, LocalRouteError>

Source

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

Source

pub fn pttl_millis_if_local( &mut self, key: &[u8], ) -> Result<i64, LocalRouteError>

Source

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

Source

pub fn expire_if_local( &mut self, key: &[u8], expire_at_ms: u64, ) -> Result<bool, LocalRouteError>

Source

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

Source

pub fn persist_if_local(&mut self, key: &[u8]) -> Result<bool, LocalRouteError>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn process_maintenance(&mut self) -> usize

Source

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

Source§

impl WorkerLocalEmbeddedStore

Source

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

Source

pub fn get_if_local( &mut self, key: &[u8], ) -> Result<Option<Bytes>, LocalRouteError>

Source

pub fn get_view<'a>(&'a mut self, key: &[u8]) -> WorkerLocalReadView<'a>

Source

pub fn get_owned_view_local(&mut self, key: &[u8]) -> OwnedEmbeddedReadView

Source

pub fn get_view_if_local<'a>( &'a mut self, key: &[u8], ) -> Result<WorkerLocalReadView<'a>, LocalRouteError>

Source

pub fn get_view_routed_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> WorkerLocalReadView<'a>

Source

pub fn get_view_routed_no_ttl<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> WorkerLocalReadView<'a>

Source

pub fn get_view_routed_no_ttl_if_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> Result<WorkerLocalReadView<'a>, LocalRouteError>

Source

pub fn get_point_view_routed_no_ttl_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> WorkerLocalReadView<'a>

Source

pub fn get_point_ref_routed_no_ttl_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> Option<&'a [u8]>

Source

pub fn get_prepared_point_view_no_ttl_local<'a>( &'a mut self, prepared: &PreparedPointKey, ) -> WorkerLocalReadView<'a>

Source

pub fn get_prepared_point_ref_no_ttl_local<'a>( &'a mut self, prepared: &PreparedPointKey, ) -> Option<&'a [u8]>

Source

pub fn get_view_routed_no_ttl_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> WorkerLocalReadView<'a>

Source

pub fn get_ref_routed_no_ttl_if_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> Result<Option<&'a [u8]>, LocalRouteError>

Source

pub fn get_ref_routed_no_ttl_local<'a>( &'a mut self, route: EmbeddedKeyRoute, key: &[u8], ) -> Option<&'a [u8]>

Source

pub fn batch_get(&mut self, keys: Vec<Bytes>) -> Vec<Option<Bytes>>

Source

pub fn batch_get_if_local( &mut self, keys: Vec<Bytes>, ) -> Result<Vec<Option<Bytes>>, LocalRouteError>

Source

pub fn batch_get_view<'a>( &'a mut self, keys: &[Bytes], ) -> WorkerLocalBatchReadView<'a>

Source

pub fn batch_get_owned_view_local( &mut self, keys: &[Bytes], ) -> OwnedEmbeddedBatchReadView

Source

pub fn batch_get_view_if_local<'a>( &'a mut self, keys: &[Bytes], ) -> Result<WorkerLocalBatchReadView<'a>, LocalRouteError>

Source

pub fn batch_get_session_view<'a>( &'a mut self, session_prefix: &[u8], keys: &[Bytes], ) -> WorkerLocalSessionBatchView<'a>

Source

pub fn batch_get_session_view_if_local<'a>( &'a mut self, session_prefix: &[u8], keys: &[Bytes], ) -> Result<WorkerLocalSessionBatchView<'a>, LocalRouteError>

Source

pub fn batch_get_session_owned_view_local( &mut self, session_prefix: &[u8], keys: &[Bytes], ) -> OwnedEmbeddedBatchReadView

Source

pub fn batch_get_session_view_prehashed_if_local<'a>( &'a mut self, session_prefix: &[u8], keys: &[Bytes], key_hashes: &[u64], ) -> Result<WorkerLocalSessionBatchView<'a>, LocalRouteError>

Source

pub fn batch_get_session_owned_view_prehashed_local( &mut self, session_prefix: &[u8], keys: &[Bytes], key_hashes: &[u64], ) -> OwnedEmbeddedBatchReadView

Source

pub fn batch_get_session_packed( &mut self, session_prefix: &[u8], keys: &[Bytes], ) -> PackedBatch

Source

pub fn batch_get_session_packed_if_local( &mut self, session_prefix: &[u8], keys: &[Bytes], ) -> Result<PackedBatch, LocalRouteError>

Source

pub fn batch_get_session_packed_view( &mut self, session_prefix: &[u8], keys: &[Bytes], ) -> Option<OwnedEmbeddedSessionPackedView>

Source

pub fn batch_get_session_packed_view_if_local( &mut self, session_prefix: &[u8], keys: &[Bytes], ) -> Result<Option<OwnedEmbeddedSessionPackedView>, LocalRouteError>

Source

pub fn batch_get_session_packed_view_prehashed_if_local( &mut self, session_prefix: &[u8], keys: &[Bytes], key_hashes: &[u64], ) -> Result<Option<OwnedEmbeddedSessionPackedView>, LocalRouteError>

Source

pub fn batch_get_packed(&mut self, keys: &[Bytes]) -> PackedBatch

Source

pub fn batch_get_packed_if_local( &mut self, keys: &[Bytes], ) -> Result<PackedBatch, LocalRouteError>

Source§

impl WorkerLocalEmbeddedStore

Source

pub fn install_local(self) -> Result<(), LocalStoreInstallError>

Install this store into the current thread’s local worker slot.

Only one worker-local store can be installed per thread. Use crate::storage::take_local_embedded_store to remove it again.

Source§

impl WorkerLocalEmbeddedStore

Source

pub fn set(&mut self, key: Bytes, value: Bytes, ttl_ms: Option<u64>)

Source

pub fn set_slice_no_ttl(&mut self, key: &[u8], value: &[u8])

Source

pub fn set_slice_routed_no_ttl_local( &mut self, route: EmbeddedKeyRoute, key: &[u8], value: &[u8], )

Source

pub fn set_slice_routed_local( &mut self, route: EmbeddedKeyRoute, key: &[u8], value: &[u8], ttl_ms: Option<u64>, )

Source

pub fn set_prepared_point_slice_no_ttl_local( &mut self, prepared: &PreparedPointKey, value: &[u8], )

Source

pub fn set_slice_no_ttl_if_local( &mut self, key: &[u8], value: &[u8], ) -> Result<(), LocalRouteError>

Source

pub fn set_slice_routed_no_ttl_if_local( &mut self, route: EmbeddedKeyRoute, key: &[u8], value: &[u8], ) -> Result<(), LocalRouteError>

Source

pub fn set_if_local( &mut self, key: Bytes, value: Bytes, ttl_ms: Option<u64>, ) -> Result<(), LocalRouteError>

Source

pub fn batch_set(&mut self, items: Vec<(Bytes, Bytes)>, ttl_ms: Option<u64>)

Source

pub fn batch_set_if_local( &mut self, items: Vec<(Bytes, Bytes)>, ttl_ms: Option<u64>, ) -> Result<(), LocalRouteError>

Source

pub fn batch_set_session_owned_no_ttl( &mut self, session_prefix: Bytes, items: Vec<(Bytes, Bytes)>, )

Source

pub fn batch_set_session_owned_no_ttl_if_local( &mut self, session_prefix: Bytes, items: Vec<(Bytes, Bytes)>, ) -> Result<(), LocalRouteError>

Source

pub fn batch_set_session_packed_no_ttl(&mut self, packed: PackedSessionWrite)

Source

pub fn batch_set_session_packed_no_ttl_if_local( &mut self, packed: PackedSessionWrite, ) -> Result<(), LocalRouteError>

Trait Implementations§

Source§

impl Debug for WorkerLocalEmbeddedStore

Source§

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

Formats the value using the given formatter. 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