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: Introduce Storable trait #378

Merged
merged 17 commits into from
Dec 5, 2023
Merged

Conversation

matheus23
Copy link
Member

@matheus23 matheus23 commented Dec 5, 2023

Main use case is allowing us to use Link<UnixFsFile> as a type in PublicFile::userland.
Other use case is allowing us to nest the WNFS Hamt: Node<String, Node<String, String>> is now possible (previously it required K: Serialize and V: Serialize (and we don't generally want to make both K: AsyncSerialize and V: AsyncSerialize.

Also:

  • Remove AsyncSerializable
  • Remove RemembersCid (both of these are now handled by Storable)
  • Remove TryFrom<Ipld> instances that were used for deserialization of some types
  • Remove BlockStore::put_async_serializable function (you can just use Storable::store instead)
  • Introduce NodeSerializable and HamtSerializable for wnfs-hamt to follow the pattern used in wnfs.

TODO

  • Write documentation for Storable trait & functions
  • Look at wnfs-wasm

@matheus23 matheus23 requested a review from a team as a code owner December 5, 2023 15:18
@matheus23 matheus23 self-assigned this Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #378 (d95840d) into main (2b67800) will increase coverage by 0.75%.
The diff coverage is 40.45%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
+ Coverage   53.86%   54.62%   +0.75%     
==========================================
  Files          55       56       +1     
  Lines        3891     3879      -12     
  Branches      954      933      -21     
==========================================
+ Hits         2096     2119      +23     
+ Misses       1182     1161      -21     
+ Partials      613      599      -14     
Files Coverage Δ
wnfs-common/src/blockstore.rs 57.14% <ø> (+5.62%) ⬆️
wnfs-common/src/encoding.rs 62.50% <ø> (ø)
wnfs-hamt/src/hamt.rs 68.75% <ø> (+27.72%) ⬆️
wnfs-nameaccumulator/src/name.rs 82.53% <ø> (ø)
wnfs/examples/private.rs 0.00% <ø> (ø)
wnfs/examples/tiered_blockstores.rs 0.00% <ø> (ø)
wnfs/examples/write_proofs.rs 0.00% <ø> (ø)
wnfs/src/lib.rs 90.00% <ø> (ø)
wnfs/src/private/directory.rs 68.92% <ø> (ø)
wnfs/src/root_tree.rs 63.23% <ø> (ø)
... and 12 more

... and 2 files with indirect coverage changes

@matheus23 matheus23 merged commit 17c14c4 into main Dec 5, 2023
10 checks passed
@matheus23 matheus23 deleted the matheus23/storable-refactor branch December 5, 2023 18:04
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