Skip to main content

Crate vane_mgmt

Crate vane_mgmt 

Source
Expand description

vane management protocol: vane-specific verb schemas plus re-exports of the project-agnostic NDJSON-RPC framing (ndjson_rpc).

See spec/crates/mgmt.md.

Modules§

client
Typed Unix-socket client. Same frame shapes as crate::server. One Unix-socket connection per call: the API stays a simple call(verb, args) -> result, and a future multiplexed transport can be slotted in without changing the call shape.
http_client
HTTP-over-TCP management client. Mirrors crate::UnixMgmtClient but talks to crate::http_server over hyper::client::conn::http1.
http_server
HTTP-over-TCP transport for the same NDJSON frame shapes the Unix socket crate::server speaks.
protocol
Wire format: line-delimited JSON over a duplex byte stream. Each request is one JSON object on one line; each response is one JSON object on one line; lines end with \n. No length prefix — the framing is the newline. NDJSON keeps tools such as nc -U piped through jq usable for ad-hoc poking. The same frame shapes ride the HTTP-over-TCP transport (NDJSON over chunked encoding).
server
Unix-socket accept loop + per-connection line-delimited JSON dispatch to verb handlers. The HTTP-over-TCP transport (crate::http_server) speaks the same frame shapes, so dispatch logic is shared.
verb
Per-verb argument and result schemas. Wire-side Request.args is a serde_json::Value (untyped on the wire); each verb’s handler deserialises it into its own typed struct, surfacing crate::protocol::WireErrorKind::BadArgs on shape mismatch.

Structs§

EndMarker
Empty marker payload for the End outcome. Encoded as {} so future fields (e.g. a final summary) can be added without breaking the wire shape.
HttpMgmtClient
Plaintext HTTP/1.1 mgmt client. Cheap to clone — addr is Copy, token is reference-counted.
HttpServerConfig
Request
Client → server frame.
Response
Server → client frame.
UnixMgmtClient
Single-shot typed Unix mgmt client. Each call opens a fresh connection. Re-using one client for many calls works too — the struct holds no persistent state across invocations.
WireError
Structured error frame. message is a human-readable summary; details, when present, carries verb-specific structured context (compile error site, timeout stage, etc.) that the CLI can render alongside the message.

Enums§

DispatchOutcome
What dispatch returns. One-shot verbs (ping, stats, …) produce a single result/error frame; streaming verbs (tail_flow) produce a sequence of Event frames terminated by an End frame.
HttpServerError
MgmtClientError
ResponseOutcome
Successful result or structured error. Flattened into Response so the wire shape is {"id":N,"result":{...}} or {"id":N,"error":{...}} rather than a nested outcome key.
WireErrorKind
Error category. The full string message carries detail; the kind is the machine-readable discriminator.

Traits§

EventStream
A streaming event source. The server polls next_event until the client disconnects or the stream returns None.
Handler
Server-side dispatcher. Callers implement this against their own application state and pass an Arc<H> to spawn_unix_server or crate::spawn_http_server.

Functions§

encode_line
Encode a value as JSON and append \n. Centralises framing so server.rs / client.rs share one implementation.
spawn_http_server
Spawn one accept loop per bind address. Returns the spawned task handles; each task runs until cancel fires or the listener errors fatally.
spawn_unix_server
Bind a Unix socket and serve mgmt requests until cancel fires.