ipfs / ipfs/go-ds-crdt

Add `Remove()` method for CRDT heads

Open
#356 1 comment 0 reactions 0 assignees View on GitHub
kind/enhancement need/triage
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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.