Module Observe_lwt_unix.Lifecycle

Expert registration for independently installed Lwt-Unix outputs. Reports distinguish rejected, lost, failed, timed-out, and cancelled delivery; problem output labels are bounded runtime identities. Duration bounds are finite caller waits only; shared work continues after timeout.

type error =
  1. | Closed
module Duration : sig ... end
type problem =
  1. | Rejected of {
    1. output : string;
    }
  2. | Delivery_lost of {
    1. output : string;
    }
  3. | Destination_failed of {
    1. output : string;
    }
  4. | Timed_out of {
    1. output : string;
    }
  5. | Cancelled of {
    1. output : string;
    }
type report

An aggregate of hook settlement and bounded runtime-identity problems. complete report means every participant settled without a reported problem at its owned effect boundary; it does not assert durability. Runtime control exceptions remain native rather than becoming reports.

val complete : report -> bool
val problems : report -> problem list

Participant problems, identified by bounded runtime output labels.

exception Incomplete of report

Raised by ordinary flush and shutdown when finite waiting or a participant outcome is incomplete.

module Integration : sig ... end
val flush : ?within:Duration.t -> unit -> report Lwt.t

Run an independent flush boundary and leave the lifecycle open. The finite within bounds this caller's waiter only; cancellation preserves Lwt.Canceled, while shared work continues.

val shutdown : ?within:Duration.t -> unit -> report Lwt.t

Start or join the one shared idempotent shutdown; within bounds this caller's waiter only, shared work continues, and shutdown closes admission permanently.

val register : flush:(unit -> unit Lwt.t) -> shutdown:(unit -> unit Lwt.t) -> (unit, error) Stdlib.result

Join the process lifecycle while it is open. Registered hooks are owned until process shutdown. Every hook is attempted even when another hook fails. Independent flush boundaries may overlap each other and an in-progress shutdown, so callbacks must be prompt and concurrency-safe; repeated shutdown callers share one shutdown invocation. Runtime control exceptions remain native.