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

feat(hamt): diff and merge implementation #94

Merged
merged 11 commits into from
Jan 6, 2023
Merged

Conversation

appcypher
Copy link
Member

@appcypher appcypher commented Nov 29, 2022

Summary

This PR implements diffing algos for observing the differences between two HAMT roots.

This PR implements the following features

  • Tree diff
  • Key-value diff
  • HAMT merge

Others

  • Unit tests
  • Proptests
  • Doc

Test plan (required)

  • Testing

    rs-wnfs test --all

Closing issues

Fixes #92
Fixes #93

@codecov
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Merging #94 (22622fa) into main (5babeb1) will decrease coverage by 0.49%.
The diff coverage is 67.19%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
- Coverage   69.29%   68.80%   -0.50%     
==========================================
  Files          27       32       +5     
  Lines        2013     2366     +353     
  Branches      471      586     +115     
==========================================
+ Hits         1395     1628     +233     
- Misses        239      265      +26     
- Partials      379      473      +94     
Impacted Files Coverage Δ
wnfs/src/common/blockstore.rs 50.00% <ø> (ø)
wnfs/src/common/error.rs 0.00% <ø> (ø)
wnfs/src/private/file.rs 80.67% <ø> (ø)
wnfs/src/private/hamt/pointer.rs 52.54% <0.00%> (+1.66%) ⬆️
wnfs/src/private/key.rs 62.50% <ø> (ø)
wnfs/src/private/namefilter/bloomfilter.rs 88.57% <ø> (ø)
wnfs/src/public/directory.rs 71.17% <0.00%> (ø)
wnfs/src/common/link.rs 43.90% <33.33%> (-2.26%) ⬇️
wnfs/src/private/hamt/node.rs 59.52% <48.00%> (-4.94%) ⬇️
wnfs/src/private/hamt/hamt.rs 51.35% <50.00%> (-0.08%) ⬇️
... and 14 more

- lean diff method that focuses on the tree
- exhaustive diff that holds a copy of changed key value pairs
@appcypher appcypher changed the title Implement HAMT Diff HAMT Diffing & Merging Dec 8, 2022
@appcypher appcypher marked this pull request as ready for review December 9, 2022 14:55
@appcypher appcypher requested a review from a team as a code owner December 9, 2022 14:55
- Add some docs
- Not satisfied with the proptests yet
- Implement merge for `Node<k, V, H>`
- Add more proptests, unittests and docs
- Remove hashbrown crate
Co-authored-by: Philipp Krüger <[email protected]>
@appcypher appcypher changed the title HAMT Diffing & Merging feat(hamt): diff and merge implementation Dec 15, 2022
wnfs/src/common/mod.rs Outdated Show resolved Hide resolved
wnfs/src/private/forest.rs Show resolved Hide resolved
wnfs-bench/namefilter.rs Show resolved Hide resolved
wnfs/src/common/blockstore.rs Show resolved Hide resolved
wnfs/src/private/forest.rs Outdated Show resolved Hide resolved
wnfs/src/private/hamt/strategies/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff algorithm is well written and easy to follow! Great job 👍

wnfs/src/private/forest.rs Show resolved Hide resolved
wnfs/src/private/forest.rs Outdated Show resolved Hide resolved
wnfs/src/private/forest.rs Show resolved Hide resolved
wnfs/src/private/forest.rs Show resolved Hide resolved
wnfs/src/private/hamt/diff/key_value.rs Outdated Show resolved Hide resolved
wnfs/src/private/hamt/diff/node.rs Outdated Show resolved Hide resolved
wnfs/src/private/hamt/merge.rs Outdated Show resolved Hide resolved
wnfs/src/private/hamt/merge.rs Outdated Show resolved Hide resolved
wnfs/src/private/hamt/node.rs Show resolved Hide resolved
wnfs/src/private/key.rs Show resolved Hide resolved
- Simplify tests
- UnwrapOrClone trait
- Prefer once_cell
- Remove depth param from diff
- Remove version checks in hamt
- CHange HashKey to HashPrefix
@appcypher appcypher merged commit 883b3ab into main Jan 6, 2023
@appcypher appcypher deleted the appcypher/hamt-diff branch January 6, 2023 18:03
@github-actions github-actions bot mentioned this pull request Jan 6, 2023
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.

HAMT Merge HAMT diff
3 participants