Skip to main content

create_client

Function create_client 

Source
pub fn create_client(proxy: &str) -> Result<Box<dyn TableClient>, Error>
Expand description

Connects over HTTP API v4.

The counterpart of CreateClient in the C++ client, and returns the same interface create_rpc_client does — so which transport a program uses is one line, and nothing below it changes.

use ytsaurus_api::{LookupOptions, Row, TableClient};

let client = ytsaurus_client::create_client("localhost:8000")?;
let key = Row::new().with("key", 1i64);
let rows = client.lookup_rows("//tmp/table", &[key], &LookupOptions::default())?;

HTTP is the right default. It reaches everything, it is what the rest of this crate speaks, and it carries none of the pre-release gates the RPC crate does. Reach for create_rpc_client when per-request latency under concurrency is measurably the bottleneck — and read docs/rpc-compatibility.md first.