Struct spacetimedb_durability::Local
source · pub struct Local<T> { /* private fields */ }
Expand description
Durability
implementation backed by a Commitlog
on local storage.
The commitlog is constrained to store the canonical Txdata
payload,
where the generic parameter T
is the type of the row data stored in
the mutations section.
T
is left generic in order to allow bypassing the ProductValue
intermediate representation in the future.
Note, however, that instantiating T
to a different type may require to
change the log format version!
Implementations§
source§impl<T: Encode + Send + Sync + 'static> Local<T>
impl<T: Encode + Send + Sync + 'static> Local<T>
sourcepub fn open(root: impl Into<PathBuf>, rt: Handle, opts: Options) -> Result<Self>
pub fn open(root: impl Into<PathBuf>, rt: Handle, opts: Options) -> Result<Self>
Create a Local
instance at the root
directory.
The root
directory must already exist.
Background tasks are spawned onto the provided tokio runtime.
sourcepub fn queue_depth(&self) -> u64
pub fn queue_depth(&self) -> u64
Inspect how many transactions added via Self::append_tx
are pending
to be applied to the underlying Commitlog
.
sourcepub fn commits_from(
&self,
offset: TxOffset
) -> impl Iterator<Item = Result<Commit, Traversal>>
pub fn commits_from( &self, offset: TxOffset ) -> impl Iterator<Item = Result<Commit, Traversal>>
Obtain an iterator over the Commit
s in the underlying log.
sourcepub fn size_on_disk(&self) -> Result<u64>
pub fn size_on_disk(&self) -> Result<u64>
Get the size on disk of the underlying Commitlog
.
Trait Implementations§
source§impl<T: Encode + 'static> History for Local<T>
impl<T: Encode + 'static> History for Local<T>
type TxData = Txdata<T>
source§fn fold_transactions_from<D>(
&self,
offset: TxOffset,
decoder: D
) -> Result<(), D::Error>
fn fold_transactions_from<D>( &self, offset: TxOffset, decoder: D ) -> Result<(), D::Error>
offset
and “fold” it into
the provided Decoder
.source§fn transactions_from<'a, D>(
&self,
offset: TxOffset,
decoder: &'a D
) -> impl Iterator<Item = Result<Transaction<Self::TxData>, D::Error>>
fn transactions_from<'a, D>( &self, offset: TxOffset, decoder: &'a D ) -> impl Iterator<Item = Result<Transaction<Self::TxData>, D::Error>>
offset
.Auto Trait Implementations§
impl<T> Freeze for Local<T>
impl<T> !RefUnwindSafe for Local<T>
impl<T> Send for Local<T>
impl<T> Sync for Local<T>
impl<T> Unpin for Local<T>
impl<T> !UnwindSafe for Local<T>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more