mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 19:44:01 +08:00
Add DAGService.GetLinks() method and use it in the GC and elsewhere.
This method will use the (also new) LinkService if it is available to retrieving just the links for a MerkleDAG without necessary having to retrieve the underlying block. For now the main benefit is that the pinner will not break when a block becomes invalid due to a change in the backing file. This is possible because the metadata for a block (that includes the Links) is stored separately and thus always available even if the backing file changes. License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
@ -98,7 +98,7 @@ func TestAddGCLive(t *testing.T) {
|
||||
gcstarted := make(chan struct{})
|
||||
go func() {
|
||||
defer close(gcstarted)
|
||||
gcchan, err := gc.GC(context.Background(), node.Blockstore, node.Pinning, nil)
|
||||
gcchan, err := gc.GC(context.Background(), node.Blockstore, node.LinkService, node.Pinning, nil)
|
||||
if err != nil {
|
||||
log.Error("GC ERROR:", err)
|
||||
errs <- err
|
||||
@ -162,7 +162,7 @@ func TestAddGCLive(t *testing.T) {
|
||||
}
|
||||
|
||||
set := cid.NewSet()
|
||||
err = dag.EnumerateChildren(ctx, node.DAG, root, set.Visit, false)
|
||||
err = dag.EnumerateChildren(ctx, node.DAG, root.Links, set.Visit, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user