Expand description
A client for the YTsaurus RPC proxy.
HTTP API v4 — which ytsaurus-client speaks —
can already reach every dynamic-table command. This crate exists for
latency and throughput under concurrency, never for capability: one
connection multiplexes many in-flight requests, where HTTP pays its
per-request cost every time.
§The protocol is four layers, and only the top one looks familiar
| Layer | What it is | Module |
|---|---|---|
| 1 | Bus — framed, checksummed packets over TCP | bus |
| 2 | RPC envelope — request and response headers, TError | rpc |
| 3 | API surface — generated protobuf | proto |
| 4 | Row wire format — rows in attachments, not protobuf fields | wire |
Layer 4 is the one that surprises people: rows do not travel as
protobuf. api_service.proto says outright that “actual data is passed via
attachments in the wire protocol”, and that format is neither YSON nor
Skiff — it is a third one, mandatory for every dynamic-table read and write.
§Shape of the code
The parsers are sans-io: crc64, bus::packet, rpc and
wire are pure functions from bytes to values, with no async anywhere,
so every one of them is testable without a runtime — and fuzzable, though
they are not yet fuzzed (gate E in docs/rpc-compatibility.md). async
appears only at the I/O edges — bus::Bus and
connection::Connection.
§Example
use ytsaurus_rpc::client::{Client, LookupOptions};
use ytsaurus_rpc::wire::{UnversionedValue, Value};
let client = Client::connect("localhost:8011").await?;
let key = vec![UnversionedValue::new(0, Value::Int64(42))];
let rows = client
.lookup_rows("//tmp/table", &["key"], &[key], LookupOptions::default())
.await?;
// One entry per key asked for, in order; `None` where the key had no row.
for row in rows {
println!("{row:?}");
}§Status
Pre-release, and published from 0.3.0. The ship gates are not all green
and the API may change in a patch release. What is implemented, what is
deliberately left out and what has actually been run against a cluster are
listed in docs/rpc-compatibility.md in the repository.
Re-exports§
pub use client::Client;pub use client::ClientBuilder;pub use client::Transaction;pub use error::Error;pub use error::Result;pub use error::YtError;pub use guid::Guid;pub use wire::Row;pub use wire::UnversionedValue;pub use wire::Value;pub use wire::ValueType;
Modules§
- blocking
- A blocking facade, in the shape
reqwest::blockinguses. - bus
- Layer 1: bus, the TCP transport.
- client
- The public API: a deliberately small subset of the RPC proxy’s surface.
- connection
- The connection actor.
- crc64
- YTsaurus’s CRC64, the checksum every bus packet header carries.
- error
- The error model.
- guid
- YTsaurus GUIDs: 16 bytes, four little-endian words, printed backwards.
- proto
- The generated protobuf types, re-exported.
- rpc
- Layer 2: the RPC envelope that rides inside a bus message.
- wire
- Layer 4: the row wire format.