Skip to content

Commit

Permalink
chore: remove unecessary txn usage
Browse files Browse the repository at this point in the history
Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com>
  • Loading branch information
bsbds committed Aug 20, 2024
1 parent eebfc36 commit 9ed9264
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/xline/src/storage/kv_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ impl KvStoreInner {

/// Get previous `KeyValue` of a `KeyValue`
pub(crate) fn get_prev_kv(&self, kv: &KeyValue) -> Option<KeyValue> {
let txn_db = self.db.transaction();
let index = self.index.state();
Self::get_range(
&txn_db,
&index,
self.db.as_ref(),
self.index.as_ref(),
&kv.key,
&[],
kv.mod_revision.overflow_sub(1),
Expand All @@ -168,11 +166,10 @@ impl KvStoreInner {
key_range: KeyRange,
revision: i64,
) -> Result<Vec<Event>, ExecuteError> {
let txn = self.db.transaction();
let revisions =
self.index
.get_from_rev(key_range.range_start(), key_range.range_end(), revision);
let events = Self::get_values(&txn, &revisions)?
let events = Self::get_values(self.db.as_ref(), &revisions)?
.into_iter()
.map(|kv| {
// Delete
Expand Down

0 comments on commit 9ed9264

Please sign in to comment.