diff --git a/grovedb/src/lib.rs b/grovedb/src/lib.rs index 33c96f39..42efe8a3 100644 --- a/grovedb/src/lib.rs +++ b/grovedb/src/lib.rs @@ -901,7 +901,7 @@ impl GroveDb { .follow_reference( (full_path.as_slice()).into(), allow_cache, - Some(transaction), + transaction, grove_version, ) .unwrap()?; diff --git a/grovedb/src/operations/get/mod.rs b/grovedb/src/operations/get/mod.rs index 85312176..f23f4335 100644 --- a/grovedb/src/operations/get/mod.rs +++ b/grovedb/src/operations/get/mod.rs @@ -67,6 +67,7 @@ impl GroveDb { ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); match cost_return_on_error!( &mut cost, @@ -74,7 +75,7 @@ impl GroveDb { path.clone(), key, allow_cache, - transaction, + Some(tx.as_ref()), grove_version ) ) { @@ -87,7 +88,7 @@ impl GroveDb { self.follow_reference( path_owned.as_slice().into(), allow_cache, - transaction, + tx.as_ref(), grove_version, ) .add_cost(cost) @@ -99,11 +100,11 @@ impl GroveDb { /// Return the Element that a reference points to. /// If the reference points to another reference, keep following until /// base element is reached. - pub fn follow_reference>( + pub(crate) fn follow_reference>( &self, path: SubtreePath, allow_cache: bool, - transaction: TransactionArg, + transaction: &Transaction, grove_version: &GroveVersion, ) -> CostResult { check_grovedb_v0_with_cost!( @@ -134,7 +135,7 @@ impl GroveDb { path_slice.into(), key, allow_cache, - transaction, + Some(transaction), grove_version ) .map_err(|e| match e { diff --git a/grovedb/src/operations/get/query.rs b/grovedb/src/operations/get/query.rs index 106afa4a..3b387ece 100644 --- a/grovedb/src/operations/get/query.rs +++ b/grovedb/src/operations/get/query.rs @@ -15,7 +15,7 @@ use integer_encoding::VarInt; use crate::element::SumValue; use crate::{ element::QueryOptions, operations::proof::ProveOptions, - query_result_type::PathKeyOptionalElementTrio, + query_result_type::PathKeyOptionalElementTrio, util::TxRef, Transaction, }; #[cfg(feature = "full")] use crate::{ @@ -56,6 +56,7 @@ impl GroveDb { ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); let elements = cost_return_on_error!( &mut cost, @@ -83,7 +84,7 @@ impl GroveDb { .follow_reference( absolute_path.as_slice().into(), allow_cache, - transaction, + tx.as_ref(), grove_version, ) .unwrap_add_cost(&mut cost)?; @@ -182,7 +183,7 @@ where { element: Element, allow_cache: bool, cost: &mut OperationCost, - transaction: TransactionArg, + transaction: &Transaction, grove_version: &GroveVersion, ) -> Result { check_grovedb_v0!( @@ -248,6 +249,7 @@ where { grove_version.grovedb_versions.operations.query.query ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); let (elements, skipped) = cost_return_on_error!( &mut cost, @@ -266,7 +268,7 @@ where { .into_iterator() .map(|result_item| { result_item.map_element(|element| { - self.follow_element(element, allow_cache, &mut cost, transaction, grove_version) + self.follow_element(element, allow_cache, &mut cost, tx.as_ref(), grove_version) }) }) .collect::, Error>>(); @@ -295,6 +297,7 @@ where { .query_item_value ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); let (elements, skipped) = cost_return_on_error!( &mut cost, @@ -327,7 +330,7 @@ where { .follow_reference( absolute_path.as_slice().into(), allow_cache, - transaction, + tx.as_ref(), grove_version, ) .unwrap_add_cost(&mut cost)?; @@ -387,6 +390,7 @@ where { .query_item_value_or_sum ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); let (elements, skipped) = cost_return_on_error!( &mut cost, @@ -419,7 +423,7 @@ where { .follow_reference( absolute_path.as_slice().into(), allow_cache, - transaction, + tx.as_ref(), grove_version, ) .unwrap_add_cost(&mut cost)?; @@ -485,6 +489,7 @@ where { grove_version.grovedb_versions.operations.query.query_sums ); let mut cost = OperationCost::default(); + let tx = TxRef::new(&self.db, transaction); let (elements, skipped) = cost_return_on_error!( &mut cost, @@ -517,7 +522,7 @@ where { .follow_reference( absolute_path.as_slice().into(), allow_cache, - transaction, + tx.as_ref(), grove_version, ) .unwrap_add_cost(&mut cost)?; diff --git a/grovedb/src/operations/insert/mod.rs b/grovedb/src/operations/insert/mod.rs index 90adfe3b..5a516f51 100644 --- a/grovedb/src/operations/insert/mod.rs +++ b/grovedb/src/operations/insert/mod.rs @@ -234,7 +234,7 @@ impl GroveDb { self.follow_reference( reference_path.as_slice().into(), false, - Some(transaction), + transaction, grove_version ) ); diff --git a/grovedb/src/operations/proof/generate.rs b/grovedb/src/operations/proof/generate.rs index 0429ff21..7d22b48c 100644 --- a/grovedb/src/operations/proof/generate.rs +++ b/grovedb/src/operations/proof/generate.rs @@ -283,7 +283,7 @@ impl GroveDb { self.follow_reference( absolute_path.as_slice().into(), true, - None, + tx, grove_version ) );