-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: TrustlessGatewayBlockBroker prioritizes & tries all gateways #281
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds configurable block providers to allow using bitswap but also other methods such as trustless gateways and any yet-to-be-invented way of resolving a CID to a block..
SgtPooki
commented
Oct 9, 2023
Comment on lines
99
to
104
// The gateway has > 0 attempts; If we have never encountered an error, consider it 100% reliable. | ||
// Even if a gateway has no successes, it is still considered more reliable than a gateway with errors, | ||
// because it may have been used and aborted, or beaten by another BlockProvider. | ||
if (this.#errors === 0) { | ||
return 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should remove this to ensure slow gateways that never error are deprioritized properly.
Can we scope this PR to improving the |
SgtPooki
commented
Oct 10, 2023
packages/helia/src/block-providers/trustless-gateway-block-provider.ts
Outdated
Show resolved
Hide resolved
SgtPooki
commented
Oct 10, 2023
packages/helia/src/block-providers/trustless-gateway-block-provider.ts
Outdated
Show resolved
Hide resolved
SgtPooki
changed the title
feat: improve #280
feat: TrustlessGatewayBlockBroker prioritizes & tries all gateways
Oct 10, 2023
This was referenced Oct 10, 2023
achingbrain
added a commit
that referenced
this pull request
Oct 13, 2023
This approach is consistent with libp2p components, unixfs, ipns, etc. Since #281 and #284 were merged without review, this PR implements suggsestions that would have been in the review of those PRs. 1. Creation of block brokers is done by exported function. If your broker takes arguments, pass them to the factory function. The factory then returns a function that accepts helia components and returns the broker. 2. Removes BitswapBrokerFactory as it is redunant The internal API may need some more work but the external API should be relatively stable.
This was referenced Jan 8, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Slight changes on top of #280
todo