oxidecomputer/propolis

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

Opened this issue · 0 comments

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.