Skip to main content

Store

Type Alias Store 

Source
pub type Store = Box<dyn Blocks + Send>;
Expand description

A store chosen at run time, which is how every real one arrives.

Send because the stripe it ends up in is worked on by whichever thread has taken that stripe’s lock. Which thread that is changes from one command to the next, so a store that could not be sent could not be attached. Every store there is, which is a file and a vector, meets the bound already.

Aliased Type§

pub struct Store(/* private fields */);

Trait Implementations§

Source§

impl Blocks for Store

So that a store can be chosen at run time rather than at compile time.

Keyspace holds its tier behind this box, and the reason is that the alternative is a type parameter on Keyspace, which would spread to yo-resp and to every caller of either, all to name a type that only the code opening the file knows. The dispatch it costs is one indirect call on a path that is about to read a device, and nothing at all on a warm read, which never reaches this trait.

Source§

fn put(&mut self, bytes: &[u8]) -> Result<Addr>

Put these bytes somewhere and say where they went.
Source§

fn get(&self, at: Addr) -> Result<&[u8]>

Read back what was put at at. Read more
Source§

fn bytes(&self) -> u64

How many bytes the store is holding, for the storage limit. Read more
Source§

fn release(&mut self)

Says that every borrow handed out by Blocks::get is finished with. Read more