Skip to content

Commit

Permalink
Public "get" for schema batch
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig committed May 8, 2024
1 parent 886918c commit 62ddb01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/cache/change_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ impl ChangeSet {

/// Create new `ChangeSet
pub fn new_with_operations(id: SnapshotId, operations: SchemaBatch) -> Self {
Self {
id, operations
}

Self { id, operations }
}

/// Get value from its own cache
Expand Down
8 changes: 4 additions & 4 deletions src/schema_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl SchemaBatch {
}

/// Adds an insert/update operation to the batch.
// TODO: made this pub(crate) ???
pub fn put<S: Schema>(
&mut self,
key: &impl KeyCodec<S>,
Expand All @@ -38,6 +39,7 @@ impl SchemaBatch {
}

/// Adds a delete operation to the batch.
// TODO: Make this pub(crate)
pub fn delete<S: Schema>(&mut self, key: &impl KeyCodec<S>) -> anyhow::Result<()> {
let key = key.encode_key()?;
self.insert_operation::<S>(key, Operation::Delete);
Expand All @@ -50,10 +52,8 @@ impl SchemaBatch {
column_writes.insert(key, operation);
}

pub(crate) fn get<S: Schema>(
&self,
key: &impl KeyCodec<S>,
) -> anyhow::Result<Option<&Operation>> {
/// Getting the
pub fn get<S: Schema>(&self, key: &impl KeyCodec<S>) -> anyhow::Result<Option<&Operation>> {
let key = key.encode_key()?;

if let Some(column_writes) = self.last_writes.get(&S::COLUMN_FAMILY_NAME) {
Expand Down

0 comments on commit 62ddb01

Please sign in to comment.