namespace Mbproxy.Proxy.Supervision;
///
/// State machine states for .
///
public enum SupervisorState
{
///
/// The listener is bound and its accept loop is running.
/// Entry conditions: succeeded (on first attempt or
/// after a recovery attempt).
///
Bound,
///
/// The listener is not bound; the supervisor is waiting for the next Polly retry delay
/// before reattempting. Entered after any failed bind (at startup or at runtime).
///
Recovering,
///
/// Terminal state. was called; the supervisor
/// task has been cancelled and will not retry.
///
Stopped,
}
///
/// Immutable point-in-time snapshot of a supervisor's state. Consumed by the status
/// page via .
///
/// RecoveryAttempts semantics: this counter accumulates over the lifetime
/// of the supervisor and is never reset. Operators reading the status page should
/// interpret it as "how many times has this listener faulted or failed to bind since
/// the service started" — useful for detecting port-flapping or repeated OS network
/// resets.
///
/// Current state of the supervisor.
///
/// Most recent bind failure message (up to 256 chars). null if the listener
/// has never failed to bind.
///
///
/// Total number of failed bind attempts over the lifetime of this supervisor.
/// Accumulates; never resets to 0.
///
public sealed record SupervisorSnapshot(
SupervisorState State,
string? LastBindError,
int RecoveryAttempts);