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

Device and block backend lifecycle ops could return immediately if no async work is required #716

Open
gjcolombo opened this issue Jul 2, 2024 · 0 comments

Comments

@gjcolombo
Copy link
Contributor

trait Lifecycle's paused function requires all its implementations to return a BoxFuture even if pausing requires no async work (e.g. because there's nothing to pause!). This function could instead return an enum with "Done" and "Pending" variants where only the latter contains a BoxFuture, allowing trivial impls to return immediately without a heap allocation.

#715 proposes to introduce a similar issue in the block::Backend trait (though masks it a bit with the use of async_trait). Several storage backends don't have any async callees in their start and stop methods and would benefit from a similar enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant