pub fn create_rpc_client(address: &str) -> Result<Box<dyn TableClient>, Error>Expand description
Connects to an RPC proxy, returning the same interface as
create_client.
The counterpart of CreateRpcClient in the C++ client. Needs the rpc
feature, which is off by default: it pulls in tokio and prost, and this
crate is a dev-dependency of ytsaurus-job, whose examples are the static
musl worker binaries.
use ytsaurus_api::{LookupOptions, Row, TableClient};
// The only line that differs from the HTTP example.
let client = ytsaurus_client::create_rpc_client("localhost:8011")?;
let key = Row::new().with("key", 1i64);
let rows = client.lookup_rows("//tmp/table", &[key], &LookupOptions::default())?;The address is an RPC proxy’s, which is not the HTTP proxy’s: ask the
cluster for one with the discover_proxies command, or read
crates/ytsaurus-rpc/README.md.
This gives up the multiplexing. The facade drives one call at a time on
a private runtime; the concurrency the RPC proxy exists for needs
ytsaurus_rpc::Client directly, and an async caller.