Closed wolneykien closed 4 years ago
Thank you for submitting this PR! A maintainer will be here shortly to review it. We are super grateful, but we are also overloaded! Help us by making sure that:
The context for this PR is clear, with relevant discussion, decisions and stakeholders linked/mentioned.
Your contribution itself is clear (code comments, self-review for the rest) and in its best form. Follow the code contribution guidelines if they apply.
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. Next steps:
A maintainer will triage and assign priority to this PR, commenting on any missing things and potentially assigning a reviewer for high priority items.
The PR gets reviews, discussed and approvals as needed.
The PR is merged by maintainers when it has been approved and comments addressed.
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. We are very grateful for your contribution!
The related discussion is here: https://discuss.ipfs.io/t/how-to-extend-a-bitswap-strategy/7960/3 .
And a plugin type that injects ScoreLedgers
s is here https://github.com/ipfs/go-ipfs/pull/7617 .
Ping?
Thanks! What about the related https://github.com/ipfs/go-ipfs/pull/7617 ?
I'll ping the go-ipfs folks
First, I've separated the decision engine ledger on two parts: score and the wantlist. The wantlist still resides in the original
ledger
struct while sent/received byte accounting and scores are extracted to the newscoreledger
struct managed by the originalscoreWorker()
logic. The accounting is integrated into theEngine
viaScoreLedger
interface making it possible to replace the originalscoreWorker()
with some other logic. The interface, however, doesn't allow a score logic to directly touch peer tags: the logic may decide about score values while tagging itself is still under control of Engine.Then I've added new
WithScoreLedger(decision.ScoreLedger)
option in thebitswap
package is the way to connect a customScoreLedger
implementation to the decision engine. TheEngine
now has the correspondingUseScoreLedger(ScoreLedger)
method.The
ScoreLedger
andScorePeerFunc
types are exposed from the internaldecision
package to the public one.New
TestWithScoreLedger
test is added. The test checks for start and stop of the testing score ledger implementation that is specified viaWithScoreLedger
option.