Commit f10b5dd9 authored by Steven Allen's avatar Steven Allen

Add RemoveMany method

parent b4033237
......@@ -64,6 +64,15 @@ func (d *testDag) Remove(c *cid.Cid) error {
return nil
}
func (d *testDag) RemoveMany(cids []*cid.Cid) error {
d.mu.Lock()
defer d.mu.Unlock()
for _, c := range cids {
delete(d.nodes, c.KeyString())
}
return nil
}
var _ DAGService = new(testDag)
func TestBatch(t *testing.T) {
......
......@@ -55,4 +55,9 @@ type DAGService interface {
// Consider using NewBatch instead of calling this directly if you need
// to add an unbounded number of nodes to avoid buffering too much.
AddMany([]Node) error
// RemoveMany removes many nodes from this DAG.
//
// It returns success even if the nodes were not present in the DAG.
RemoveMany([]*cid.Cid) error
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment