mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +08:00
Golint: merkledag: let NewDagService return *dagService
License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
This commit is contained in:
@ -30,7 +30,7 @@ const progressContextKey contextKey = "progress"
|
||||
|
||||
// NewDAGService constructs a new DAGService (using the default implementation).
|
||||
// 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}
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,7 @@ func TestFetchGraph(t *testing.T) {
|
||||
// create an offline dagstore and ensure all blocks were fetched
|
||||
bs := bserv.New(bsis[1].Blockstore(), offline.Exchange(bsis[1].Blockstore()))
|
||||
|
||||
// we know the default dagService implements LinkGetter
|
||||
offlineDS := NewDAGService(bs).(ipld.LinkGetter)
|
||||
offlineDS := NewDAGService(bs)
|
||||
|
||||
err = EnumerateChildren(context.Background(), offlineDS.GetLinks, root.Cid(), func(_ *cid.Cid) bool { return true })
|
||||
if err != nil {
|
||||
@ -262,9 +261,8 @@ func TestEnumerateChildren(t *testing.T) {
|
||||
}
|
||||
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -495,7 +493,7 @@ func TestCidRetention(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCidRawDoesnNeedData(t *testing.T) {
|
||||
srv := NewDAGService(dstest.Bserv()).(ipld.LinkGetter)
|
||||
srv := NewDAGService(dstest.Bserv())
|
||||
nd := NewRawNode([]byte("somedata"))
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
|
Reference in New Issue
Block a user