Skip to main content

EmbeddedStore

Struct EmbeddedStore 

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

Shared embedded in-memory database.

EmbeddedStore is internally sharded and can be shared across threads. It offers byte-string key/value methods, Redis object helpers, TTL management, batch reads and writes, and session-oriented packed transfer APIs.

Implementations§

Source§

impl EmbeddedStore

Source

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

Returns owned values for keys in request order.

Source

pub fn batch_get_view(&self, keys: &[Bytes]) -> EmbeddedBatchReadView

Returns owned views for a generic batch.

This path may touch multiple shards under full_key routing; each hit is materialized into an owned bytes::Bytes handle.

Source

pub fn batch_get_session( &self, session_prefix: &[u8], keys: &[Bytes], ) -> Vec<Option<Bytes>>

Retrieves a session-scoped batch from a known shard without rediscovering placement from every full chunk key.

Source

pub fn batch_get_session_prehashed( &self, session_prefix: &[u8], keys: &[Bytes], key_hashes: &[u64], ) -> Vec<Option<Bytes>>

Source

pub fn batch_get_session_routed( &self, route: EmbeddedSessionRoute, keys: &[Bytes], ) -> Vec<Option<Bytes>>

Retrieves a session-scoped batch from a precomputed shard route.

Source

pub fn batch_get_session_view( &self, session_prefix: &[u8], keys: &[Bytes], ) -> EmbeddedSessionBatchView

Returns owned views for a session-scoped batch.

Session-slot values are copied into owned handles so the returned view remains valid after later session updates.

Source

pub fn batch_get_session_view_prehashed( &self, session_prefix: &[u8], keys: &[Bytes], key_hashes: &[u64], ) -> EmbeddedSessionBatchView

Source

pub fn batch_get_session_view_routed( &self, route: EmbeddedSessionRoute, keys: &[Bytes], ) -> EmbeddedSessionBatchView

Returns owned views for a session-scoped batch from a precomputed shard route.

Source

pub fn batch_get_session_view_prehashed_routed( &self, route: EmbeddedSessionRoute, keys: &[Bytes], key_hashes: &[u64], ) -> EmbeddedSessionBatchView

Returns owned views for a session-scoped batch from a precomputed shard route and precomputed full-key hashes.

Source

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

Retrieves a generic packed batch. This is still copy-out, but it packs all returned bytes into one contiguous buffer to minimize object churn.

Source

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

Retrieves a session-scoped packed batch from a known shard.

Source

pub fn batch_get_session_packed_routed( &self, route: EmbeddedSessionRoute, keys: &[Bytes], ) -> PackedBatch

Retrieves a session-scoped packed batch from a precomputed shard route.

Source§

impl EmbeddedStore

Source

pub fn new(shard_count: usize) -> Self

Creates an embedded store with full-key routing.

Source

pub fn with_route_mode( shard_count: usize, route_mode: EmbeddedRouteMode, ) -> Self

Creates an embedded store with an explicit routing mode.

Source

pub fn shard_count(&self) -> usize

Returns the number of storage shards.

Source

pub fn len(&self) -> usize

Returns the number of currently live keys and session entries.

Source

pub fn key_snapshot(&self) -> Vec<Bytes>

Returns a sorted snapshot of currently live keys.

Source

pub fn entry_snapshot(&self) -> Vec<StoredEntry>

Returns currently live string entries for persistence or replication.

Redis object values are intentionally excluded; the native replication stream v1 covers byte-string cache mutations.

Source

pub fn stored_bytes(&self) -> usize

Returns the approximate number of bytes stored in string values.

Source

pub fn configure_memory_policy( &self, per_shard_memory_limit_bytes: Option<usize>, eviction_policy: EvictionPolicy, )

Applies a per-shard memory budget and eviction policy.

Source

pub fn is_empty(&self) -> bool

Returns true when the store has no live keys.

Source

pub fn route_mode(&self) -> EmbeddedRouteMode

Returns the configured route mode.

Source

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

Computes the route for a session prefix.

Source

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

Computes the route for a key.

Source

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

Precomputes route and fingerprint metadata for repeated point lookups.

Source§

impl EmbeddedStore

Source

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

Deletes a key and returns true when a value or object was removed.

Source

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

Returns true when key currently exists.

Source

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

Returns Redis-style TTL in seconds: -2 for missing, -1 for no TTL.

Source

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

Returns Redis-style TTL in milliseconds: -2 for missing, -1 for no TTL.

Source

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

Removes the TTL from a key and returns true when a TTL was cleared.

Source

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

Sets an absolute expiration timestamp in Unix milliseconds.

Source

pub fn redis_type(&self, key: &[u8]) -> &'static str

Returns the Redis type name for a key, or "none" when it is missing.

Source

pub fn object_encoding(&self, key: &[u8]) -> Option<&'static str>

Returns the Redis object encoding name for a key when it exists.

Source

pub fn shard_stats_snapshot(&self) -> Vec<ShardStatsSnapshot>

Returns per-shard statistics snapshots.

Source

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

Returns aggregate hot, warm, and cold tier statistics.

Source

pub fn process_maintenance(&self) -> usize

Runs maintenance on every shard and returns the number of expired entries.

Source

pub fn restore_entries<I>(&self, entries: I)
where I: IntoIterator<Item = StoredEntry>,

Restores persisted entries, skipping records that are already expired.

Source§

impl EmbeddedStore

Source

pub fn has_redis_objects(&self) -> bool

Returns true when Redis object containers are present.

Source

pub fn get_string_value_into<F>( &self, key: &[u8], write: F, ) -> RedisStringLookup
where F: FnMut(&Bytes),

Source

pub fn hset(&self, key: &[u8], field: &[u8], value: &[u8]) -> RedisObjectResult

Source

pub fn hset_many( &self, key: &[u8], fields: &[(&[u8], &[u8])], ) -> RedisObjectResult

Source

pub fn hget(&self, key: &[u8], field: &[u8]) -> RedisObjectResult

Source

pub fn hexists(&self, key: &[u8], field: &[u8]) -> RedisObjectResult

Source

pub fn hdel(&self, key: &[u8], field: &[u8]) -> RedisObjectResult

Source

pub fn hdel_many(&self, key: &[u8], fields: &[&[u8]]) -> RedisObjectResult

Source

pub fn hlen(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn hmget(&self, key: &[u8], fields: &[&[u8]]) -> RedisObjectResult

Source

pub fn hkeys(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn hvals(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn hgetall(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn hsetnx( &self, key: &[u8], field: &[u8], value: &[u8], ) -> RedisObjectResult

Source

pub fn hincrby(&self, key: &[u8], field: &[u8], delta: i64) -> RedisObjectResult

Source

pub fn hincrbyfloat( &self, key: &[u8], field: &[u8], delta: f64, ) -> RedisObjectResult

Source

pub fn hrandfield( &self, key: &[u8], count: Option<i64>, with_values: bool, ) -> RedisObjectResult

Source

pub fn lpush(&self, key: &[u8], values: &[&[u8]]) -> RedisObjectResult

Source

pub fn rpush(&self, key: &[u8], values: &[&[u8]]) -> RedisObjectResult

Source

pub fn lpushx(&self, key: &[u8], values: &[&[u8]]) -> RedisObjectResult

Source

pub fn rpushx(&self, key: &[u8], values: &[&[u8]]) -> RedisObjectResult

Source

pub fn lpop(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn rpop(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn lpop_count(&self, key: &[u8], count: usize) -> RedisObjectResult

Source

pub fn rpop_count(&self, key: &[u8], count: usize) -> RedisObjectResult

Source

pub fn llen(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn lindex(&self, key: &[u8], index: i64) -> RedisObjectResult

Source

pub fn lrange(&self, key: &[u8], start: i64, stop: i64) -> RedisObjectResult

Source

pub fn lset(&self, key: &[u8], index: i64, value: &[u8]) -> RedisObjectResult

Source

pub fn lrem(&self, key: &[u8], count: i64, value: &[u8]) -> RedisObjectResult

Source

pub fn ltrim(&self, key: &[u8], start: i64, stop: i64) -> RedisObjectResult

Source

pub fn linsert( &self, key: &[u8], before: bool, pivot: &[u8], value: &[u8], ) -> RedisObjectResult

Source

pub fn sadd(&self, key: &[u8], members: &[&[u8]]) -> RedisObjectResult

Source

pub fn srem(&self, key: &[u8], members: &[&[u8]]) -> RedisObjectResult

Source

pub fn sismember(&self, key: &[u8], member: &[u8]) -> RedisObjectResult

Source

pub fn smismember(&self, key: &[u8], members: &[&[u8]]) -> RedisObjectResult

Source

pub fn scard(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn smembers(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn set_members(&self, key: &[u8]) -> Result<Vec<Bytes>, RedisObjectError>

Source

pub fn spop(&self, key: &[u8], count: Option<usize>) -> RedisObjectResult

Source

pub fn srandmember(&self, key: &[u8], count: Option<i64>) -> RedisObjectResult

Source

pub fn zadd(&self, key: &[u8], score: f64, member: &[u8]) -> RedisObjectResult

Source

pub fn zadd_cond( &self, key: &[u8], score: f64, member: &[u8], nx: bool, xx: bool, gt: bool, lt: bool, ch: bool, incr: bool, ) -> RedisObjectResult

Source

pub fn zrem(&self, key: &[u8], member: &[u8]) -> RedisObjectResult

Source

pub fn zrem_many(&self, key: &[u8], members: &[&[u8]]) -> RedisObjectResult

Source

pub fn zscore(&self, key: &[u8], member: &[u8]) -> RedisObjectResult

Source

pub fn zmscore(&self, key: &[u8], members: &[&[u8]]) -> RedisObjectResult

Source

pub fn zincrby( &self, key: &[u8], delta: f64, member: &[u8], ) -> RedisObjectResult

Source

pub fn zcard(&self, key: &[u8]) -> RedisObjectResult

Source

pub fn zrange(&self, key: &[u8], start: i64, stop: i64) -> RedisObjectResult

Source

pub fn zentries( &self, key: &[u8], ) -> Result<Vec<(Bytes, f64)>, RedisObjectError>

Source

pub fn zrank(&self, key: &[u8], member: &[u8], rev: bool) -> RedisObjectResult

Source

pub fn zcount(&self, key: &[u8], min: f64, max: f64) -> RedisObjectResult

Source

pub fn zpop(&self, key: &[u8], count: usize, max: bool) -> RedisObjectResult

Source

pub fn rename_key( &self, source: &[u8], dest: &[u8], nx: bool, ) -> Result<bool, RedisObjectError>

Source§

impl EmbeddedStore

Source§

impl EmbeddedStore

Source

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

Returns an owned copy of the value for key.

Source

pub unsafe fn get_blob_string_into_single_threaded( &self, key: &[u8], out: &mut BytesMut, ) -> bool

Single-threaded fused GET + RESP encode. Bypasses the per-shard RwLock entirely via data_ptr() — saves ~5-10ns per GET in atomic ops.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore. This is true in the sc=1 multi-direct path where there is exactly one worker thread, but is unsafe in any other configuration.

Source

pub unsafe fn get_blob_string_hashed_into_single_threaded( &self, key_hash: u64, key: &[u8], out: &mut BytesMut, ) -> bool

Prehashed variant of get_blob_string_into_single_threaded for the RESP fast path, where the key bytes have already been validated.

§Safety

Same contract as get_blob_string_into_single_threaded.

Source

pub unsafe fn set_single_threaded( &self, key: &[u8], value: &[u8], ttl_ms: Option<u64>, )

Single-threaded SET that bypasses the per-shard RwLock.

§Safety

Same contract as get_blob_string_into_single_threaded.

Source

pub unsafe fn set_single_threaded_hashed( &self, key_hash: u64, key: &[u8], value: &[u8], ttl_ms: Option<u64>, )

Prehashed variant of set_single_threaded for canonical RESP SET.

§Safety

Same contract as set_single_threaded.

Source

pub unsafe fn set_single_threaded_hashed_tagged_no_ttl_hot( &self, key_hash: u64, key_tag: u64, key: &[u8], value: &[u8], )

FCNP single-shard SET path with both hashes supplied by the client.

§Safety

Same contract as set_single_threaded_hashed; additionally, key_tag must equal hash_key_tag_from_hash(key_hash).

Source

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

Fused GET + RESP-blob-string-encode for the multi-direct hot path. Writes $<len>\r\n<value>\r\n directly into out under the shard read lock, eliminating the Vec<u8> intermediate that the generic get path’s .to_vec() allocates. Returns true if the key existed.

Source

pub fn get_blob_string_hashed_into( &self, key_hash: u64, key: &[u8], out: &mut BytesMut, ) -> bool

Prehashed fused GET + RESP encode. Used by the RESP fast path after it validates the key bytes and computes the hash once.

Source

pub fn set_slice_prehashed( &self, key_hash: u64, key: &[u8], value: &[u8], ttl_ms: Option<u64>, )

Prehashed slice SET for the RESP fast path. Avoids rehashing in storage after parsing has already identified the key.

Source

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

Zero-copy GET for the multi-direct hot path. Returns the stored bytes::Bytes directly (refcount-only clone of FlatEntry.value), avoiding the Vec<u8> allocation that get performs to materialize Bytes = Vec<u8> for the public API.

Source

pub fn get_value_bytes_route_hashed( &self, route_hash: u64, key: &[u8], ) -> Option<Bytes>

FastCodec GET path. The wire header carries a route hash so the server can usually skip hashing the key again. For session-prefixed keys in session route mode, the route hash is intentionally the session prefix hash, not the full key hash, so we fall back to the generic lookup.

Source

pub fn with_value_bytes_route_hashed<F>( &self, route_hash: u64, key: &[u8], write: F, ) -> bool
where F: FnMut(&[u8]),

FastCodec GET path that calls write while the value reference is still protected by the shard read lock. This avoids the refcount bump and drop from returning bytes::Bytes on the native GET hot path.

Source

pub fn with_shared_value_bytes_route_hashed<F>( &self, route_hash: u64, key: &[u8], write: F, ) -> bool
where F: FnMut(&Bytes),

Route-hashed GET path that exposes the stored Bytes object while the shard lock is held. Callers can clone the Bytes handle for large zero-copy writes, while small responses can still copy from the borrowed value without an extra refcount bump.

Source

pub fn with_shared_value_bytes_full_key_tagged_no_ttl<F>( &self, route_hash: u64, key_tag: u64, key_len: usize, write: F, ) -> bool
where F: FnMut(&Bytes),

Full-key FCNP GET path for clients that provide the key hash, key tag, and key length but omit the key bytes. This is safe for concurrent multi-shard access because the value is exposed only while the shard read lock is held.

Source

pub fn getex_value_bytes_route_hashed( &self, route_hash: Option<u64>, key: &[u8], ttl_ms: u64, ) -> Option<Bytes>

Native GETEX path for v2. Returns the value and applies the TTL while holding the target shard write lock.

Source

pub fn with_getex_value_bytes_route_hashed<F>( &self, route_hash: Option<u64>, key: &[u8], ttl_ms: u64, write: F, ) -> bool
where F: FnMut(&[u8]),

Native GETEX path that writes the value while it is borrowed from the shard. This avoids the Bytes clone/drop pair in the returning GETEX helper.

Source

pub unsafe fn get_value_bytes_route_hashed_single_threaded( &self, route_hash: u64, key: &[u8], ) -> Option<Bytes>

Single-threaded FastCodec GET path. Avoids shard RwLock atomics in the same direct sc=1 setup as the RESP fused single-threaded path.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore.

Source

pub unsafe fn with_value_bytes_route_hashed_single_threaded<F>( &self, route_hash: u64, key: &[u8], write: F, ) -> bool
where F: FnMut(&[u8]),

Single-threaded variant of with_value_bytes_route_hashed.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore.

Source

pub unsafe fn with_shared_value_bytes_route_hashed_single_threaded<F>( &self, route_hash: u64, key: &[u8], write: F, ) -> bool
where F: FnMut(&Bytes),

Single-threaded FCNP GET helper that exposes the stored Bytes object to the caller. This lets the network path clone only the refcount for large zero-copy writes, while keeping small values on the borrowed inline-copy path.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore.

Source

pub unsafe fn with_shared_value_bytes_full_key_single_threaded<F>( &self, key_hash: u64, key: &[u8], write: F, ) -> bool
where F: FnMut(&Bytes),

1-shard full-key FCNP GET helper for the hottest native path. This skips route-mode, shard-count, and session-slot checks that the general routed helper must keep.

§Safety

The caller must guarantee that this store has exactly one shard, uses EmbeddedRouteMode::FullKey, and no other thread is concurrently accessing the shard.

Source

pub unsafe fn get_shared_value_bytes_full_key_single_threaded( &self, key_hash: u64, key: &[u8], ) -> Option<&Bytes>

1-shard full-key FCNP GET helper that returns the stored Bytes reference directly. This keeps the hottest native GET path out of the closure-based wrapper used by the general routed path.

§Safety

The caller must guarantee that this store has exactly one shard, uses EmbeddedRouteMode::FullKey, and no other thread is concurrently accessing the shard.

Source

pub unsafe fn get_shared_value_bytes_full_key_tagged_single_threaded( &self, key_hash: u64, key_tag: u64, key_len: usize, ) -> Option<&Bytes>

1-shard full-key FCNP GET helper for clients that supply both the key hash and key tag. The native protocol treats that tuple plus key length as the lookup identity, avoiding a key-byte compare in the hottest path.

§Safety

The caller must guarantee that this store has exactly one shard, uses EmbeddedRouteMode::FullKey, and no other thread is concurrently accessing the shard. key_tag must be the tag for the key bytes that produced key_hash.

Source

pub fn with_shared_value_bytes_full_key_owned_shard_no_ttl<F>( &self, shard_id: usize, key_hash: u64, key: &[u8], write: F, ) -> Option<bool>
where F: FnMut(&Bytes),

Safe shard-owned full-key GET helper for direct-shard server workers.

This keeps safe builds on the normal shard RwLock, but avoids the generic route/session fallback after the FCNP frame has already proven that the request belongs to shard_id.

Source

pub unsafe fn with_shared_value_bytes_full_key_tagged_owned_shard_no_ttl<F>( &self, shard_id: usize, key_hash: u64, key_tag: u64, key_len: usize, write: F, ) -> Option<bool>
where F: FnMut(&Bytes),

Shard-owned full-key FCNP GET helper for direct-shard server workers.

This is the multi-shard counterpart to get_shared_value_bytes_full_key_tagged_single_threaded: one server worker owns shard_id, the client supplies the full-key hash and tag, and the lookup can skip both the shard lock and the key-byte compare.

Returns None when the hot path is not valid, such as TTL-bearing shards, invalid shard ids, non-full-key routing, or a route mismatch. Otherwise returns Some(true) for a hit and Some(false) for a miss.

§Safety

The caller must guarantee that no other thread is concurrently accessing shard_id, that key_hash routes to shard_id, and that key_tag matches the key bytes that produced key_hash.

Source

pub unsafe fn with_session_value_slice_owned_shard_no_ttl_prevalidated<F>( &self, shard_id: usize, session_hash: u64, key_hash: u64, session_prefix: &[u8], key: &[u8], write: F, ) -> Option<bool>
where F: FnMut(&[u8]),

Shard-owned session-prefix GET helper for direct-shard server workers.

Session slabs store borrowed value slices instead of Bytes, so this helper writes through a slice callback and avoids the generic fallback’s Bytes::copy_from_slice materialization. The caller has already validated that session_prefix routes to shard_id; this helper only checks storage preconditions and performs the lookup.

§Safety

When built with the unsafe feature, the caller must guarantee no other thread is concurrently accessing shard_id. Safe builds keep the shard read lock and therefore only require the route metadata to be valid.

Source

pub fn set_session_slice_hashed_owned_shard_no_ttl_prevalidated( &self, shard_id: usize, session_hash: u64, key_hash: u64, session_prefix: &[u8], key: &[u8], value: &[u8], ) -> bool

Safe shard-owned no-TTL session SET helper for direct-shard workers.

The caller has already validated that session_prefix routes to shard_id; this helper only enforces storage preconditions and performs the session-slab write.

Source

pub unsafe fn set_session_slice_hashed_owned_shard_no_ttl_hot_prevalidated( &self, shard_id: usize, session_hash: u64, key_hash: u64, session_prefix: &[u8], key: &[u8], value: &[u8], ) -> bool

Shard-owned no-TTL session SET helper for direct-shard workers.

§Safety

The caller must guarantee exclusive access to shard_id and that the session prefix routes to that shard.

Source

pub fn set_slice_hashed_tagged_owned_shard_no_ttl( &self, shard_id: usize, key_hash: u64, key_tag: u64, key: &[u8], value: &[u8], ) -> bool

Safe shard-owned no-TTL SET helper for direct-shard server workers.

The helper still takes the shard write lock. It only specializes the routing and no-TTL storage path when the worker-owned shard checks have already succeeded; unsupported cases return false so callers can preserve the generic fallback behavior.

Source

pub unsafe fn set_slice_hashed_tagged_owned_shard_no_ttl_hot( &self, shard_id: usize, key_hash: u64, key_tag: u64, key: &[u8], value: &[u8], ) -> bool

Shard-owned full-key FCNP SET helper for direct-shard server workers.

§Safety

The caller must guarantee exclusive access to shard_id, that key_hash routes to shard_id, and that key_tag matches key.

Source

pub unsafe fn getex_value_bytes_route_hashed_single_threaded( &self, route_hash: Option<u64>, key: &[u8], ttl_ms: u64, ) -> Option<Bytes>

Single-threaded native GETEX path.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore.

Source

pub unsafe fn with_getex_value_bytes_route_hashed_single_threaded<F>( &self, route_hash: Option<u64>, key: &[u8], ttl_ms: u64, write: F, ) -> bool
where F: FnMut(&[u8]),

Single-threaded borrowed native GETEX path.

§Safety

The caller must guarantee that no other thread is concurrently accessing any shard of this EmbeddedStore.

Source

pub fn get_view(&self, key: &[u8]) -> EmbeddedReadView

Returns an owned read view for one key.

The returned view owns the bytes it exposes, so callers can safely pass the metadata through FFI or buffer-style APIs without tying it to the store’s lifetime.

Source

pub fn get_prepared_view_no_ttl( &self, prepared: &PreparedPointKey, ) -> EmbeddedReadView

Source

pub fn get_view_routed_no_ttl( &self, route: EmbeddedKeyRoute, key: &[u8], ) -> EmbeddedReadView

Source

pub fn get_view_routed( &self, route: EmbeddedKeyRoute, key: &[u8], now_ms: u64, ) -> EmbeddedReadView

Source§

impl EmbeddedStore

Source

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

Inserts or replaces a byte-string value.

ttl_ms is a relative TTL in milliseconds. Passing None creates a persistent value.

Source

pub fn set_value_bytes(&self, key: &[u8], value: Bytes, ttl_ms: Option<u64>)

Zero-copy SET for the multi-direct hot path. Takes key as a slice (copied into the entry’s small Box<[u8]>) and value as an already-owned bytes::Bytes (typically a slice of the connection read buffer obtained via HandoffBuffer::split_prefix). Skips the value.to_vec() allocation that the generic set performs.

Source

pub fn set_routed_no_ttl<K, V>(&self, route: EmbeddedKeyRoute, key: K, value: V)
where K: Into<Bytes>, V: Into<Bytes>,

Source

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

Source

pub fn batch_set_session_slices_routed_no_ttl<I, K, V>( &self, route: EmbeddedSessionRoute, items: I, )
where I: IntoIterator<Item = (K, V)>, K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

pub fn batch_set_session_slices_no_ttl<I, K, V>( &self, session_prefix: &[u8], items: I, )
where I: IntoIterator<Item = (K, V)>, K: AsRef<[u8]>, V: AsRef<[u8]>,

Source

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

Source

pub fn batch_set_session_packed_no_ttl(&self, packed: PackedSessionWrite)

Source

pub fn set_routed<K, V>( &self, route: EmbeddedKeyRoute, key: K, value: V, ttl_ms: Option<u64>, )
where K: Into<Bytes>, V: Into<Bytes>,

Source

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

Inserts or replaces multiple byte-string values.

ttl_ms applies the same relative TTL to every item in the batch.

Source§

impl EmbeddedStore

Source

pub fn into_local_store_bootstrap( self, worker_count: usize, ) -> WorkerLocalEmbeddedStoreBootstrap

Partition this store into worker-local embedded stores.

Source

pub fn into_local_stores( self, worker_count: usize, ) -> Vec<WorkerLocalEmbeddedStore>

Partition this store and return the worker-local stores directly.

Trait Implementations§

Source§

impl Debug for EmbeddedStore

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