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§
- Http
State - HTTP server state shared across all handlers.
- Http
State Builder - Fluent builder for
HttpState. - Landing
Info - 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_encodingwill apply from oneContent-Encodingheader. 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
stateonlistener, terminating cleanly on SIGTERM/SIGINT. Convenience wrapper aroundbuild_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’swith_graceful_shutdownto stop accepting new connections, drain in-flight requests, and exit cleanly.