Skip to content

Commit b8e3af7

Browse files
committed
feat(impl): use utility selector
1 parent 952e648 commit b8e3af7

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/ipfs/go-merkledag v0.5.1
2626
github.com/ipfs/go-peertaskqueue v0.7.1
2727
github.com/ipfs/go-unixfs v0.3.1
28-
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110204839-1b00a5a75ce5
28+
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110213426-c487b3de0a4e
2929
github.com/ipld/go-codec-dagpb v1.3.0
3030
github.com/ipld/go-ipld-prime v0.14.4-0.20220110161855-fc09d6b768e9
3131
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ github.com/ipfs/go-peertaskqueue v0.7.1 h1:7PLjon3RZwRQMgOTvYccZ+mjzkmds/7YzSWKF
443443
github.com/ipfs/go-peertaskqueue v0.7.1/go.mod h1:M/akTIE/z1jGNXMU7kFB4TeSEFvj68ow0Rrb04donIU=
444444
github.com/ipfs/go-unixfs v0.3.1 h1:LrfED0OGfG98ZEegO4/xiprx2O+yS+krCMQSp7zLVv8=
445445
github.com/ipfs/go-unixfs v0.3.1/go.mod h1:h4qfQYzghiIc8ZNFKiLMFWOTzrWIAtzYQ59W/pCFf1o=
446-
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110204839-1b00a5a75ce5 h1:+rOYtgXeehixGcJjHBETodo0FnBUoUCH3wMiVjfvpGg=
447-
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110204839-1b00a5a75ce5/go.mod h1:Tuf5vaN6Tcl80PBglAYN1aR0jtDrI7EojIjXp90birA=
446+
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110213426-c487b3de0a4e h1:txVaCKylFMW+R+NJN7YQHvK/nW7KEGAxJYj4bJq/inI=
447+
github.com/ipfs/go-unixfsnode v1.1.4-0.20220110213426-c487b3de0a4e/go.mod h1:Tuf5vaN6Tcl80PBglAYN1aR0jtDrI7EojIjXp90birA=
448448
github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2E=
449449
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
450450
github.com/ipld/go-car/v2 v2.1.1 h1:saaKz4nC0AdfCGHLYKeXLGn8ivoPC54fyS55uyOLKwA=

impl/graphsync_test.go

+2-11
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
unixfile "github.com/ipfs/go-unixfs/file"
3939
"github.com/ipfs/go-unixfs/importer/balanced"
4040
ihelper "github.com/ipfs/go-unixfs/importer/helpers"
41+
"github.com/ipfs/go-unixfsnode"
4142
unixfsbuilder "github.com/ipfs/go-unixfsnode/data/builder"
4243
ipld "github.com/ipld/go-ipld-prime"
4344
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
@@ -1426,17 +1427,7 @@ func TestUnixFSADLFetch(t *testing.T) {
14261427
})
14271428

14281429
// create a selector for the whole UnixFS dag
1429-
ssb := builder.NewSelectorSpecBuilder(basicnode.Prototype.Any)
1430-
1431-
selector := ssb.ExploreInterpretAs("unixfs",
1432-
ssb.ExploreFields(func(efsb builder.ExploreFieldsSpecBuilder) {
1433-
efsb.Insert("subfolder",
1434-
ssb.ExploreInterpretAs("unixfs", ssb.ExploreFields(func(efsb builder.ExploreFieldsSpecBuilder) {
1435-
efsb.Insert("lorem.txt", ssb.ExploreInterpretAs("unixfs", ssb.Matcher()))
1436-
})),
1437-
)
1438-
}),
1439-
).Node()
1430+
selector := unixfsnode.UnixFSPathSelector("subfolder/lorem.txt")
14401431

14411432
// execute the traversal
14421433
progressChan, errChan := requestor.Request(ctx, td.host2.ID(), link, selector)

storeutil/storeutil.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
bstore "github.com/ipfs/go-ipfs-blockstore"
1010
"github.com/ipfs/go-unixfsnode"
1111
ipld "github.com/ipld/go-ipld-prime"
12-
"github.com/ipld/go-ipld-prime/linking"
1312
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
1413
)
1514

@@ -44,9 +43,7 @@ func LinkSystemForBlockstore(bs bstore.Blockstore) ipld.LinkSystem {
4443
}
4544
return &buffer, committer, nil
4645
}
47-
lsys.KnownReifiers = map[string]linking.NodeReifier{
48-
"unixfs": unixfsnode.Reify,
49-
}
46+
unixfsnode.AddUnixFSReificationToLinkSystem(&lsys)
5047
return lsys
5148
}
5249

0 commit comments

Comments
 (0)