diff --git a/firewood/src/db.rs b/firewood/src/db.rs index 88e2a8b32..5677b885c 100644 --- a/firewood/src/db.rs +++ b/firewood/src/db.rs @@ -8,7 +8,7 @@ pub use crate::{ }; use crate::{ file, - merkle::{Bincode, Merkle, MerkleError, Node, Proof, ProofError, TrieHash, TRIE_HASH_LEN}, + merkle::{Bincode, Key, Merkle, MerkleError, Node, Proof, ProofError, TrieHash, TRIE_HASH_LEN}, storage::{ buffer::{DiskBuffer, DiskBufferRequester}, CachedSpace, MemStoreR, SpaceWrite, StoreConfig, StoreDelta, StoreRevMut, StoreRevShared, @@ -323,10 +323,7 @@ impl + Send + Sync> DbRev { self.merkle.key_value_iter(self.header.kv_root) } - pub fn stream_from( - &self, - start_key: Box<[u8]>, - ) -> merkle::MerkleKeyValueStream<'_, S, Bincode> { + pub fn stream_from(&self, start_key: Key) -> merkle::MerkleKeyValueStream<'_, S, Bincode> { self.merkle .key_value_iter_from_key(self.header.kv_root, start_key) } diff --git a/firewood/src/merkle.rs b/firewood/src/merkle.rs index d54dcb0a5..2aafb36b6 100644 --- a/firewood/src/merkle.rs +++ b/firewood/src/merkle.rs @@ -31,7 +31,7 @@ type NodeObjRef<'a> = shale::ObjRef<'a, Node>; type ParentRefs<'a> = Vec<(NodeObjRef<'a>, u8)>; type ParentAddresses = Vec<(DiskAddress, u8)>; -type Key = Box<[u8]>; +pub type Key = Box<[u8]>; type Value = Vec; #[derive(Debug, Error)] @@ -1381,7 +1381,7 @@ impl + Send + Sync, T> Merkle { pub(crate) fn key_value_iter_from_key( &self, root: DiskAddress, - key: Box<[u8]>, + key: Key, ) -> MerkleKeyValueStream<'_, S, T> { MerkleKeyValueStream::from_key(self, root, key) } diff --git a/firewood/src/merkle/stream.rs b/firewood/src/merkle/stream.rs index 9f407e570..abfee7b38 100644 --- a/firewood/src/merkle/stream.rs +++ b/firewood/src/merkle/stream.rs @@ -140,7 +140,7 @@ impl<'a, S: ShaleStore + Send + Sync, T> Stream for MerkleNodeStream<'a, S // The child's key is its parent's key, followed by the child's index, // followed by the child's partial path (if any). - let child_key: Box<[u8]> = key + let child_key: Key = key .iter() .copied() .chain(once(pos)) @@ -599,7 +599,7 @@ mod tests { pub(crate) fn node_iter_from( &self, root: DiskAddress, - key: Box<[u8]>, + key: Key, ) -> MerkleNodeStream<'_, S, T> { MerkleNodeStream::new(self, root, key) } diff --git a/fwdctl/src/dump.rs b/fwdctl/src/dump.rs index a86a6f862..928574b4b 100644 --- a/fwdctl/src/dump.rs +++ b/fwdctl/src/dump.rs @@ -1,15 +1,15 @@ // Copyright (C) 2023, Ava Labs, Inc. All rights reserved. // See the file LICENSE.md for licensing terms. -use std::borrow::Cow; - use clap::Args; use firewood::{ db::{Db, DbConfig, WalConfig}, + merkle::Key, v2::api::{self, Db as _}, }; use futures_util::StreamExt; use log; +use std::borrow::Cow; #[derive(Debug, Args)] pub struct Options { @@ -30,7 +30,7 @@ pub struct Options { value_parser = key_parser, help = "Start dumping from this key (inclusive)." )] - pub start_key: Option>, + pub start_key: Option, } pub(super) async fn run(opts: &Options) -> Result<(), api::Error> {