ipfs / go-bitswap

The golang implementation of the bitswap protocol
MIT License
216 stars 112 forks source link

Enable custom task prioritization logic #535

Closed synzhu closed 3 years ago

synzhu commented 3 years ago

This is the second part of https://github.com/ipfs/go-libipfs/issues/82.

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

aschmahmann commented 3 years ago

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.

synzhu commented 3 years ago

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