Skip to content

Commit 8d0aa1a

Browse files
committed
futures: Service abstraction
## Description An abstraction for coordinating the lifecycle of tokio tasks, looking after: - Building up services by adding tasks or through composition. - Waiting for multiple tasks to complete. - Running secondary tasks that need to be wound down when the service winds down, but otherwise don't affect the lifecycle of the service (the service doesn't wait for these tasks to complete to shutdown). - Graceful shutdown, with a grace period, because the service has wrapped up, or because of a termination request, or an error. - Panic unwinding. - Cascading termination (errors from multiple components, multiple termination requests, timeout during shutdown). - Signal handling from the operating system. ## Test plan New unit tests: ``` sui-futures$ cargo nextest run -- service ```
1 parent 62adaa2 commit 8d0aa1a

File tree

4 files changed

+738
-1
lines changed

4 files changed

+738
-1
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/sui-futures/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ publish = false
77
edition = "2024"
88

99
[dependencies]
10+
anyhow.workspace = true
1011
futures.workspace = true
12+
tap.workspace = true
13+
thiserror.workspace = true
1114
tokio = { workspace = true, features = ["rt", "time", "macros"] }
15+
tracing.workspace = true
1216

1317
[dev-dependencies]
14-
tokio = { workspace = true, features = ["full"] }
18+
tokio = { workspace = true, features = ["full", "test-util"] }

crates/sui-futures/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
pub mod future;
5+
pub mod service;
56
pub mod stream;

0 commit comments

Comments
 (0)