Skip to content
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

refactor: use functions for block broker creation #286

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented Oct 13, 2023

This approach is consistent with libp2p components, unixfs, ipns, etc.

Since #281 and #284 were merged without review, this PR implements suggestions 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 BitswapBlockBrokerFactory variable in favour of bitswap function
  3. Removes BlockBrokerFactoryComponents interface in favour of brokers declaring their own component requirements
  4. Define DEFAULT_TRUSTLESS_GATEWAYS in trustless gateway code
  5. Use await expect(promise).to.eventually.be.rejected in tests instead of try/catch blocks
  6. Remove use of console

The internal API may need some more work but the external API should be relatively stable.

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.
@achingbrain achingbrain requested a review from a team as a code owner October 13, 2023 13:58
@SgtPooki SgtPooki merged commit 43932a5 into main Oct 13, 2023
15 checks passed
@SgtPooki SgtPooki deleted the refactor/update-block-broker-creation branch October 13, 2023 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants