Skip to content

fix inconsistent EnumerateChildrenAsync behavior#41

Merged
Stebalien merged 2 commits intomasterfrom
fix/walk-behavior
Jul 11, 2019
Merged

fix inconsistent EnumerateChildrenAsync behavior#41
Stebalien merged 2 commits intomasterfrom
fix/walk-behavior

Conversation

@Stebalien
Copy link
Copy Markdown
Member

This fixes the inconsistent EnumerateChildrenAsync behavior by renaming everything.

  1. EnumerateChildrenAsync has been renamed to WalkParallel because it visited root in addition to the children and isn't async (it's parallel).
  2. EnumerateChildren has been renamed to Walk and now also visits the root for consistency.

Anyone needing to skip the root can do so manually (if c.Equals(root) ...).

This is an intentionally breaking change to force an audit of all callsites.

Q: Should we leave an (additional) EnumerateChildren function? That function does exactly what it says already.

This fixes the inconsistent EnumerateChildrenAsync behavior by renaming
everything.

1. EnumerateChildrenAsync has been renamed to WalkParallel because (a) it
visited the root so EnumerateChildren was incorrect and (b) it isn't async.
2. EnumerateChildren has been renamed to Walk and now _also_ visits the root for
consistency.

Anyone needing to skip the root can do so manually (`if c.Equals(root)` ...).
@Stebalien Stebalien requested a review from hsanjuan July 11, 2019 21:54
@Stebalien Stebalien merged commit 625228c into master Jul 11, 2019
@Stebalien Stebalien deleted the fix/walk-behavior branch July 11, 2019 22:16
@Stebalien
Copy link
Copy Markdown
Member Author

Take heed @ipfs/wg-go-core.

Jorropo pushed a commit to ipfs/boxo that referenced this pull request Mar 15, 2023
fix inconsistent EnumerateChildrenAsync behavior

This commit was moved from ipfs/go-merkledag@625228c
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