Skip to main content

Crate ttrpc

Crate ttrpc 

Available on crate feature 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:

Modules§

build
ttRPC codegen support for Rama.
protobufprotobuf
Protobuf support re-exported so generated ttRPC code does not require the consumer to depend on prost directly (mirrors rama-grpc’s protobuf::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
ServerConnection
ServerContext
ServerController
Handle for gracefully shutting down a running ServerConnection.
Status
TtrpcConnector
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 use Client instead of a raw stream.
TtrpcServer
A ttRPC server as a rama Service: it serves one ServerConnection per 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_EXHAUSTED rather 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§

ClientExt
StatusExt

Functions§

get_context
The current call’s ServerContext, or None when called outside a running method handler (e.g. from an independently spawned task).
get_server
The current call’s ServerController, or None outside a running method handler.

Type Aliases§

Result
Result type used throughout rama-ttrpc, defaulting the error to Status.