pub struct ShardedCs<C: ContentStore> { /* private fields */ }Expand description
Shards a ContentStore across N instances to reduce lock contention.
Shard selection is by first name component (not full name hash) so that
related content (/video/seg/1, /video/seg/2) lands in the same shard,
preserving LRU locality for sequential access.
The shard count is the length of the shards Vec and is fixed at
construction time.
Implementations§
Trait Implementations§
Source§impl<C: ContentStore> ContentStore for ShardedCs<C>
impl<C: ContentStore> ContentStore for ShardedCs<C>
Source§async fn get(&self, interest: &Interest) -> Option<CsEntry>
async fn get(&self, interest: &Interest) -> Option<CsEntry>
Look up a Data packet matching
interest.
Honours MustBeFresh and CanBePrefix selectors.Source§async fn insert(
&self,
data: Bytes,
name: Arc<Name>,
meta: CsMeta,
) -> InsertResult
async fn insert( &self, data: Bytes, name: Arc<Name>, meta: CsMeta, ) -> InsertResult
Store a Data packet. May evict least-recently-used entries to make room.
Source§fn capacity(&self) -> CsCapacity
fn capacity(&self) -> CsCapacity
Current capacity configuration.
Source§fn current_bytes(&self) -> usize
fn current_bytes(&self) -> usize
Total bytes currently used.
Source§fn set_capacity(&self, max_bytes: usize)
fn set_capacity(&self, max_bytes: usize)
Update the maximum byte capacity at runtime.
Source§fn variant_name(&self) -> &str
fn variant_name(&self) -> &str
Human-readable name of this CS implementation (e.g. “lru”, “sharded-lru”).
Auto Trait Implementations§
impl<C> Freeze for ShardedCs<C>
impl<C> RefUnwindSafe for ShardedCs<C>where
C: RefUnwindSafe,
impl<C> Send for ShardedCs<C>
impl<C> Sync for ShardedCs<C>
impl<C> Unpin for ShardedCs<C>where
C: Unpin,
impl<C> UnwindSafe for ShardedCs<C>where
C: 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