-
Notifications
You must be signed in to change notification settings - Fork 25
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
refactor: Evolve BlockStore
trait
#402
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #402 +/- ##
==========================================
+ Coverage 54.52% 54.58% +0.05%
==========================================
Files 57 57
Lines 3943 3959 +16
Branches 948 959 +11
==========================================
+ Hits 2150 2161 +11
- Misses 1181 1183 +2
- Partials 612 615 +3
|
This way is recommended by dtolnay (rust-lang/api-guidelines#158) and the "Rust for Rustaceans" book (paragraph "Ergonomic Trait Implementations"). This leads to better compiler error messages when you pass something that doesn't `impl BlockStore` the right way. `rand_core` explicitly decided against a `DerefMut` blanket implementation for `trait RngCore`.
Use the `Storable` trait and its `store` and `load` functions instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
async_trait
macro for all traitsimpl<B: BlockStore> BlockStore for &B
andBox<B>
trait BlockStore
:async fn has_block(&self, cid: &Cid) -> Result<bool>;
to find out whether a block is available locallyasync fn put_block_keyed(&self, cid: &Cid, bytes: impl Into<Bytes> + CondSend) -> Result<()>;
to add a block with given CID to the blockstore. This allows us to support adding blocks using different hashing functions to the same blockstore.BlockStoreError
type intrait Blockstore
instead ofanyhow::Error
rug
dependency to1.24