pub struct Ledger { /* private fields */ }Expand description
The transaction ledger for a single frame.
Implementations§
Source§impl Ledger
impl Ledger
Sourcepub async fn create(
storage: Arc<dyn StorageBackend>,
frame_path: &str,
schema: FrameSchema,
partition_by: Vec<String>,
node_id: &NodeId,
) -> Result<Self>
pub async fn create( storage: Arc<dyn StorageBackend>, frame_path: &str, schema: FrameSchema, partition_by: Vec<String>, node_id: &NodeId, ) -> Result<Self>
Create a new ledger for a frame, writing version 0 (CreateFrame entry).
Sourcepub async fn open(
storage: Arc<dyn StorageBackend>,
frame_path: &str,
) -> Result<Self>
pub async fn open( storage: Arc<dyn StorageBackend>, frame_path: &str, ) -> Result<Self>
Open an existing ledger by loading the latest checkpoint and replaying entries.
Sourcepub async fn commit(
&mut self,
action: LedgerAction,
node_id: &NodeId,
) -> Result<u64>
pub async fn commit( &mut self, action: LedgerAction, node_id: &NodeId, ) -> Result<u64>
Commit an action to the ledger with optimistic concurrency. Returns the committed version number.
Sourcepub fn active_cells(&self) -> &[CellMetadata]
pub fn active_cells(&self) -> &[CellMetadata]
Get the currently active cells.
Sourcepub fn current_version(&self) -> u64
pub fn current_version(&self) -> u64
Get the current version.
Sourcepub fn schema(&self) -> &FrameSchema
pub fn schema(&self) -> &FrameSchema
Get the frame schema.
Sourcepub fn partition_by(&self) -> &[String]
pub fn partition_by(&self) -> &[String]
Get the partition columns.
Sourcepub fn frame_path(&self) -> &str
pub fn frame_path(&self) -> &str
Get the frame path.
Auto Trait Implementations§
impl Freeze for Ledger
impl !RefUnwindSafe for Ledger
impl Send for Ledger
impl Sync for Ledger
impl Unpin for Ledger
impl UnsafeUnpin for Ledger
impl !UnwindSafe for Ledger
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
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>
Converts
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>
Converts
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