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

WIP: Modify dag service to work with new multihash based blockservice. #17

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions merkledag.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ func (n *dagService) GetLinks(ctx context.Context, c cid.Cid) ([]*ipld.Link, err
return node.Links(), nil
}

// Remove, removes a node from a DAG. Due to the fact that the
// underlying blockservice is indexed based on Multihash and not CIDs
// it may also remove other nodes with the same multihash, but
// different CID's due to a different Codec or CID version.
func (n *dagService) Remove(ctx context.Context, c cid.Cid) error {
return n.Blocks.DeleteBlock(c)
return n.Blocks.DeleteBlock(c.Hash())
}

// RemoveMany removes multiple nodes from the DAG. It will likely be faster than
Expand All @@ -104,7 +108,7 @@ func (n *dagService) Remove(ctx context.Context, c cid.Cid) error {
func (n *dagService) RemoveMany(ctx context.Context, cids []cid.Cid) error {
// TODO(#4608): make this batch all the way down.
for _, c := range cids {
if err := n.Blocks.DeleteBlock(c); err != nil {
if err := n.Blocks.DeleteBlock(c.Hash()); err != nil {
return err
}
}
Expand Down