Skip to main content

Module http

Module http 

Source
Expand description

HTTP transport. Implements the vgi-rpc protocol over HTTP: POST /{method} unary POST /{method}/init stream init (producer or exchange) POST /{method}/exchange stream continuation

Streaming is stateless on the wire: the full StreamStateKind is sealed into an XChaCha20-Poly1305 AEAD token (v4 wire format) carried in the vgi_rpc.stream_state#b64 metadata key. Any worker with the same token key can resume any continuation request — no server-side session map, no reaper, no cross-worker affinity. The token contents are confidential as well as authenticated: only the server can read the serialized state.

Structs§

HttpState
HTTP server state shared across all handlers.
HttpStateBuilder
Fluent builder for HttpState.
LandingInfo
Worker identity for the standardized VGI landing surface.

Constants§

ARROW_CONTENT_TYPE
DEFAULT_RESPONSE_COMPRESSION_LEVEL
zstd level used for response compression when the builder is not told otherwise. Response compression is on by default, matching the Python SDK’s compression_level=1.
MAX_CONTENT_CODINGS
Most codings decode_content_encoding will apply from one Content-Encoding header. Real bodies carry one; the cap bounds the decode work an attacker can buy with a single bounded request body.
REQUEST_ID_RESPONSE_HEADER
Per-request correlation id, echoed from the caller when supplied and generated otherwise.

Functions§

build_router
decode_content_encoding
Decode an HTTP body per its Content-Encoding, or return it unchanged.
serve_with_shutdown
Serve state on listener, terminating cleanly on SIGTERM/SIGINT. Convenience wrapper around build_router + axum::serve + shutdown_signal.
shutdown_signal
A future that resolves when the process receives SIGTERM or SIGINT (or a Ctrl-C event on non-Unix). Pass to axum::serve’s with_graceful_shutdown to stop accepting new connections, drain in-flight requests, and exit cleanly.