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: CommitLogDir, rt: Handle, opts: Options) -> Result<Self>
pub fn open(root: CommitLogDir, 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 Commits in the underlying log.
Sourcepub fn existing_segment_offsets(&self) -> Result<Vec<TxOffset>>
pub fn existing_segment_offsets(&self) -> Result<Vec<TxOffset>>
Get a list of segment offsets, sorted in ascending order.
Sourcepub fn compress_segments(&self, offsets: &[TxOffset]) -> Result<()>
pub fn compress_segments(&self, offsets: &[TxOffset]) -> Result<()>
Compress the segments at the offsets provided, marking them as immutable.
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