Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merk state sync chunking #267

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions grovedb/src/batch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2432,8 +2432,8 @@ mod tests {
Element::empty_tree(),
),
];
assert!(matches!(
db.apply_batch(
assert!(db
.apply_batch(
ops,
Some(BatchApplyOptions {
validate_insertion_does_not_override: false,
Expand All @@ -2446,9 +2446,8 @@ mod tests {
}),
None
)
.unwrap(),
Ok(_)
));
.unwrap()
.is_ok());
}

#[test]
Expand Down Expand Up @@ -3489,7 +3488,7 @@ mod tests {
elem.clone(),
),
];
assert!(matches!(db.apply_batch(batch, None, None).unwrap(), Ok(_)));
assert!(db.apply_batch(batch, None, None).unwrap().is_ok());
assert_eq!(
db.get([TEST_LEAF].as_ref(), b"key1", None)
.unwrap()
Expand All @@ -3506,7 +3505,7 @@ mod tests {
.unwrap()
.expect("should generate proof");
let verification_result = GroveDb::verify_query_raw(&proof, &path_query);
assert!(matches!(verification_result, Ok(_)));
assert!(verification_result.is_ok());

// Hit reference limit when you specify max reference hop, lower than actual hop
// count
Expand Down
4 changes: 0 additions & 4 deletions grovedb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@
pub mod query_result_type;
#[cfg(any(feature = "full", feature = "verify"))]
pub mod reference_path;
#[cfg(feature = "full")]
mod replication;
#[cfg(all(test, feature = "full"))]
mod tests;
#[cfg(feature = "full")]
Expand Down Expand Up @@ -217,8 +215,6 @@
use grovedb_visualize::DebugByteVectors;
#[cfg(any(feature = "full", feature = "verify"))]
pub use query::{PathQuery, SizedQuery};
#[cfg(feature = "full")]
pub use replication::{BufferedRestorer, Restorer, SiblingsChunkProducer, SubtreeChunkProducer};

#[cfg(any(feature = "full", feature = "verify"))]
pub use crate::error::Error;
Expand Down Expand Up @@ -321,7 +317,7 @@

/// Opens a Merk at given path for with direct write access. Intended for
/// replication purposes.
fn open_merk_for_replication<'db, 'b, B>(

Check warning on line 320 in grovedb/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

method `open_merk_for_replication` is never used

warning: method `open_merk_for_replication` is never used --> grovedb/src/lib.rs:320:8 | 244 | impl GroveDb { | ------------ method in this implementation ... 320 | fn open_merk_for_replication<'db, 'b, B>( | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
&'db self,
path: SubtreePath<'b, B>,
tx: &'db Transaction,
Expand Down Expand Up @@ -844,7 +840,7 @@
pub fn verify_grovedb(
&self,
transaction: TransactionArg,
) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {

Check warning on line 843 in grovedb/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> grovedb/src/lib.rs:843:10 | 843 | ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity = note: `#[warn(clippy::type_complexity)]` on by default
if let Some(transaction) = transaction {
let root_merk = self
.open_transactional_merk_at_path(SubtreePath::empty(), transaction, None)
Expand All @@ -870,7 +866,7 @@
merk: Merk<S>,
path: &SubtreePath<B>,
batch: Option<&'db StorageBatch>,
) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {

Check warning on line 869 in grovedb/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> grovedb/src/lib.rs:869:10 | 869 | ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
let mut all_query = Query::new();
all_query.insert_all();

Expand Down Expand Up @@ -940,7 +936,7 @@
path: &SubtreePath<B>,
batch: Option<&'db StorageBatch>,
transaction: &Transaction,
) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> {

Check warning on line 939 in grovedb/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

very complex type used. Consider factoring parts into `type` definitions

warning: very complex type used. Consider factoring parts into `type` definitions --> grovedb/src/lib.rs:939:10 | 939 | ) -> Result<HashMap<Vec<Vec<u8>>, (CryptoHash, CryptoHash, CryptoHash)>, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
let mut all_query = Query::new();
all_query.insert_all();

Expand Down
10 changes: 2 additions & 8 deletions grovedb/src/operations/delete/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,10 +1029,7 @@ mod tests {
db.get([TEST_LEAF].as_ref(), b"key1", None).unwrap(),
Err(Error::PathKeyNotFound(_))
));
assert!(matches!(
db.get([TEST_LEAF].as_ref(), b"key4", None).unwrap(),
Ok(_)
));
assert!(db.get([TEST_LEAF].as_ref(), b"key4", None).unwrap().is_ok());
}

#[test]
Expand Down Expand Up @@ -1397,10 +1394,7 @@ mod tests {
db.get([TEST_LEAF].as_ref(), b"key1", None).unwrap(),
Err(Error::PathKeyNotFound(_))
));
assert!(matches!(
db.get([TEST_LEAF].as_ref(), b"key4", None).unwrap(),
Ok(_)
));
assert!(db.get([TEST_LEAF].as_ref(), b"key4", None).unwrap().is_ok());
}

#[test]
Expand Down
Loading
Loading