coreapi: dht: remove option prefix
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Aug 28, 2018 at 02:22 UTC
86f9eb73c34aeabc2e3e5ad7eb88f8e441624033
3 files changed
+8
-9
core/coreapi/dht.go
+1
-2
@@ -103,9 +103,8 @@ func provideKeysRec(ctx context.Context, r routing.IpfsRouting, bs blockstore.Bl
103
104
errCh := make(chan error)
105
go func() {
106
+ dserv := dag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
107
for _, c := range cids {
107
- dserv := dag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
108
-
108
err := dag.EnumerateChildrenAsync(ctx, dag.GetLinksDirect(dserv), c, provided.Visitor(ctx))
109
if err != nil {
110
errCh <- err
core/coreapi/dht_test.go
+3
-3
@@ -51,7 +51,7 @@ func TestDhtFindProviders(t *testing.T) {
51
t.Fatal(err)
52
}
53
54
- out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.WithNumProviders(1))
54
+ out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1))
55
if err != nil {
56
t.Fatal(err)
57
}
@@ -80,7 +80,7 @@ func TestDhtProvide(t *testing.T) {
80
nds[0].Blockstore.Put(b)
81
p := iface.IpfsPath(b.Cid())
82
83
- out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.WithNumProviders(1))
83
+ out, err := apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1))
84
if err != nil {
85
t.Fatal(err)
86
}
@@ -96,7 +96,7 @@ func TestDhtProvide(t *testing.T) {
96
t.Fatal(err)
97
}
98
99
- out, err = apis[2].Dht().FindProviders(ctx, p, options.Dht.WithNumProviders(1))
99
+ out, err = apis[2].Dht().FindProviders(ctx, p, options.Dht.NumProviders(1))
100
if err != nil {
101
t.Fatal(err)
102
}
core/coreapi/interface/options/dht.go
+4
-4
@@ -43,18 +43,18 @@ type dhtOpts struct{}
43
44
var Dht dhtOpts
45
46
-// WithRecursive is an option for Dht.Provide which specifies whether to provide
46
+// Recursive is an option for Dht.Provide which specifies whether to provide
47
// the given path recursively
48
-func (dhtOpts) WithRecursive(recursive bool) DhtProvideOption {
48
+func (dhtOpts) Recursive(recursive bool) DhtProvideOption {
49
return func(settings *DhtProvideSettings) error {
50
settings.Recursive = recursive
51
return nil
52
}
53
}
54
55
-// WithNumProviders is an option for Dht.FindProviders which specifies the
55
+// NumProviders is an option for Dht.FindProviders which specifies the
56
// number of peers to look for. Default is 20
57
-func (dhtOpts) WithNumProviders(numProviders int) DhtFindProvidersOption {
57
+func (dhtOpts) NumProviders(numProviders int) DhtFindProvidersOption {
58
return func(settings *DhtFindProvidersSettings) error {
59
settings.NumProviders = numProviders
60
return nil