Add `Remove()` method for CRDT heads
- Dominant language
- Go
- Stars
- 489
- Forks
- 60
- Avg merge
- 1h 15m
- Merged PRs (30d)
- 1
Description
It would be helpful to have a `Remove()` method to delete a head from the CRDT DAG. Right now, we only have `Add(newHead)` and `Replace(oldHead, newHead)` (see heads.go). But sometimes, after adding the tip of a branch as a new head, we just want to remove the old heads we've traversed, not replace them. It's a bit awkward to call `Replace(oldHead, oldTip)` (which can re-add an old head as a tip if another branch walk covers it again).
Having a Remove makes branch-walk logic simpler and avoids accidentally restoring old heads that should be gone.
Rough idea:
- Add `Remove(head)` to the Heads interface and implementation. There's already a private `delete` helper in heads.go.
- Use Remove when processing traversed heads while doing walks instead of Replace. Follow up to #355
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in heads.go with the Heads interface, its implementation, and the existing private delete helper. Trace the branch-walk logic that currently uses Replace for traversed heads, and review follow-up issue #355 for context. Done means Remove is supported and traversed heads can be removed without re-adding an old head as a tip.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100