diff --git a/firewood/src/db.rs b/firewood/src/db.rs index 09a0285eb..37585fb41 100644 --- a/firewood/src/db.rs +++ b/firewood/src/db.rs @@ -305,12 +305,12 @@ impl + Send + Sync> api::DbView for DbRev { .map_err(|e| api::Error::IO(std::io::Error::new(ErrorKind::Other, e))) } - async fn range_proof( + async fn range_proof( &self, _first_key: Option, _last_key: Option, - _limit: usize, - ) -> Result>, api::Error> { + _limit: Option, + ) -> Result, Vec>>, api::Error> { todo!() } } diff --git a/firewood/src/db/proposal.rs b/firewood/src/db/proposal.rs index bfe6caa7e..8afd099ec 100644 --- a/firewood/src/db/proposal.rs +++ b/firewood/src/db/proposal.rs @@ -295,12 +295,12 @@ impl api::DbView for Proposal { .map_err(|e| api::Error::IO(std::io::Error::new(ErrorKind::Other, e))) } - async fn range_proof( + async fn range_proof( &self, _first_key: Option, _last_key: Option, - _limit: usize, - ) -> Result>, api::Error> + _limit: Option, + ) -> Result, Vec>>, api::Error> where K: api::KeyType, { diff --git a/firewood/src/v2/api.rs b/firewood/src/v2/api.rs index 0ddacbe71..9272576e8 100644 --- a/firewood/src/v2/api.rs +++ b/firewood/src/v2/api.rs @@ -71,15 +71,18 @@ pub enum Error { InvalidProposal, #[error("Internal error")] - InternalError(Box), + InternalError(Box), + + #[error("RangeProofError")] + RangeProofError(String), } /// A range proof, consisting of a proof of the first key and the last key, /// and a vector of all key/value pairs #[derive(Debug)] -pub struct RangeProof { - pub first_key: Proof, - pub last_key: Proof, +pub struct RangeProof { + pub first_key: Proof>, + pub last_key: Proof>, pub middle: Vec<(K, V)>, } @@ -152,12 +155,12 @@ pub trait DbView { /// * `last_key` - If None, continue to the end of the database /// * `limit` - The maximum number of keys in the range proof /// - async fn range_proof( + async fn range_proof( &self, first_key: Option, last_key: Option, - limit: usize, - ) -> Result>, Error>; + limit: Option, + ) -> Result, Vec>>, Error>; } /// A proposal for a new revision of the database. diff --git a/firewood/src/v2/emptydb.rs b/firewood/src/v2/emptydb.rs index 762504aad..746373ab1 100644 --- a/firewood/src/v2/emptydb.rs +++ b/firewood/src/v2/emptydb.rs @@ -66,12 +66,12 @@ impl DbView for HistoricalImpl { Ok(None) } - async fn range_proof( + async fn range_proof( &self, _first_key: Option, _last_key: Option, - _limit: usize, - ) -> Result>, Error> { + _limit: Option, + ) -> Result, Vec>>, Error> { Ok(None) } } diff --git a/firewood/src/v2/propose.rs b/firewood/src/v2/propose.rs index d00e8ee2a..053a6a059 100644 --- a/firewood/src/v2/propose.rs +++ b/firewood/src/v2/propose.rs @@ -128,12 +128,12 @@ impl api::DbView for Proposal { todo!() } - async fn range_proof( + async fn range_proof( &self, _first_key: Option, _last_key: Option, - _limit: usize, - ) -> Result>, api::Error> { + _limit: Option, + ) -> Result, Vec>>, api::Error> { todo!() } }