mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
feat(config): expose ProviderSearchMaxResults (#10773)
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Build / docker-build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Build / docker-build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
Replacing hardcoded integer with named default and expose config option for adjusting it, like we do in Rainbow https://github.com/ipfs/kubo/pull/10765/files#r2025455848
This commit is contained in:
parent
ee7fef251c
commit
fe3106f9a6
@ -14,5 +14,6 @@ type InternalBitswap struct {
|
||||
EngineTaskWorkerCount OptionalInteger
|
||||
MaxOutstandingBytesPerPeer OptionalInteger
|
||||
ProviderSearchDelay OptionalDuration
|
||||
ProviderSearchMaxResults OptionalInteger
|
||||
WantHaveReplaceSize OptionalInteger
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ const (
|
||||
DefaultEngineTaskWorkerCount = 8
|
||||
DefaultMaxOutstandingBytesPerPeer = 1 << 20
|
||||
DefaultProviderSearchDelay = 1000 * time.Millisecond
|
||||
DefaultMaxProviders = 10 // matching BitswapClientDefaultMaxProviders from https://github.com/ipfs/boxo/blob/v0.29.1/bitswap/internal/defaults/defaults.go#L15
|
||||
DefaultWantHaveReplaceSize = 1024
|
||||
)
|
||||
|
||||
@ -79,11 +80,13 @@ func Bitswap(provide bool) interface{} {
|
||||
|
||||
var provider routing.ContentDiscovery
|
||||
if provide {
|
||||
// We need to hardcode the default because it is an
|
||||
// internal setting in boxo.
|
||||
var maxProviders int = DefaultMaxProviders
|
||||
if in.Cfg.Internal.Bitswap != nil {
|
||||
maxProviders = int(in.Cfg.Internal.Bitswap.ProviderSearchMaxResults.WithDefault(DefaultMaxProviders))
|
||||
}
|
||||
pqm, err := rpqm.New(bitswapNetwork,
|
||||
in.Rt,
|
||||
rpqm.WithMaxProviders(10),
|
||||
rpqm.WithMaxProviders(maxProviders),
|
||||
rpqm.WithIgnoreProviders(in.Cfg.Routing.IgnoreProviders...),
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@ -11,7 +11,7 @@ This release was brought to you by the [Shipyard](http://ipshipyard.com/) team.
|
||||
- [Overview](#overview)
|
||||
- [🔦 Highlights](#-highlights)
|
||||
- [Dedicated `Reprovider.Strategy` for MFS](#dedicated-reproviderstrategy-for-mfs)
|
||||
- [`Routing.IgnoreProviders`](#routingignoreproviders)
|
||||
- [Additional new configuration options](#additional-new-configuration-options)
|
||||
- [Grid view in WebUI](#grid-view-in-webui)
|
||||
- [📦️ Important dependency updates](#-important-dependency-updates)
|
||||
- [📝 Changelog](#-changelog)
|
||||
@ -31,12 +31,10 @@ Users relying on the `pinned` strategy can switch to `pinned+mfs` and use MFS al
|
||||
|
||||
See [`Reprovider.Strategy`](https://github.com/ipfs/kubo/blob/master/docs/config.md#reproviderstrategy) for more details.
|
||||
|
||||
#### `Routing.IgnoreProviders`
|
||||
#### Additional new configuration options
|
||||
|
||||
This new option allows ignoring specific peer IDs when returned by the content
|
||||
routing system as providers of content. See the
|
||||
[documentation](https://github.com/ipfs/kubo/blob/master/docs/config.md#routingignoreproviders)
|
||||
for for information.
|
||||
- [`Internal.Bitswap.ProviderSearchMaxResults`](https://github.com/ipfs/kubo/blob/master/docs/config.md##internalbitswapprovidersearchmaxresults) for adjusting the maximum number of providers bitswap client should aim at before it stops searching for new ones.
|
||||
- [`Routing.IgnoreProviders`](https://github.com/ipfs/kubo/blob/master/docs/config.md#routingignoreproviders) allows ignoring specific peer IDs when returned by the content routing system as providers of content.
|
||||
|
||||
#### Grid view in WebUI
|
||||
|
||||
|
||||
@ -79,7 +79,8 @@ config file at runtime.
|
||||
- [`Internal.Bitswap.EngineBlockstoreWorkerCount`](#internalbitswapengineblockstoreworkercount)
|
||||
- [`Internal.Bitswap.EngineTaskWorkerCount`](#internalbitswapenginetaskworkercount)
|
||||
- [`Internal.Bitswap.MaxOutstandingBytesPerPeer`](#internalbitswapmaxoutstandingbytesperpeer)
|
||||
- [`Internal.Bitswap.ProviderSearchDelay`](#internalbitswapprovidersearchdelay)
|
||||
- [`Internal.Bitswap.ProviderSearchDelay`](#internalbitswapprovidersearchdelay)
|
||||
- [`Internal.Bitswap.ProviderSearchMaxResults`](#internalbitswapprovidersearchmaxresults)
|
||||
- [`Internal.UnixFSShardingSizeThreshold`](#internalunixfsshardingsizethreshold)
|
||||
- [`Ipns`](#ipns)
|
||||
- [`Ipns.RepublishPeriod`](#ipnsrepublishperiod)
|
||||
@ -119,7 +120,7 @@ config file at runtime.
|
||||
- [`Routing.Type`](#routingtype)
|
||||
- [`Routing.AcceleratedDHTClient`](#routingaccelerateddhtclient)
|
||||
- [`Routing.LoopbackAddressesOnLanDHT`](#routingloopbackaddressesonlandht)
|
||||
- [`Routing.IgnoreProviders`](#routingignoreproviders)
|
||||
- [`Routing.IgnoreProviders`](#routingignoreproviders)
|
||||
- [`Routing.Routers`](#routingrouters)
|
||||
- [`Routing.Routers: Type`](#routingrouters-type)
|
||||
- [`Routing.Routers: Parameters`](#routingrouters-parameters)
|
||||
@ -1181,7 +1182,7 @@ deteriorate the quality provided to less aggressively-wanting peers.
|
||||
|
||||
Type: `optionalInteger` (byte count, `null` means default which is 1MB)
|
||||
|
||||
### `Internal.Bitswap.ProviderSearchDelay`
|
||||
#### `Internal.Bitswap.ProviderSearchDelay`
|
||||
|
||||
This parameter determines how long to wait before looking for providers outside of bitswap.
|
||||
Other routing systems like the Amino DHT are able to provide results in less than a second, so lowering
|
||||
@ -1189,6 +1190,13 @@ this number will allow faster peers lookups in some cases.
|
||||
|
||||
Type: `optionalDuration` (`null` means default which is 1s)
|
||||
|
||||
#### `Internal.Bitswap.ProviderSearchMaxResults`
|
||||
|
||||
Maximum number of providers bitswap client should aim at before it stops searching for new ones.
|
||||
Setting to 0 means unlimited.
|
||||
|
||||
Type: `optionalInteger` (`null` means default which is 10)
|
||||
|
||||
### `Internal.UnixFSShardingSizeThreshold`
|
||||
|
||||
The sharding threshold used internally to decide whether a UnixFS directory should be sharded or not.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user