-
Notifications
You must be signed in to change notification settings - Fork 184
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(iroh-blobs): use oneshot channel from oneshot crate #2624
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
rklaehn
force-pushed
the
oneshot-oneshot
branch
from
August 14, 2024 07:57
abf983f
to
9a936d0
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2624/docs/iroh/ Last updated: 2024-08-15T15:07:46Z |
…ync_channel we can't use the one from tokio bc recv_blocking panics when used in the runtime.
rklaehn
force-pushed
the
oneshot-oneshot
branch
from
August 14, 2024 15:19
94511fc
to
565c1d7
Compare
rklaehn
force-pushed
the
oneshot-oneshot
branch
from
August 15, 2024 12:03
ccba6d8
to
0fc3098
Compare
rklaehn
force-pushed
the
oneshot-oneshot
branch
from
August 15, 2024 12:04
0fc3098
to
b3ce256
Compare
dignifiedquire
approved these changes
Aug 15, 2024
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.
seems fine
matheus23
pushed a commit
that referenced
this pull request
Nov 14, 2024
## Description In several places we need a oneshot channel to communicate between sync and async code. In particular, there is one place where we intentionally block inside async code to be able to implement a sync callback (in the docs code, will go away at some point hopefully). So far we have used flume and now async_channel channels with capacity 1 for this, which is quite wasteful. This replaces all oneshot use in the fs store with the oneshot channel from the oneshot crate, which is pretty minimal and does not panic when calling blocking_recv from a tokio context. ## Breaking Changes None ## Notes & open questions Note: this was part of an attempt to get rid of async_channel in iroh-blobs. We still need it for sync interactions with the blob store from inside tokio tasks, for the current docs impl. But hopefully we should be able to replace the channel for the redb actor with a mpsc channel once that is sorted out. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented.
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.
Description
In several places we need a oneshot channel to communicate between sync and async code. In particular, there is one place where we intentionally block inside async code to be able to implement a sync callback (in the docs code, will go away at some point hopefully).
So far we have used flume and now async_channel channels with capacity 1 for this, which is quite wasteful.
This replaces all oneshot use in the fs store with the oneshot channel from the oneshot crate, which is pretty minimal and does not panic when calling blocking_recv from a tokio context.
Breaking Changes
None
Notes & open questions
Note: this was part of an attempt to get rid of async_channel in iroh-blobs. We still need it for sync interactions with the blob store from inside tokio tasks, for the current docs impl. But hopefully we should be able to replace the channel for the redb actor with a mpsc channel once that is sorted out.
Change checklist