Commit Graph

31 Commits

Author SHA1 Message Date
Kris Nuttycombe 2b8e2d62fa Address comments from code review.
This also provides a minor performance and correctness improvement to
`remove_mark`.
2023-05-24 09:30:14 -06:00
Kris Nuttycombe 4efe39eaa6 Remove initial checkpoints.
The choice to use an initial checkpoint as an anchor for removals in
`unmark` operations produced an awkward situation where it was necessary
to choose a checkpoint identifier just to construct an empty tree. This
removes that decision in favor of eagerly removing data if there is no
checkpoint to tie the removal to.
2023-05-22 12:11:34 -06:00
Kris Nuttycombe 5691b70947 Restore the relevant part of a deleted comment. 2023-05-22 10:29:40 -06:00
Kris Nuttycombe e2fa0a44c7 Make all `ShardStore` methods return `Result`
When implementing `ShardStore` atop a persistent data store, we need to
be able to reflect failures of the storage layer that are independent of
the presence or absence of data.
2023-05-19 15:45:03 -06:00
Kris Nuttycombe f292a271ac Return owned types from `ShardStore` getter methods.
The primary implementations of `ShardStore` will be constructing
owned values from an underlying persistence layer, and it is not
possible to return a reference to an owned value.
2023-05-19 15:43:06 -06:00
Kris Nuttycombe dbb2a8f9c5 Make hash and checkpoint ID type parameters associated types of `ShardStore` 2023-05-11 12:04:37 -06:00
Kris Nuttycombe 666e72482a Address Clippy lints. 2023-05-10 20:44:58 -06:00
Kris Nuttycombe 247b38f336 Invert the relationship between shardtree errors and storage errors. 2023-05-10 20:44:57 -06:00
Kris Nuttycombe 0e502e3832 Add `Display` impl for `shardtree::InsertionError` 2023-05-10 20:43:56 -06:00
Kris Nuttycombe 10e5ee59a4 Distinguish between creating a new empty tree and loading data for an existing tree. 2023-05-10 20:43:20 -06:00
Kris Nuttycombe e15440bd37 Add checkpoint management APIs to `ShardStore`. 2023-05-10 20:43:20 -06:00
Kris Nuttycombe ed78bc2e56 Add dedicated `MemoryShardStore` type. 2023-05-10 20:43:18 -06:00
Kris Nuttycombe 62acf235a7
Merge pull request #68 from nuttycom/u64_positions
Use `u64` for the internal state of `Position` and `Address::index`
2023-05-10 20:34:59 -06:00
Kris Nuttycombe 34d9aa25bc Use `u64` for the internal state of `Position` and `Address::index` 2023-05-10 16:46:23 -06:00
Kris Nuttycombe 465f2ff0d8 Add a blanket implementation of ShardStore for mutable references to ShardStores. 2023-05-04 13:46:02 -06:00
Kris Nuttycombe 873a72ff98 Return `MerklePath` from `ShardTree::witness` 2023-04-06 19:48:10 -06:00
Kris Nuttycombe 257402db53 Address comments from review. 2023-03-20 16:12:30 -06:00
Kris Nuttycombe d7a04122ea Fix clippy complaints. 2023-03-13 11:42:57 -06:00
Kris Nuttycombe ac6e8e8212 Use direct recursion in shardtree instead of reduce/try_reduce
These more general functions weren't carrying their weight.
2023-03-09 16:29:24 -07:00
Kris Nuttycombe 664cead68b Use `bitflags` crate instead of hand-rolled `RetentionFlags` bit flags. 2023-03-09 13:51:56 -07:00
Kris Nuttycombe 37be939c0f Apply suggestions from code review
Co-authored-by: ebfull <ewillbefull@gmail.com>
2023-03-09 13:37:22 -07:00
Kris Nuttycombe fa7c6673fd Make `LocatedTree` and `LocatedPrunableTree` type aliases public. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe 0cb1cec21f Add `shardtree` witness operation & implement property tests. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe a7bb8bb749 Add `shardtree` batch insertion. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe e209f3bf20 Add `shardtree` checkpointing & root computation. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe ebe3efa135 Add ShardTree types & implement append operation. 2023-03-08 11:12:17 -07:00
Kris Nuttycombe dc5a3ed0e7 Add types & operations for individual shards.
This adds the `LocatedPrunableTree` type, which provides the complete
set of operations for individual shards within a larger tree.
2023-03-08 11:11:16 -07:00
Kris Nuttycombe 34f6bd7ce5 Add a `LocatedTree` type that pairs tree roots with address information. 2023-03-08 11:09:43 -07:00
Kris Nuttycombe 8644372c4e Add types and methods to support tree pruning.
Each leaf of the tree is annotated with retention metadata, and
ephemeral leaves can be aggressively pruned when performing insertions
into the tree.
2023-03-08 11:08:59 -07:00
Kris Nuttycombe 8864a84d19 Introduce a simple binary tree type. 2023-03-08 11:07:58 -07:00
Kris Nuttycombe 0ae9b499cc Introduce the `shardtree` crate: a sparse Merkle tree type. 2023-03-07 12:11:48 -07:00