Commit a7fc136a authored by Hector Sanjuan's avatar Hector Sanjuan

Golint: merkledag: let NewDagService return *dagService

License: MIT
Signed-off-by: default avatarHector Sanjuan <hector@protocol.ai>
parent e91a9c49
...@@ -30,7 +30,7 @@ const progressContextKey contextKey = "progress" ...@@ -30,7 +30,7 @@ const progressContextKey contextKey = "progress"
// NewDAGService constructs a new DAGService (using the default implementation). // NewDAGService constructs a new DAGService (using the default implementation).
// Note that the default implementation is also an ipld.LinkGetter. // Note that the default implementation is also an ipld.LinkGetter.
func NewDAGService(bs bserv.BlockService) ipld.DAGService { func NewDAGService(bs bserv.BlockService) *dagService {
return &dagService{Blocks: bs} return &dagService{Blocks: bs}
} }
......
...@@ -242,8 +242,7 @@ func TestFetchGraph(t *testing.T) { ...@@ -242,8 +242,7 @@ func TestFetchGraph(t *testing.T) {
// create an offline dagstore and ensure all blocks were fetched // create an offline dagstore and ensure all blocks were fetched
bs := bserv.New(bsis[1].Blockstore(), offline.Exchange(bsis[1].Blockstore())) bs := bserv.New(bsis[1].Blockstore(), offline.Exchange(bsis[1].Blockstore()))
// we know the default dagService implements LinkGetter offlineDS := NewDAGService(bs)
offlineDS := NewDAGService(bs).(ipld.LinkGetter)
err = EnumerateChildren(context.Background(), offlineDS.GetLinks, root.Cid(), func(_ *cid.Cid) bool { return true }) err = EnumerateChildren(context.Background(), offlineDS.GetLinks, root.Cid(), func(_ *cid.Cid) bool { return true })
if err != nil { if err != nil {
...@@ -262,9 +261,8 @@ func TestEnumerateChildren(t *testing.T) { ...@@ -262,9 +261,8 @@ func TestEnumerateChildren(t *testing.T) {
} }
set := cid.NewSet() set := cid.NewSet()
lg := ds.(ipld.LinkGetter)
err = EnumerateChildren(context.Background(), lg.GetLinks, root.Cid(), set.Visit) err = EnumerateChildren(context.Background(), ds.GetLinks, root.Cid(), set.Visit)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -495,7 +493,7 @@ func TestCidRetention(t *testing.T) { ...@@ -495,7 +493,7 @@ func TestCidRetention(t *testing.T) {
} }
func TestCidRawDoesnNeedData(t *testing.T) { func TestCidRawDoesnNeedData(t *testing.T) {
srv := NewDAGService(dstest.Bserv()).(ipld.LinkGetter) srv := NewDAGService(dstest.Bserv())
nd := NewRawNode([]byte("somedata")) nd := NewRawNode([]byte("somedata"))
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
......
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