Skip to content

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

@gjcolombo

Description

@gjcolombo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions