Skip to main content

Store

Struct Store 

Source
pub struct Store<S: TileStore> { /* private fields */ }
Expand description

The store: the data writer, the manifest writer when split, the live runs, and the size a trusted checkpoint covers.

Implementations§

Source§

impl<S: TileStore> Store<S>

Source

pub fn open(store: S, keys: Keys) -> Result<Self, Error>

Opens a shared log on store with the writer lock, rebuilding the live set from the logged manifests when the cache does not match them.

Source

pub fn open_split(data: S, index: S, keys: Keys) -> Result<Self, Error>

Opens a split log: entries go to data, run files and manifests to index. Both writer locks are held.

Source

pub fn open_trusting( store: S, keys: Keys, size: u64, root: [u8; 32], ) -> Result<Self, Error>

Like Store::open, trusting root as the root at size: what AuthenticatedLog::recover proves the current data tree consistent with. The pair comes from a signed checkpoint kept where the store’s writer cannot reach it.

Source

pub fn live_runs(&self) -> &[RunManifest]

The runs a lookup goes through, oldest first.

Source

pub fn size(&self) -> u64

The number of entries in the data tree.

Source

pub fn root(&self) -> [u8; 32]

The root of the data tree.

Source

pub fn writer(&self) -> &Writer<S>

The data writer, for checkpoints.

Source

pub fn index_writer(&self) -> Option<&Writer<S>>

The index log’s writer when split, for its own checkpoint.

Source

pub fn index(&self) -> Result<Index<&S>, Error>

Lookups at the current trees, sharing this store’s run cache.

Source

pub fn append_batch<I>(&mut self, entries: I) -> Result<Range<u64>, Error>
where I: IntoIterator<Item = Vec<u8>>,

Appends entries in order and returns their index range; the batch is written once. Nothing is written when an entry starts with the manifest magic or is over the tiles entry length.

Trait Implementations§

Source§

impl<S: TileStore> AuthenticatedLog for Store<S>

Source§

fn append(&mut self, entry: &[u8]) -> Result<u64, Error>

Append one entry; returns its log index.
Source§

fn find(&self, key: &[u8]) -> Result<Vec<Located>, Error>

Every entry carrying key, each with the run that located it. An empty answer is proven, not assumed: the logged runs’ entry ranges cover every index below the checkpoint size except the scanned tail, or the answer is Error::Tree, since a withheld run file would otherwise hide an entry without doctoring any bytes.
Source§

fn range(&self, range: RangeInclusive<&[u8]>) -> Result<Vec<Located>, Error>

Every entry whose keys fall in range, in key order, with their runs.
Source§

fn seal(&mut self) -> Result<RunManifest, Error>

Seal the unsealed tail into a run and log its manifest.
Source§

fn compact(&mut self) -> Result<Compaction, Error>

Merge runs into one and log the result.
Source§

fn recover(&mut self) -> Result<Recovery, Error>

Replay past the last checkpoint and prove the result consistent.

Auto Trait Implementations§

§

impl<S> Freeze for Store<S>
where S: Freeze,

§

impl<S> !RefUnwindSafe for Store<S>

§

impl<S> Send for Store<S>
where S: Send,

§

impl<S> Sync for Store<S>
where S: Sync,

§

impl<S> Unpin for Store<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Store<S>
where S: UnsafeUnpin,

§

impl<S> !UnwindSafe for Store<S>

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> Same for T

Source§

type Output = T

Should always be Self
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.