Skip to content

Commit

Permalink
provider: revert throughput callback and related refactor
Browse files Browse the repository at this point in the history
This reverts commits:
- 0ff6929: provider: add breaking changes to the changelog (#330)
- 0962ed6: relocated magic numbers, updated Reprovide Interval from 24h to 22h
- ac047a5: provider: refactor to only maintain one batched implementation and add throughput callback

This seems to have an unknown deadlock that is blocking Kubo's sharness tests,
the code coverage is also pretty bad I forgot to migrate the pinning reproviding tests because they weren't ran directly over batched.
https://app.codecov.io/gh/ipfs/boxo/commit/20e2aae45ec6ecd21c905993c394e9cc767c9038/tree/provider
  • Loading branch information
Jorropo committed Jun 2, 2023
1 parent 20e2aae commit 4c5c98b
Show file tree
Hide file tree
Showing 17 changed files with 1,198 additions and 580 deletions.
9 changes: 0 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ The following emojis are used to highlight certain changes:
- Updated, higher-definition icons in directory listings.
- Customizable menu items next to "About IPFS" and "Install IPFS".
- Valid DAG-CBOR and DAG-JSON blocks now provide a preview, where links can be followed.
- 🛠 Provider API refactor
- `provider/queue` has been moved to `provider/internal/queue`.
- `provider/batched.New` has been moved to `provider.New` and arguments has been changed:
- a routing system is now passed with the `provider.Online` option, by default the system run in offline mode (push stuff onto the queue); and
- you do not have to pass a queue anymore, you pass a `datastore.Datastore` exclusively.
- `provider/simple` has been removed, now instead `provider.New` will accept non batched routing systems and use type assertion for the `ProvideMany` call, giving a single implementation.
- `provider.NewOfflineProvider` has been renamed to `provider.NewNoopProvider` to show more clearly that is does nothing.
- `provider.NewSystem` has been removed, `provider.New` now returns a `provider.System` directly.
- `provider.Provider` and `provider.Reprovider` has been merged under one `provider.System`

## [0.8.0] - 2023-04-05
### Added
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.19
require (
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a
github.com/benbjohnson/clock v1.3.0
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cespare/xxhash/v2 v2.2.0
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3
github.com/cskr/pubsub v1.0.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4=
github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
30 changes: 30 additions & 0 deletions provider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Usage

Here's how you create, start, interact with, and stop the provider system:

```golang
import (
"context"
"time"

"github.com/ipfs/boxo/provider"
"github.com/ipfs/boxo/provider/queue"
"github.com/ipfs/boxo/provider/simple"
)

rsys := (your routing system here)
dstore := (your datastore here)
cid := (your cid to provide here)

q := queue.NewQueue(context.Background(), "example", dstore)

reprov := simple.NewReprovider(context.Background(), time.Hour * 12, rsys, simple.NewBlockstoreProvider(dstore))
prov := simple.NewProvider(context.Background(), q, rsys)
sys := provider.NewSystem(prov, reprov)

sys.Run()

sys.Provide(cid)

sys.Close()
```
Loading

0 comments on commit 4c5c98b

Please sign in to comment.