diff --git a/CHANGELOG.md b/CHANGELOG.md index 213dacd30..84e8558b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,18 +15,18 @@ The following emojis are used to highlight certain changes: ## [Unreleased] - `bitswap`, `routing`, `exchange` ([#641](https://github.com/ipfs/boxo/pull/641)): - * ✨ Bitswap is no longer in charge of providing blocks to the newtork: providing functionality is now handled by a `exchange/providing.Exchange`, meant to be used with `provider.System` so that all provides follow the same rules (multiple parts of the code where handling provides) before. - * 🛠 `bitswap/client/internal/providerquerymanager` has been moved to `routing/providerquerymanager` where it belongs. In order to keep compatibility, Bitswap now receives a `routing.ContentDiscovery` parameter which implements `FindProvidersAsync(...)` and uses it to create a `providerquerymanager` with the default settings as before. Custom settings can be used by using a custom `providerquerymanager` to manually wrap a `ContentDiscovery` object and pass that in as `ContentDiscovery` on initialization while setting `bitswap.WithDefaultProviderQueryManager(false)` (to avoid re-wrapping it again). - * The renovated `providedQueryManager` will trigger lookups until it manages to connect to `MaxProviders`. Before it would lookup at most `MaxInProcessRequests*MaxProviders` and connection failures may have limited the actual number of providers found. - * 🛠 We have aligned our routing-related interfaces with the libp2p [`routing`](https://pkg.go.dev/github.com/libp2p/go-libp2p/core/routing#ContentRouting) ones, including in the `reprovider.System`. - * In order to obtain exactly the same behaviour as before (i.e. particularly ensuring that new blocks are still provided), what was done like: + - ✨ Bitswap is no longer in charge of providing blocks to the newtork: providing functionality is now handled by a `exchange/providing.Exchange`, meant to be used with `provider.System` so that all provides follow the same rules (multiple parts of the code where handling provides) before. + - 🛠 `bitswap/client/internal/providerquerymanager` has been moved to `routing/providerquerymanager` where it belongs. In order to keep compatibility, Bitswap now receives a `routing.ContentDiscovery` parameter which implements `FindProvidersAsync(...)` and uses it to create a `providerquerymanager` with the default settings as before. Custom settings can be used by using a custom `providerquerymanager` to manually wrap a `ContentDiscovery` object and pass that in as `ContentDiscovery` on initialization while setting `bitswap.WithDefaultProviderQueryManager(false)` (to avoid re-wrapping it again). + - The renovated `providedQueryManager` will trigger lookups until it manages to connect to `MaxProviders`. Before it would lookup at most `MaxInProcessRequests*MaxProviders` and connection failures may have limited the actual number of providers found. + - 🛠 We have aligned our routing-related interfaces with the libp2p [`routing`](https://pkg.go.dev/github.com/libp2p/go-libp2p/core/routing#ContentRouting) ones, including in the `reprovider.System`. + - In order to obtain exactly the same behaviour as before (i.e. particularly ensuring that new blocks are still provided), what was done like: ```go bswapnet := network.NewFromIpfsHost(host, contentRouter) bswap := bitswap.New(p.ctx, bswapnet, blockstore) bserv = blockservice.New(blockstore, bswap) ``` - needs to be done like: + - becomes: ```go // Create network: no contentRouter anymore @@ -42,10 +42,23 @@ The following emojis are used to highlight certain changes: // A wrapped providing exchange using the previous exchange and the provider. exch := providing.New(bswap, provider) - // Use exch instead from now on. + // Finally the blockservice + bserv := blockservice.New(blockstore, exch) ... ``` + - The above is only necessary if content routing is needed. Otherwise: + +``` + // Create network: no contentRouter anymore + bswapnet := network.NewFromIpfsHost(host) + // Create Bitswap: a new "discovery" parameter set to nil (disable content discovery) + bswap := bitswap.New(p.ctx, bswapnet, nil, blockstore) + // Finally the blockservice + bserv := blockservice.New(blockstore, exch) +``` + + ### Added