Closed aschmahmann closed 1 year ago
This repository has been moved to https://github.com/ipfs/go-libipfs. There is not an easy way to transfer PRs, so if you would like to continue with this PR then please re-open it in the new repository and link to this PR.
Related to one of the suggestions in https://github.com/ipfs/go-libipfs/issues/90, this provides an option to request blocks from a session using a channel instead of requesting blocks as groups of CIDs.
This means that users of a session can dynamically discover and request as many blocks as it wants without needing to spin up many goroutines to wait on the blocks or artificially group the block requests together.
This was useful to me as part of implementing https://github.com/aschmahmann/mdinc/pull/1.
Note: This initial approach is definitely not as polished as it could be and we can clean up the names and the plumbing here a bunch. However, it worked for the Docker demo and gave a starting point for a conversation on if this is a good idea and collecting feedback on the feature.
Some areas for feedback:
Add(cid)
andRemove(cid)
called on it? Passing channels is more natural to Go and makes sense for performance, but I've noticed can sometimes confuse people. Went with channels since it seemed like less code and also happened to match the issue linked above.