Skip to content

Commit 5cec615

Browse files
committed
refactor: bump boxo and pass limit
1 parent 0198d4c commit 5cec615

File tree

6 files changed

+9
-18
lines changed

6 files changed

+9
-18
lines changed

core/corehttp/routing.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ import (
1616
"github.com/multiformats/go-multiaddr"
1717
)
1818

19-
const (
20-
streamingProvidersCount = 0
21-
nonStreamingProvidersCount = 20
22-
)
23-
2419
func RoutingOption() ServeOption {
2520
return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
2621
handler := server.Handler(&contentRouter{n})
@@ -33,13 +28,9 @@ type contentRouter struct {
3328
n *core.IpfsNode
3429
}
3530

36-
func (r *contentRouter) FindProviders(ctx context.Context, key cid.Cid, streaming bool) (iter.ResultIter[types.ProviderResponse], error) {
31+
func (r *contentRouter) FindProviders(ctx context.Context, key cid.Cid, limit int) (iter.ResultIter[types.ProviderResponse], error) {
3732
ctx, cancel := context.WithCancel(ctx)
38-
count := nonStreamingProvidersCount
39-
if streaming {
40-
count = streamingProvidersCount
41-
}
42-
ch := r.n.Routing.FindProvidersAsync(ctx, key, count)
33+
ch := r.n.Routing.FindProvidersAsync(ctx, key, limit)
4334
return iter.ToResultIter[types.ProviderResponse](&peerChanIter{
4435
ch: ch,
4536
cancel: cancel,

docs/examples/kubo-as-a-library/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ go 1.18
77
replace github.com/ipfs/kubo => ./../../..
88

99
require (
10-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44
10+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8
1111
github.com/ipfs/kubo v0.0.0-00010101000000-000000000000
1212
github.com/libp2p/go-libp2p v0.27.3
1313
github.com/multiformats/go-multiaddr v0.9.0

docs/examples/kubo-as-a-library/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
321321
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
322322
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
323323
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
324-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44 h1:C5U/SZW51/AiY3t4dgC0BWvP/4U5v5zgrHIWS7N5OeM=
325-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
324+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8 h1:aJGuLI/MDQh5Ziw70wfFPGZB5yN0Y+NEfb3pUwEV2oY=
325+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
326326
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
327327
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
328328
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/gogo/protobuf v1.3.2
1717
github.com/google/uuid v1.3.0
1818
github.com/hashicorp/go-multierror v1.1.1
19-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44
19+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8
2020
github.com/ipfs/go-block-format v0.1.2
2121
github.com/ipfs/go-cid v0.4.1
2222
github.com/ipfs/go-cidutil v0.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
356356
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
357357
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
358358
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
359-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44 h1:C5U/SZW51/AiY3t4dgC0BWvP/4U5v5zgrHIWS7N5OeM=
360-
github.com/ipfs/boxo v0.8.2-0.20230515105410-d96e912ecb44/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
359+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8 h1:aJGuLI/MDQh5Ziw70wfFPGZB5yN0Y+NEfb3pUwEV2oY=
360+
github.com/ipfs/boxo v0.8.2-0.20230524101241-06f2d96c75c8/go.mod h1:Ej2r08Z4VIaFKqY08UXMNhwcLf6VekHhK8c+KqA1B9Y=
361361
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
362362
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
363363
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=

test/cli/content_routing_http_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type fakeHTTPContentRouter struct {
2424
provideCalls int
2525
}
2626

27-
func (r *fakeHTTPContentRouter) FindProviders(ctx context.Context, key cid.Cid, stream bool) (iter.ResultIter[types.ProviderResponse], error) {
27+
func (r *fakeHTTPContentRouter) FindProviders(ctx context.Context, key cid.Cid, limit int) (iter.ResultIter[types.ProviderResponse], error) {
2828
r.m.Lock()
2929
defer r.m.Unlock()
3030
r.findProvidersCalls++

0 commit comments

Comments
 (0)