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

refactor: Evolve BlockStore trait #402

Merged
merged 20 commits into from
Feb 15, 2024
Merged

refactor: Evolve BlockStore trait #402

merged 20 commits into from
Feb 15, 2024

Conversation

matheus23
Copy link
Member

@matheus23 matheus23 commented Feb 13, 2024

  • Use new RPITIT instead of async_trait macro for all traits
  • Expose blanket implementation impl<B: BlockStore> BlockStore for &B and Box<B>
  • Add two functions to trait BlockStore:
    • async fn has_block(&self, cid: &Cid) -> Result<bool>; to find out whether a block is available locally
    • async 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.
  • Use explicit BlockStoreError type in trait Blockstore instead of anyhow::Error
  • Update rug dependency to 1.24

@matheus23 matheus23 self-assigned this Feb 13, 2024
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (aff9cf1) 54.52% compared to head (3d5793e) 54.58%.

Additional details and impacted files

Impacted file tree graph

@@            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     
Files Coverage Δ
wnfs-common/src/link.rs 39.70% <ø> (ø)
wnfs-hamt/src/hamt.rs 68.75% <ø> (ø)
wnfs-hamt/src/pointer.rs 20.45% <ø> (-1.77%) ⬇️
wnfs-nameaccumulator/src/name.rs 84.81% <ø> (+0.09%) ⬆️
wnfs-nameaccumulator/src/traits.rs 78.33% <100.00%> (-0.70%) ⬇️
wnfs-unixfs-file/src/unixfs.rs 28.23% <ø> (ø)
wnfs/examples/mnemonic_based.rs 0.00% <ø> (ø)
wnfs/src/lib.rs 90.00% <ø> (ø)
wnfs/src/private/forest/hamt.rs 60.00% <ø> (+3.56%) ⬆️
wnfs/src/private/forest/proofs.rs 52.30% <ø> (-1.80%) ⬇️
... and 18 more

... and 1 file with indirect coverage changes

@matheus23 matheus23 marked this pull request as ready for review February 15, 2024 17:29
@matheus23 matheus23 requested a review from a team as a code owner February 15, 2024 17:29
@matheus23 matheus23 merged commit 3eaee3c into main Feb 15, 2024
12 checks passed
@matheus23 matheus23 deleted the matheus23/evolve-trait branch February 15, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant