Expand description
The transport-independent YTsaurus client interface.
YTsaurus reaches its dynamic tables two ways — HTTP API v4 and the RPC proxy — and the C++ client does not make callers choose an API to go with the transport. It has one interface and two constructors:
IClientPtr CreateClient (const TString& serverName, ...); // HTTP
IClientPtr CreateRpcClient(const TString& serverName, ...); // RPC proxyThis crate is the Rust equivalent of the interface those return, and the layering mirrors the C++ exactly:
| C++ | here |
|---|---|
yt/yt/client/api — the interface | this crate |
yt/yt/client/api/rpc_proxy — one implementation | ytsaurus-rpc |
yt/cpp/mapreduce — the wrapper with both constructors | ytsaurus-client |
So the two constructors live in ytsaurus-client, which depends on both,
and switching transport is one line:
let client = ytsaurus_client::create_client("localhost:8000")?; // HTTP
let client = ytsaurus_client::create_rpc_client("localhost:8011")?; // RPC
// everything below is identical
let rows = client.lookup_rows("//tmp/t", &[key], &LookupOptions::default())?;§This interface is synchronous
Deliberately, and it is the one decision here worth arguing about. The C++ wrapper is blocking, every other crate in this workspace is synchronous, and a MapReduce job is a synchronous, single-purpose process. So the shared interface blocks.
ytsaurus-rpc’s own API stays async, and callers who want multiplexed
in-flight requests — the entire reason the RPC proxy exists — should use it
directly rather than through this. What this buys is portability between
transports, not concurrency.
§What it covers
The dynamic-table surface both transports implement: reads, writes and the
transactions they run in. Cypress, operations and file I/O stay on
ytsaurus-client, because the RPC crate deliberately does not implement
them and an interface with half its methods unavailable on one transport
would be worse than two honest APIs.
Re-exports§
pub use error::Error;pub use error::Result;pub use value::MaybeRow;pub use value::Row;pub use value::Value;
Modules§
Structs§
- Lookup
Options - Options for
TableClient::lookup_rows. - Select
Options - Options for
TableClient::select_rows.
Enums§
- Transport
- Which wire a client speaks.
Traits§
- Table
Client - What a dynamic table can be asked to do, whatever the transport.
- Table
Transaction - A transaction over a dynamic table.
Type Aliases§
- Timestamp
- A read timestamp.