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

[ipfs/go-bitswap] Bitswap client usage unintuitive #68

Open
aschmahmann opened this issue Oct 23, 2022 · 2 comments
Open

[ipfs/go-bitswap] Bitswap client usage unintuitive #68

aschmahmann opened this issue Oct 23, 2022 · 2 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@aschmahmann
Copy link
Contributor

Since ipfs/go-bitswap#570 has made it possible to use the client and server pieces of go-bitswap independently it would seem reasonable that someone could replace:

bsnet := bsnet.NewFromIpfsHost(h, &rhelp.Null{})
bswap := bitswap.New(ctx, bsnet, bstore)
block, err := bswap.GetBlock(ctx, someCID)

with

bsnet := bsnet.NewFromIpfsHost(h, &rhelp.Null{})
bswap := bsclient.New(ctx, bsnet, bstore)
block, err := bswap.GetBlock(ctx, someCID)

especially since there are no compile-time errors or comments on the client that would indicate otherwise. However, unless bsnet.Start(bswap) is called on the client (not required when using bitswap.New) the code will silently hang as the response messages are not being processed.

IMO this footgun should be removed so that bsclient.New can drop-in for bitswap.New when no server functionality is required. An easy, if inelegant, option might be to call bsnet.Start(bswap) unless an option is passed in telling it not to and then passing that option internally in the bitswap.New constructor that creates the client. If not resolved at least there should be some comments on the client (and I suspect server) constructor letting people know they need to register their client/server with the BitswapNetwork in order to function.

wdyt @Jorropo @guseggert ?

@aschmahmann aschmahmann added the need/triage Needs initial labeling and prioritization label Oct 23, 2022
@Jorropo
Copy link
Contributor

Jorropo commented Oct 31, 2022

Yeah should be fixed.

@Jorropo Jorropo changed the title Bitswap client usage unintuitive [ipfs/go-bitswap] Bitswap client usage unintuitive Jan 27, 2023
@welcome
Copy link

welcome bot commented Jan 27, 2023

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@Jorropo Jorropo transferred this issue from ipfs/go-bitswap Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants