Expand description
§malkuth
Service-supervision toolkit for long-running Rust programs: JSON-RPC over pluggable transports (TCP / WebSocket / IPC), supervised workers, split health probes, coordination locks and lease-based leader election.
§Feature flags
| Feature | What it enables |
|---|---|
tcp (default) | TCP JSON-RPC transport |
ws | WebSocket transport |
ipc | Unix-domain-socket / named-pipe transport |
signals (default) | OS-signal exit source (SIGINT/TERM/HUP/QUIT) |
worker | OTP-style child-process supervision |
probes | axum /healthz + /readyz routes |
file-lock | POSIX flock coordination-lock backend (Unix only) |
lease | File-lease lock with TTL auto-expiry |
pg-lock | PostgreSQL advisory-lock backend |
replica | In-memory instance registry |
leader-follower | Lease-based leader elector |
cli | malkuth watchdog binary (pod pool + sticky proxy) |
Re-exports§
pub use hooks::DrainHook;pub use hooks::ExitReason;pub use hooks::ExitSource;pub use hooks::Heartbeat;pub use hooks::HeartbeatReport;pub use hooks::ProbeSink;pub use jsonrpc::Id;pub use jsonrpc::Request;pub use jsonrpc::Response;pub use jsonrpc::Router;pub use jsonrpc::RpcError;pub use jsonrpc::RpcHandler;pub use lifecycle::DrainController;pub use lifecycle::ShutdownKind;pub use traits::CoordinationLock;pub use traits::InstanceRegistry;pub use traits::LeaderElector;pub use traits::LockError;pub use traits::LockGuard;pub use wire::Transport;pub use wire::WireConn;pub use wire::WireListener;pub use client::Client;pub use client::ClientPool;pub use server::Server;pub use service::Supervised;pub use worker::Supervisor;pub use worker::WorkerSpec;pub use probes::ProbeState;pub use probes::probe_router;pub use types::*;
Modules§
- client
- JSON-RPC client.
- codec
- NDJSON framing over a tokio duplex stream.
- hooks
- Pluggable lifecycle hooks (requirement: “exit probes / heartbeats are optional, hookable — use the default, or supply your own”).
- jsonrpc
- JSON-RPC 2.0 envelope types, error codes and (de)serialization.
- leader
- Subsystem B — leader/follower election backed by the core
LeaseLock. - lease
- Lease-based
CoordinationLock— a file lease with TTL auto-expiry. - lifecycle
- Layer 1 — uniform drain semantics.
- lock
- Filesystem-backed
CoordinationLock(POSIX advisoryflock, unix). - pg_lock
- PostgreSQL advisory-lock
CoordinationLockbackend (tokio-postgres). - probes
- Split health probes:
/healthz(liveness) +/readyz(readiness, with a drain bit), exposed over axum. The same state also implementsProbeSink, so the readiness/liveness can be served identically over JSON-RPC (Lifecycle.Status/Lifecycle.Health) with no HTTP framework. - registry
- In-memory
InstanceRegistry— the zero-dependency default backend. - server
- JSON-RPC server (tokio). One task per connection via
tokio::spawn. - service
- Batteries-included service orchestrator (tokio).
- signals
- Default
ExitSourcedriven by OS signals (tokio). - traits
- Coordination, registry & election trait contracts (Layer 2 / Subsystems).
- transport
- Pluggable transport backends for JSON-RPC (all tokio-based).
- types
- Lifecycle, supervision & rolling-update wire types.
- wire
- Wire-level transport trait contracts.
- worker
- Supervised child-process workers (tokio).