Skip to main content

Store

Trait Store 

Source
pub trait Store {
    type Guard;

Show 13 methods // Required methods fn lock(&self) -> Result<Self::Guard>; fn capacity(&self) -> u64; fn read_at(&self, off: u64, len: usize) -> Result<Vec<u8>>; fn write_at(&self, off: u64, bytes: &[u8]) -> Result<()>; fn sync(&self) -> Result<()>; fn read_checkpoint(&self) -> Result<Option<Vec<u8>>>; fn write_checkpoint(&self, bytes: &[u8]) -> Result<()>; fn read_sentinel(&self) -> Result<Option<Vec<u8>>>; fn write_sentinel(&self, bytes: &[u8]) -> Result<()>; fn fence(&self, txn: TxnId) -> Result<Option<u64>>; fn set_fence(&self, txn: TxnId, epoch: u64) -> Result<()>; fn create_fence(&self, txn: TxnId, epoch: u64) -> Result<()>; fn forget_fences<F: Fn(TxnId) -> bool>(&self, keep: F) -> Result<Vec<TxnId>>;
}

Required Associated Types§

Source

type Guard

Held while a journal handle reads-then-appends; serializes all handles (across processes for FileStore). Released on drop.

Required Methods§

Source

fn lock(&self) -> Result<Self::Guard>

Source

fn capacity(&self) -> u64

Source

fn read_at(&self, off: u64, len: usize) -> Result<Vec<u8>>

Up to len bytes at off; shorter at the end of the preallocation.

Source

fn write_at(&self, off: u64, bytes: &[u8]) -> Result<()>

Source

fn sync(&self) -> Result<()>

Source

fn read_checkpoint(&self) -> Result<Option<Vec<u8>>>

Source

fn write_checkpoint(&self, bytes: &[u8]) -> Result<()>

Atomic: either the old checkpoint or the complete new one survives.

Source

fn read_sentinel(&self) -> Result<Option<Vec<u8>>>

Source

fn write_sentinel(&self, bytes: &[u8]) -> Result<()>

Source

fn fence(&self, txn: TxnId) -> Result<Option<u64>>

The epoch backends fence on. Written before the journal’s Takeover record.

Source

fn set_fence(&self, txn: TxnId, epoch: u64) -> Result<()>

Source

fn create_fence(&self, txn: TxnId, epoch: u64) -> Result<()>

A new transaction’s fence, created exclusively (§9 step 4, C5): fails with AlreadyExists if anything is already there for this id.

Source

fn forget_fences<F: Fn(TxnId) -> bool>(&self, keep: F) -> Result<Vec<TxnId>>

Removes the fence of every transaction keep rejects; returns them. A transaction without a fence is never admitted, so this only narrows.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§