Skip to main content

Pack

Struct Pack 

Source
pub struct Pack<M: Medium> { /* private fields */ }
Expand description

Records [magic u32][len u32][key 16B][checksum u64][entry], appended and never rewritten in place except by a sweep. Only samples are kept, as on disk. Opening reads every record, the later of two under one key winning, and cuts the medium at the first that does not check out: a torn tail is a miss, never a misread.

Implementations§

Source§

impl<M: Medium> Pack<M>

Source

pub fn open(medium: M, max_bytes: u64) -> Pack<M>

Source

pub fn coded(self, codec: Box<dyn SampleCodec>) -> Pack<M>

Source

pub fn medium(&self) -> &M

Trait Implementations§

Source§

impl<M: Medium> Cache for Pack<M>

Source§

fn held_bytes(&self) -> u64

The medium’s whole length, records a later one replaced included, until a sweep.

Source§

fn worth_storing( &self, _cost: Duration, _bytes: usize, kind: PayloadKind, ) -> bool

No clock enters it: a value a browser renders has no measured cost to weigh.

Source§

fn max_bytes(&self) -> u64

Source§

fn evicted_bytes(&self) -> u64

Source§

fn faults(&self) -> u64

Source§

fn holds(&self, key: Hash) -> bool

Source§

fn load(&self, key: Hash, node: &str, expected: Expected) -> Option<Entry>

Source§

fn peek(&self, key: Hash, node: &str, expected: Expected) -> Option<Entry>

load with no side effect: no recency, promotion, fault or removal.
Source§

fn store( &self, key: Hash, payload: &Payload, traces: &[FilterTrace], label: Option<&Label>, )

Source§

fn sweep(&self)

Source§

fn dir(&self) -> Option<&Path>

Auto Trait Implementations§

§

impl<M> !Freeze for Pack<M>

§

impl<M> !RefUnwindSafe for Pack<M>

§

impl<M> !Send for Pack<M>

§

impl<M> !UnwindSafe for Pack<M>

§

impl<M> Sync for Pack<M>

§

impl<M> Unpin for Pack<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for Pack<M>
where M: UnsafeUnpin,

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, 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.