Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer committed Aug 24, 2024
1 parent 7f6d1a2 commit 008d729
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
6 changes: 2 additions & 4 deletions grovedb/src/batch/just_in_time_reference_update.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::borrow::Cow;

use grovedb_costs::{
cost_return_on_error_default, cost_return_on_error_no_add,
cost_return_on_error_no_add,
storage_cost::{
removal::{StorageRemovedBytes, StorageRemovedBytes::BasicStorageRemoval},
StorageCost,
Expand All @@ -14,11 +14,9 @@ use grovedb_merk::{
};
use grovedb_storage::StorageContext;
use grovedb_version::version::GroveVersion;
use integer_encoding::VarInt;

use crate::{
batch::{MerkError, TreeCacheMerkByPath},
element::SUM_ITEM_COST_SIZE,
Element, ElementFlags, Error,
};

Expand Down Expand Up @@ -49,7 +47,7 @@ where
let mut cost = OperationCost::default();
if old_element.is_sum_item() {
return if new_element.is_sum_item() {
let mut maybe_old_flags = old_element.get_flags_owned();
let maybe_old_flags = old_element.get_flags_owned();
if maybe_old_flags.is_some() {
let mut updated_new_element_with_old_flags = new_element.clone();
updated_new_element_with_old_flags.set_flags(maybe_old_flags.clone());
Expand Down
7 changes: 2 additions & 5 deletions grovedb/src/batch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ use grovedb_costs::{
};
use grovedb_merk::{
tree::{
kv::{
ValueDefinedCostType::{LayeredValueDefinedCost, SpecializedValueDefinedCost},
KV,
},
value_hash, TreeNode, NULL_HASH,
kv::ValueDefinedCostType::{LayeredValueDefinedCost, SpecializedValueDefinedCost},
value_hash, NULL_HASH,
},
CryptoHash, Error as MerkError, Merk, MerkType, Op, RootHashKeyAndSum,
TreeFeatureType::{BasicMerkNode, SummedMerkNode},
Expand Down
1 change: 1 addition & 0 deletions grovedb/src/element/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use grovedb_merk::{
TreeFeatureType,
TreeFeatureType::{BasicMerkNode, SummedMerkNode},
};
#[cfg(feature = "full")]
use grovedb_version::{check_grovedb_v0, error::GroveVersionError, version::GroveVersion};
#[cfg(feature = "full")]
use integer_encoding::VarInt;
Expand Down
11 changes: 7 additions & 4 deletions grovedb/src/element/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ use grovedb_costs::{
use grovedb_merk::proofs::query::query_item::QueryItem;
#[cfg(feature = "full")]
use grovedb_merk::proofs::query::SubqueryBranch;
#[cfg(any(feature = "full", feature = "verify"))]
#[cfg(feature = "full")]
use grovedb_merk::proofs::Query;
#[cfg(feature = "full")]
use grovedb_path::SubtreePath;
#[cfg(feature = "full")]
use grovedb_storage::{rocksdb_storage::RocksDbStorage, RawIterator, StorageContext};
#[cfg(feature = "full")]
use grovedb_version::{
check_grovedb_v0, check_grovedb_v0_with_cost, error::GroveVersionError, version::GroveVersion,
};

#[cfg(feature = "full")]
use crate::operations::proof::util::hex_to_ascii;
#[cfg(any(feature = "full", feature = "verify"))]
use crate::Element;
#[cfg(feature = "full")]
use crate::{
element::helpers::raw_decode,
Expand All @@ -37,8 +40,8 @@ use crate::{
util::{merk_optional_tx, merk_optional_tx_internal_error, storage_context_optional_tx},
Error, PathQuery, TransactionArg,
};
#[cfg(any(feature = "full", feature = "verify"))]
use crate::{query_result_type::Path, Element, SizedQuery};
#[cfg(feature = "full")]
use crate::{query_result_type::Path, SizedQuery};

#[cfg(any(feature = "full", feature = "verify"))]
#[derive(Copy, Clone, Debug)]
Expand Down Expand Up @@ -681,7 +684,7 @@ impl Element {
Ok(()).wrap_with_cost(cost)
}

#[cfg(any(feature = "full", feature = "verify"))]
#[cfg(feature = "full")]
/// Takes a sized query and a key and returns subquery key and subquery as
/// tuple
fn subquery_paths_and_value_for_sized_query(
Expand Down
3 changes: 3 additions & 0 deletions grovedb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ use grovedb_storage::{
};
#[cfg(feature = "full")]
use grovedb_storage::{Storage, StorageContext};
#[cfg(feature = "full")]
use grovedb_version::version::GroveVersion;
#[cfg(feature = "full")]
use grovedb_visualize::DebugByteVectors;
#[cfg(any(feature = "full", feature = "verify"))]
pub use query::{PathQuery, SizedQuery};
#[cfg(feature = "full")]
use reference_path::path_from_reference_path_type;
#[cfg(feature = "grovedbg")]
use tokio::net::ToSocketAddrs;
Expand All @@ -212,6 +214,7 @@ use tokio::net::ToSocketAddrs;
use crate::element::helpers::raw_decode;
#[cfg(any(feature = "full", feature = "verify"))]
pub use crate::error::Error;
#[cfg(feature = "full")]
use crate::operations::proof::util::hex_to_ascii;
#[cfg(feature = "full")]
use crate::util::{root_merk_optional_tx, storage_context_optional_tx};
Expand Down
1 change: 1 addition & 0 deletions merk/src/proofs/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use bincode::{
};
#[cfg(feature = "full")]
use grovedb_costs::{cost_return_on_error, CostContext, CostResult, CostsExt, OperationCost};
#[cfg(feature = "full")]
use grovedb_version::version::GroveVersion;
#[cfg(any(feature = "full", feature = "verify"))]
use indexmap::IndexMap;
Expand Down
5 changes: 1 addition & 4 deletions merk/src/tree/just_in_time_value_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ use grovedb_costs::storage_cost::{

use crate::{
merk::defaults::MAX_UPDATE_VALUE_BASED_ON_COSTS_TIMES,
tree::{
kv::{ValueDefinedCostType, KV},
TreeNode,
},
tree::{kv::ValueDefinedCostType, TreeNode},
Error,
};

Expand Down
2 changes: 2 additions & 0 deletions merk/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ use grovedb_costs::{
},
CostContext, CostResult, CostsExt, OperationCost,
};
#[cfg(feature = "full")]
use grovedb_version::version::GroveVersion;
#[cfg(any(feature = "full", feature = "verify"))]
pub use hash::{
Expand All @@ -63,6 +64,7 @@ pub use tree_feature_type::TreeFeatureType;
#[cfg(feature = "full")]
pub use walk::{Fetch, RefWalker, Walker};

#[cfg(feature = "full")]
use crate::tree::hash::HASH_LENGTH_X2;
#[cfg(feature = "full")]
use crate::tree::kv::ValueDefinedCostType;
Expand Down

0 comments on commit 008d729

Please sign in to comment.