Crate ttrpc
ttrpc only.Expand description
ttRPC (“gRPC for low-memory environments”) support.
Unlike grpc, ttRPC does not ride on HTTP/2, it is a length-prefixed framing
directly on the byte stream, used by container runtimes and their plugins.
ttRPC support for Rama.
§ttRPC
ttRPC (“gRPC for low-memory environments”) is a lightweight RPC protocol used by
container runtimes and their plugins — containerd shims, the kata-agent, and the
containerd Node Resource Interface (NRI). Where gRPC rides on HTTP/2, ttRPC replaces
the whole HTTP/2 stack with a simple length-prefixed framing directly on the byte
stream, so it is a sibling to rama-grpc, not part of it.
Messages are encoded with prost; service stubs are generated at build time by
rama-ttrpc-build (see include_proto!).
§Transport
Like rama-grpc, this crate has no transport layer. A Client or
ServerConnection is built from any already-connected stream (anything that is
AsyncRead + AsyncWrite). Establish that stream with rama’s rama-tcp / rama-unix /
rama-udp capabilities (or an in-memory tokio::io::duplex pair), then hand it over:
§Rama
Crate used by the end-user rama crate and rama crate authors alike.
Learn more about rama:
- Github: https://github.com/plabayo/rama
- Book: https://ramaproxy.org/book/
Modules§
- build
- ttRPC codegen support for Rama.
- protobuf
protobuf - Protobuf support re-exported so generated ttRPC code does not require the consumer to
depend on
prostdirectly (mirrorsrama-grpc’sprotobuf::prost). - stream
- Streaming helpers re-exported for generated service code.
Macros§
- include_
proto - Include generated ttRPC service items (message types, service traits, client impls).
Structs§
- Client
- A ttRPC client; all calls made through it (and its clones) multiplex one connection.
- Context
- Metadata
- Server
Connection - Server
Context - Server
Controller - Handle for gracefully shutting down a running
ServerConnection. - Status
- Ttrpc
Connector - A rama connector that establishes a transport connection through an inner connector and
wraps it in a ttRPC
Client, so a client stack yields a ready to useClientinstead of a raw stream. - Ttrpc
Server - A ttRPC server as a rama
Service: it serves oneServerConnectionper accepted stream, so it can be handed straight to a rama listener (rama-tcp,rama-unix, …) instead of writing the per-connection loop by hand.
Enums§
- Code
- Get from https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto The canonical error codes for Google APIs.
- Timeout
Constants§
- DEFAULT_
MAX_ CONCURRENT_ STREAMS - Default per-connection limit on concurrently-executing request handlers. Once reached, new
requests are rejected with
RESOURCE_EXHAUSTEDrather than dispatched. This bounds the handler tasks, their per-stream buffers, and the encoded frames queued for the writer, each in-flight stream self-throttles to +-one unwritten frame, so the writer queue is bounded by this cap.
Traits§
Functions§
- get_
context - The current call’s
ServerContext, orNonewhen called outside a running method handler (e.g. from an independently spawned task). - get_
server - The current call’s
ServerController, orNoneoutside a running method handler.