Skip to content

Commit

Permalink
Modify LogStore trait after trying to actually implement it
Browse files Browse the repository at this point in the history
  • Loading branch information
dispanser committed Oct 27, 2023
1 parent e522dcd commit fbbf695
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions rust/src/logstore/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
//! Delta log store.
// use std::io::{Cursor, BufReader, BufRead};

use crate::errors::DeltaResult;
use bytes::Bytes;
// use log::debug;

use crate::protocol::Action;
pub mod default_logstore;

/// Trait for critical operations required to read and write commit entries in Delta logs.
///
Expand All @@ -15,7 +18,7 @@ use crate::protocol::Action;
/// `get_latest_version` must return a version >= `v`, i.e. the underlying file system entry must
/// become visible immediately.
#[async_trait::async_trait]
pub trait LogStore {
pub trait LogStore: Sync + Send {
/// Read data for commit entry with the given version.
/// TODO: return the actual commit data, i.e. Vec<Action>, instead?
async fn read_commit_entry(&self, version: i64) -> DeltaResult<Bytes>;
Expand All @@ -24,12 +27,8 @@ pub trait LogStore {
///
/// This operation can be retried with a higher version in case the write
/// fails with `TransactionError::VersionAlreadyExists`.
async fn write_commit_entry(
&self,
version: i64,
actions: Vec<Action>,
) -> DeltaResult<()>;
async fn write_commit_entry(&self, version: i64, actions: Bytes) -> DeltaResult<()>;

/// Find latest version currently stored in the delta log.
async fn get_latest_version(&self) -> DeltaResult<i64>;
async fn get_latest_version(&self, start_version: i64) -> DeltaResult<i64>;
}

0 comments on commit fbbf695

Please sign in to comment.