pub struct LifecycleManager<R: ContainerRuntime + 'static> { /* private fields */ }Expand description
Coordinates the startup, supervision and shutdown of every resource
declared in a LifecyclePlan.
Implementations§
Source§impl<R: ContainerRuntime + 'static> LifecycleManager<R>
impl<R: ContainerRuntime + 'static> LifecycleManager<R>
Sourcepub fn new(
plan: LifecyclePlan,
runtime: R,
) -> (Self, UnboundedReceiver<LifecycleEvent>)
pub fn new( plan: LifecyclePlan, runtime: R, ) -> (Self, UnboundedReceiver<LifecycleEvent>)
Build a manager bound to plan and runtime. Returns the event
stream receiver alongside.
Sourcepub async fn start_all(&self) -> Result<(), LifecycleError>
pub async fn start_all(&self) -> Result<(), LifecycleError>
Start every resource in topological order. Independent branches start in parallel. On the first failure, the resources that already started are stopped automatically before the error is returned.
Sourcepub async fn stop_all(&self, grace: Duration) -> Result<(), LifecycleError>
pub async fn stop_all(&self, grace: Duration) -> Result<(), LifecycleError>
Stop every resource in reverse topological order with the given SIGTERM-to-SIGKILL grace window.
Sourcepub async fn run_until_signal(
&self,
grace: Duration,
) -> Result<(), LifecycleError>
pub async fn run_until_signal( &self, grace: Duration, ) -> Result<(), LifecycleError>
Opinionated entry point used by lightshuttle up: starts the
stack, waits for SIGINT or SIGTERM, then stops the stack
cleanly with the configured grace window.
Auto Trait Implementations§
impl<R> Freeze for LifecycleManager<R>
impl<R> RefUnwindSafe for LifecycleManager<R>where
R: RefUnwindSafe,
impl<R> Send for LifecycleManager<R>
impl<R> Sync for LifecycleManager<R>
impl<R> Unpin for LifecycleManager<R>
impl<R> UnsafeUnpin for LifecycleManager<R>
impl<R> UnwindSafe for LifecycleManager<R>where
R: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more