-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added new plugin type: PluginScoreLedger #7617
Conversation
Thank you for submitting this PR!
Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution. |
I've also issued ipfs/go-bitswap#430 — the corresponding modification to BitSwap and ipfs/go-ipfs-config#109 — the corresponding modification to the |
I see that 2 sharness tests have failed due to some expectations in |
If you run the individual sharness tests manually on your machine (e.g. run Take a look at https://github.com/ipfs/go-ipfs/tree/master/test/sharness for more info |
Thanks, @aschmahmann . The |
With a PluginScoreLedger plugin it is now possible to replace the default BitSwap decision logic with a different one. The plugin support depends on the experimental BitSwap option `WithScoreLedger` --- see 80c1a81b63e5 and related commits in the `go-bitswap` project and also ebf11a6556cc commit in the `go-ipfs-config` project. A map of score ledgers and new `RegisterScoreLedger` function were added to `core/node/core.go` in order to support score ledger injection. The selection of the particular ledger is now possible with enchanced `OnlineExchange()` function accepting the name of the ledger (`""` is used for the default behavior). It is configured with `Experimental.WithScoreLedger` configuration option. In order to check this modifications and plugin loading two new tests were added to `test/integration` package: `TestScoreLedgerNotLoaded` and `TestScoreLedgerLoadStartStop`. To minimize code duplication I've decided to slightly modify the `core/mock/mock.go` adding new `NewMockNodeWithConfig()` function there. The code that loads and injects plugin objects is placed in the `plugins_common_test.go` to help implementing other plugin tests.
5378171
to
eb762df
Compare
Just have synced this branch with |
@wolneykien the currently supported plugins are:
Adding a specific plugin for one option type in Bitswap seems like overkill to me, and would open the door to adding new plugins for many many more features. The ones we have so far have been useful for many community projects. You could accomplish what you're looking for by just building go-ipfs as a library and passing in a custom Bitswap constructor now that your Bitswap PR has landed. You may also be able to get away with a DaemonInternal plugin. If neither of the above options are suitable for your use case, then we can investigate what makes the most sense. |
May be you're right. Now, I'm not sure about a specific plugin type. However, I think it would be nice to have a way to pass that (and any other!) option to
Thanks, that seems to be a good idea!
Yes. Anyway, for my current experiments I need to access the P2P |
@wolneykien the I've also filed #7653 and #7652 which I think are relevant to the types of plugins you're asking for. If you got the go-ipfs as a library route you might benefit from looking at #7602 which is probably the easiest way to get at Bitswap options until something like #7652 lands. |
With a PluginScoreLedger plugin it is now possible to replace the
default BitSwap decision logic with a different one. The plugin
support depends on the experimental BitSwap option
WithScoreLedger
— see
80c1a81b63e5
and related commits in thego-bitswap
projectand also
ebf11a6556cc
commit in thego-ipfs-config
project.A map of score ledgers and new
RegisterScoreLedger
function wereadded to
core/node/core.go
in order to support score ledgerinjection. The selection of the particular ledger is now possible with
enchanced
OnlineExchange()
function accepting the name of theledger (
""
is used for the default behavior). It is configured withExperimental.WithScoreLedger
configuration option.In order to check this modifications and plugin loading two new tests
were added to
test/integration
package:TestScoreLedgerNotLoaded
and
TestScoreLedgerLoadStartStop
. To minimize code duplication I'vedecided to slightly modify the
core/mock/mock.go
adding newNewMockNodeWithConfig()
function there. The code that loads andinjects plugin objects is placed in the
plugins_common_test.go
tohelp implementing other plugin tests.