feat(services/monoiofs): monoio wrapper #4885
Merged
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.
Part of #4552.
Since monoio runtime can't cooperate with tokio runtime on the same thread, this PR introduces a wrapper in
monoiofs
that wraps monoio runtime in a thread pool and provides a method that may be called in context of other runtimes to dispatch futures to the thread pool and execute it in context of monoio.This is similar to the implementation of
compfs
, however since monoio doesn't provide a crate likecompio-dispatcher
to do these, I've implemented a minimal usable dispatcher here. This dispatcher implementation sends futures to threads at random (same ascompio-dispatcher
) without scheduling or load balancing, but it should serve for implementing rest of the service on top of it and we can improve its performance later if necessary.