Skip to main content

Crate malkuth

Crate malkuth 

Source
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

FeatureWhat it enables
tcp (default)TCP JSON-RPC transport
wsWebSocket transport
ipcUnix-domain-socket / named-pipe transport
signals (default)OS-signal exit source (SIGINT/TERM/HUP/QUIT)
workerOTP-style child-process supervision
probesaxum /healthz + /readyz routes
file-lockPOSIX flock coordination-lock backend (Unix only)
leaseFile-lease lock with TTL auto-expiry
pg-lockPostgreSQL advisory-lock backend
replicaIn-memory instance registry
leader-followerLease-based leader elector
climalkuth 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 advisory flock, unix).
pg_lock
PostgreSQL advisory-lock CoordinationLock backend (tokio-postgres).
probes
Split health probes: /healthz (liveness) + /readyz (readiness, with a drain bit), exposed over axum. The same state also implements ProbeSink, 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 ExitSource driven 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).