Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Enable custom task prioritization logic #535

Merged
merged 8 commits into from
Oct 28, 2021
Merged

Conversation

synzhu
Copy link
Contributor

@synzhu synzhu commented Oct 12, 2021

This is the second part of ipfs/boxo#82.

It introduces a TaskComparator which can be configured to implement custom task prioritization logic.

@synzhu synzhu marked this pull request as ready for review October 12, 2021 23:41
@aschmahmann
Copy link
Contributor

Thanks :). Can you add a test showing that this works? It can also serve as a useful example for people who want to leverage this option.

@aschmahmann aschmahmann added the need/author-input Needs input from the original author label Oct 15, 2021
@synzhu
Copy link
Contributor Author

synzhu commented Oct 15, 2021

Thanks :). Can you add a test showing that this works? It can also serve as a useful example for people who want to leverage this option.

@aschmahmann Sure, I can try, I thought about it but originally I didn't see any way to do black box testing of this functionality since it would have to somehow rely on timing. But I can probably do some sort of whitebox test that asserts on the order of PeerTasks popped from the PeerTaskQueue

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nits about type accessibility, but othewise LGTM. In the future, we'll probably want to expose a peer comparator directly, but that shouldn't be a breakign change.

bitswap.go Outdated Show resolved Hide resolved
internal/decision/engine.go Show resolved Hide resolved
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Stebalien Stebalien merged commit b35a29b into ipfs:master Oct 28, 2021
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
Jorropo pushed a commit to Jorropo/go-libipfs that referenced this pull request Jan 26, 2023
Enable custom task prioritization logic

This commit was moved from ipfs/go-bitswap@b35a29b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants