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: implement PublicDirectory conflict reconciliation #426

Merged
merged 11 commits into from
Apr 18, 2024

Conversation

matheus23
Copy link
Member

@matheus23 matheus23 commented Apr 16, 2024

This implements three functions:

  • PublicDirectory::reconcile which takes two directories & reconciles all changes between them. Think of this as similar to get pull, but where conflicts in files are merged automatically via a simple tie-breaking mechanism on the file hash. The return value indicates whether and which files were affected by the automatic merge, if at all.
  • PublicDirectory::merge, the underlying function for reconcile, but which doesn't take into account if one of the directories may have been "ahead" in history. Use only if you know what you're doing, otherwise opt for reconcile.
  • PublicNode::causal_compare, the underlying function in reconcile that figures out whether one version of a node is "ahead" of another or behind, or if they're two conflicting versions and need to be merged.

@matheus23 matheus23 self-assigned this Apr 16, 2024
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 56.91057% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 54.48%. Comparing base (7931ad6) to head (3ee27b4).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #426      +/-   ##
==========================================
+ Coverage   54.35%   54.48%   +0.12%     
==========================================
  Files          57       57              
  Lines        4003     4126     +123     
  Branches      980     1028      +48     
==========================================
+ Hits         2176     2248      +72     
- Misses       1191     1220      +29     
- Partials      636      658      +22     
Files Coverage Δ
wnfs-hamt/src/diff.rs 19.46% <ø> (ø)
wnfs-hamt/src/node.rs 52.73% <ø> (ø)
wnfs-hamt/src/pointer.rs 20.45% <ø> (ø)
wnfs-nameaccumulator/src/name.rs 82.27% <ø> (ø)
wnfs-unixfs-file/src/balanced_tree.rs 80.48% <ø> (ø)
wnfs-unixfs-file/src/builder.rs 51.85% <ø> (ø)
wnfs-unixfs-file/src/protobufs.rs 0.00% <ø> (ø)
wnfs/src/private/file.rs 70.11% <ø> (ø)
wnfs-common/src/metadata.rs 29.50% <62.50%> (+4.97%) ⬆️
wnfs/src/public/node/node.rs 66.07% <81.57%> (+7.96%) ⬆️
... and 2 more

... and 1 file with indirect coverage changes

@matheus23 matheus23 marked this pull request as ready for review April 18, 2024 13:10
@matheus23 matheus23 requested a review from a team as a code owner April 18, 2024 13:10
@matheus23 matheus23 changed the title feat: Conflict reconciliation feat: implement PublicDirectory conflict reconciliation Apr 18, 2024
@matheus23 matheus23 merged commit dc0785a into main Apr 18, 2024
12 checks passed
@matheus23 matheus23 deleted the matheus23/conflict-reconciliation branch April 18, 2024 13:11
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