MCPcopy Index your code
hub / github.com/cloudflare/shellflip

github.com/cloudflare/shellflip @v2.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.1.2 ↗ · + Follow
68 symbols 125 edges 6 files 34 documented · 50%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

shellflip

crates.io docs.rs

Graceful process restarts in Rust.

This crate facilitates upgrading or reconfiguring a service without disrupting existing connections. This is achieved by forking the process and communicating a small amount of state between the old and new processes; once the new process has started successfully the old process may terminate.

This crate has the following goals:

  • No old code keeps running after a successful upgrade (and inevitable shutdown of the old process)
  • The new process has a grace period for performing initialisation
  • Crashing during initialisation is OK
  • Only a single upgrade is ever run in parallel
  • It is possible for the user/process initiating the upgrade to know if the upgrade succeeded

Inspired by the tableflip go package but not a direct replacement.

Using the library

A full example is given in the restarter example service.

The main struct of interest is RestartConfig which has methods for detecting or initiating restart. For shutting down a restarted process, the ShutdownCoordinator provides the means for both signalling a shutdown event to spawned tasks, and awaiting their completion.

License

BSD licensed. See the LICENSE file for details.

🦀ノ( º _ ºノ) - respect crables!

Extension points exported contracts — how you extend this code

LifecycleHandler (Interface)
(no doc) [2 implementers]
src/lifecycle.rs
FdStringExt (Interface)
(no doc) [1 implementers]
src/pipes.rs

Core symbols most depended-on inside this repo

send_message
called by 4
src/restart_coordination_socket.rs
receive_message
called by 4
src/restart_coordination_socket.rs
send
called by 4
src/pipes.rs
recv
called by 3
src/pipes.rs
request_restart
called by 2
src/lib.rs
send_restart_command
called by 2
src/restart_coordination_socket.rs
create_paired_pipes
called by 2
src/pipes.rs
set_cloexec
called by 2
src/pipes.rs

Shape

Method 28
Function 20
Class 11
Enum 7
Interface 2

Languages

Rust100%

Modules by API surface

src/lib.rs21 symbols
src/shutdown.rs14 symbols
src/pipes.rs11 symbols
src/restart_coordination_socket.rs10 symbols
src/lifecycle.rs6 symbols
examples/restarter.rs6 symbols

For agents

$ claude mcp add shellflip \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact