Skip to content

Commit 77a2733

Browse files
feat: add Supervisor and DynamicSupervisor
Implements Erlang/OTP-style supervision for fault-tolerant systems: Supervisor: - Manages a static set of child processes defined at start - Monitors children and restarts them according to restart strategy - Supports restart strategies: OneForOne, OneForAll, RestForOne - Child specs with: restart type, shutdown behavior, child type DynamicSupervisor: - Manages dynamically spawned children - Supports start_child/terminate_child for runtime management - Configurable max_children limit Features: - Automatic restart on child crash (permanent, temporary, transient) - Max restart intensity to prevent restart loops - Graceful shutdown with configurable timeout - Type-safe child handle abstraction - Full integration with GenServer Backend system - Comprehensive test suite (unit + integration tests)
1 parent 09d054a commit 77a2733

File tree

2 files changed

+2126
-0
lines changed

2 files changed

+2126
-0
lines changed

concurrency/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod process;
99
pub mod process_table;
1010
pub mod registry;
1111
mod stream;
12+
pub mod supervisor;
1213
mod time;
1314

1415
#[cfg(test)]
@@ -27,4 +28,10 @@ pub use process::{send, Process, ProcessInfo};
2728
pub use process_table::LinkError;
2829
pub use registry::RegistryError;
2930
pub use stream::spawn_listener;
31+
pub use supervisor::{
32+
BoxedChildHandle, ChildHandle, ChildInfo, ChildSpec, ChildType, DynamicSupervisor,
33+
DynamicSupervisorCall, DynamicSupervisorCast, DynamicSupervisorError, DynamicSupervisorResponse,
34+
DynamicSupervisorSpec, RestartStrategy, RestartType, Shutdown, Supervisor, SupervisorCall,
35+
SupervisorCast, SupervisorCounts, SupervisorError, SupervisorResponse, SupervisorSpec,
36+
};
3037
pub use time::{send_after, send_interval};

0 commit comments

Comments
 (0)