pub struct MemStore {
inner: Arc<Mutex<MemInner>>,
lock: Arc<(Mutex<bool>, Condvar)>,
capacity: u64,
}Fields§
§inner: Arc<Mutex<MemInner>>§lock: Arc<(Mutex<bool>, Condvar)>§capacity: u64Implementations§
Source§impl MemStore
impl MemStore
pub fn new(capacity: u64) -> MemStore
fn inner(&self) -> MutexGuard<'_, MemInner>
Sourcepub fn crash(&self)
pub fn crash(&self)
A power loss: the log keeps exactly what the last sync covered; a
write after it is gone, as if never made.
pub fn tear_next_write(&self, keep: usize)
Sourcepub fn tear_write_containing(&self, needle: &str)
pub fn tear_write_containing(&self, needle: &str)
Tear the next log write that contains needle (e.g. "Checking", to
tear the record of that state).
pub fn fail_next_checkpoint(&self)
pub fn set_enospc(&self, on: bool)
Trait Implementations§
Source§impl Store for MemStore
impl Store for MemStore
Source§type Guard = MemGuard
type Guard = MemGuard
Held while a journal handle reads-then-appends; serializes all handles
(across processes for
FileStore). Released on drop.fn lock(&self) -> Result<MemGuard>
fn capacity(&self) -> u64
Source§fn read_at(&self, off: u64, len: usize) -> Result<Vec<u8>>
fn read_at(&self, off: u64, len: usize) -> Result<Vec<u8>>
Up to
len bytes at off; shorter at the end of the preallocation.fn write_at(&self, off: u64, bytes: &[u8]) -> Result<()>
fn sync(&self) -> Result<()>
fn read_checkpoint(&self) -> Result<Option<Vec<u8>>>
Source§fn write_checkpoint(&self, bytes: &[u8]) -> Result<()>
fn write_checkpoint(&self, bytes: &[u8]) -> Result<()>
Atomic: either the old checkpoint or the complete new one survives.
fn read_sentinel(&self) -> Result<Option<Vec<u8>>>
fn write_sentinel(&self, bytes: &[u8]) -> Result<()>
Source§fn fence(&self, txn: TxnId) -> Result<Option<u64>>
fn fence(&self, txn: TxnId) -> Result<Option<u64>>
The epoch backends fence on. Written before the journal’s Takeover record.
fn set_fence(&self, txn: TxnId, epoch: u64) -> Result<()>
Auto Trait Implementations§
impl Freeze for MemStore
impl RefUnwindSafe for MemStore
impl Send for MemStore
impl Sync for MemStore
impl Unpin for MemStore
impl UnsafeUnpin for MemStore
impl UnwindSafe for MemStore
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