Skip to content

Commit

Permalink
Merge branch 'develop' into fix/NoLimitDecreaseForSubqueries
Browse files Browse the repository at this point in the history
  • Loading branch information
shumkov committed Nov 23, 2023
2 parents 67896ea + 206bc63 commit b40dd1a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
24 changes: 3 additions & 21 deletions grovedb/src/batch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,27 +380,9 @@ impl fmt::Debug for GroveDbOp {
self.key.visualize(key_drawer).unwrap();

let op_dbg = match &self.op {
Op::Insert { element } => match element {
Element::Item(..) => "Insert Item".to_string(),
Element::Reference(..) => "Insert Ref".to_string(),
Element::Tree(..) => "Insert Tree".to_string(),
Element::SumTree(..) => "Insert Sum Tree".to_string(),
Element::SumItem(..) => "Insert Sum Item".to_string(),
},
Op::Replace { element } => match element {
Element::Item(..) => "Replace Item".to_string(),
Element::Reference(..) => "Replace Ref".to_string(),
Element::Tree(..) => "Replace Tree".to_string(),
Element::SumTree(..) => "Replace Sum Tree".to_string(),
Element::SumItem(..) => "Replace Sum Item".to_string(),
},
Op::Patch { element, .. } => match element {
Element::Item(..) => "Patch Item".to_string(),
Element::Reference(..) => "Patch Ref".to_string(),
Element::Tree(..) => "Patch Tree".to_string(),
Element::SumTree(..) => "Patch Sum Tree".to_string(),
Element::SumItem(..) => "Patch Sum Item".to_string(),
},
Op::Insert { element } => format!("Insert {:?}", element),
Op::Replace { element } => format!("Replace {:?}", element),
Op::Patch { element, .. } => format!("Patch {:?}", element),
Op::RefreshReference {
reference_path_type,
max_reference_hop,
Expand Down
5 changes: 2 additions & 3 deletions grovedb/src/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2665,13 +2665,12 @@ fn test_query_b_depends_on_query_a() {
fn test_prove_absent_path_with_intermediate_emtpy_tree() {
// root
// test_leaf (empty)
let mut grovedb = make_test_grovedb();
let grovedb = make_test_grovedb();

// prove the absence of key "book" in ["test_leaf", "invalid"]
let mut query = Query::new();
query.insert_key(b"book".to_vec());
let mut path_query =
PathQuery::new_unsized(vec![TEST_LEAF.to_vec(), b"invalid".to_vec()], query);
let path_query = PathQuery::new_unsized(vec![TEST_LEAF.to_vec(), b"invalid".to_vec()], query);

let proof = grovedb
.prove_query(&path_query)
Expand Down
33 changes: 29 additions & 4 deletions grovedb/src/visualize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,24 @@ use crate::{
impl Visualize for Element {
fn visualize<W: Write>(&self, mut drawer: Drawer<W>) -> Result<Drawer<W>> {
match self {
Element::Item(value, _) => {
Element::Item(value, flags) => {
drawer.write(b"item: ")?;
drawer = value.visualize(drawer)?;

if let Some(f) = flags {
if !f.is_empty() {
drawer = f.visualize(drawer)?;
}
}
}
Element::SumItem(value, _) => {
Element::SumItem(value, flags) => {
drawer.write(format!("sum_item: {value}").as_bytes())?;

if let Some(f) = flags {
if !f.is_empty() {
drawer = f.visualize(drawer)?;
}
}
}
Element::Reference(_ref, ..) => {
drawer.write(b"ref")?;
Expand All @@ -64,13 +76,26 @@ impl Visualize for Element {
// }
// drawer.write(b"]")?;
}
Element::Tree(root_key, _) => {
Element::Tree(root_key, flags) => {
drawer.write(b"tree: ")?;
drawer = root_key.as_deref().visualize(drawer)?;

if let Some(f) = flags {
if !f.is_empty() {
drawer = f.visualize(drawer)?;
}
}
}
Element::SumTree(root_key, ..) => {
Element::SumTree(root_key, value, flags) => {
drawer.write(b"sum_tree: ")?;
drawer = root_key.as_deref().visualize(drawer)?;
drawer.write(format!(" {value}").as_bytes())?;

if let Some(f) = flags {
if !f.is_empty() {
drawer = f.visualize(drawer)?;
}
}
}
}
Ok(drawer)
Expand Down

0 comments on commit b40dd1a

Please sign in to comment.