MCPcopy Create free account
hub / github.com/cloudflare/shellflip / LifecycleHandler

Interface LifecycleHandler

src/lifecycle.rs:14–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13#[async_trait]
14pub trait LifecycleHandler: Send {
15 /// Called after the child process has been spawned, allowing the current process to send state
16 /// to the child process. The child process can receive this data by calling
17 /// `receive_from_old_process`.
18 async fn send_to_new_process(&mut self, _write_pipe: PipeWriter) -> io::Result<()> {
19 Ok(())
20 }
21
22 /// Called before the child process has been spawned.
23 async fn pre_new_process(&mut self) {}
24
25 /// Called after `send_to_new_process` if the child process fails to start successfully.
26 /// This gives you an opportunity to undo any state changes made in `send_to_new_process`.
27 async fn new_process_failed(&mut self) {}
28}
29
30/// A default implementation of LifecycleHandler that does nothing in response to lifecycle events.
31pub struct NullLifecycleHandler;

Callers 3

send_parent_stateFunction · 0.45
spawn_childFunction · 0.80
send_parent_stateFunction · 0.80

Implementers 2

lifecycle.rssrc/lifecycle.rs
restarter.rsexamples/restarter.rs

Calls

no outgoing calls

Tested by

no test coverage detected