1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! Fault-tolerant supervision trees for Rust with distributed capabilities.
//!
//! Build resilient systems that automatically recover from failures using supervisor trees,
//! restart strategies, and distributed supervision inspired by Erlang/OTP.
//!
//! # Features
//!
//! - **Supervision Trees**: Hierarchical supervision with nested supervisors and workers
//! - **Restart Strategies**: `OneForOne`, `OneForAll`, and `RestForOne` strategies
//! - **Restart Policies**: `Permanent`, `Temporary`, and `Transient` restart behaviors
//! - **Restart Intensity**: Configurable restart limits with sliding time windows
//! - **Distributed**: Run supervisors across processes or machines via TCP/Unix sockets
//! - **Generic Workers**: Trait-based worker system for any async workload
//! - **Dynamic Management**: Add/remove children at runtime
//! - **Structured Logging**: Built-in support for `tracing` structured logging
//! - **Mailbox System**: Optional message-passing for workers with string-based messages
//!
//! # Quick Start
//!
//! ```rust
//! use ash_flare::{SupervisorSpec, SupervisorHandle, RestartPolicy, Worker};
//! use async_trait::async_trait;
//!
//! struct Counter {
//! id: u32,
//! max: u32,
//! }
//!
//! #[async_trait]
//! impl Worker for Counter {
//! type Error = std::io::Error;
//!
//! async fn run(&mut self) -> Result<(), Self::Error> {
//! for i in 0..self.max {
//! tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
//! }
//! Ok(())
//! }
//! }
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Build supervisor tree
//! let spec = SupervisorSpec::new("root")
//! .with_worker("counter-1", || Counter { id: 1, max: 5 }, RestartPolicy::Permanent)
//! .with_worker("counter-2", || Counter { id: 2, max: 5 }, RestartPolicy::Permanent);
//!
//! // Start supervision tree
//! let handle = SupervisorHandle::start(spec);
//!
//! // Query children
//! let children = handle.which_children().await?;
//!
//! // Graceful shutdown
//! handle.shutdown().await?;
//! # Ok(())
//! # }
//! ```
//!
//! # Restart Strategies
//!
//! - **`OneForOne`**: Restarts only the failed child (default)
//! - **`OneForAll`**: Restarts all children if any child fails
//! - **`RestForOne`**: Restarts the failed child and all children started after it
//!
//! # Examples
//!
//! See the [examples directory](https://github.com/gntem/ash-flare/tree/master/examples) for more:
//!
//! - `counter.rs` - Basic supervisor with multiple workers
//! - `distributed.rs` - Network-distributed supervisors
//! - `super_tree.rs` - Complex nested supervision trees
// Python bindings module
// Re-export public API
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Re-export mailbox types
pub use ;