pub struct OxiaClientBuilder { /* private fields */ }Expand description
Configures and creates an OxiaClient.
| Option | Default |
|---|---|
service_address | 127.0.0.1:6648 |
namespace | default |
identity | random UUID |
batch_max_size | 128 KiB |
max_requests_per_batch | 1000 |
max_write_batches_in_flight | 4 |
max_read_batches_in_flight | 4 |
session_timeout | 15 s |
session_keep_alive | session_timeout / 10 |
request_timeout | 30 s |
use oxia::OxiaClient;
use std::time::Duration;
let client = OxiaClient::builder()
.service_address("localhost:6648")
.namespace("my-namespace")
.session_timeout(Duration::from_secs(30))
.build()
.await?;Implementations§
Source§impl OxiaClientBuilder
impl OxiaClientBuilder
Sourcepub fn service_address(self, service_address: impl Into<String>) -> Self
pub fn service_address(self, service_address: impl Into<String>) -> Self
The address of the Oxia service, as host:port (default:
127.0.0.1:6648).
Sourcepub fn namespace(self, namespace: impl Into<String>) -> Self
pub fn namespace(self, namespace: impl Into<String>) -> Self
The Oxia namespace all operations apply to (default: "default").
Sourcepub fn identity(self, identity: impl Into<String>) -> Self
pub fn identity(self, identity: impl Into<String>) -> Self
The client identity reported with ephemeral records (default: a random UUID).
Sourcepub fn max_write_batches_in_flight(self, max: u32) -> Self
pub fn max_write_batches_in_flight(self, max: u32) -> Self
The maximum number of write batches in flight per shard (default: 4).
Batching is rate-adaptive: while fewer batches are outstanding on a shard’s write stream, operations are dispatched almost immediately; once the window is exhausted, the open batch accumulates operations, so batch size automatically tracks the server’s service rate. Must be at least 1.
Sourcepub fn max_read_batches_in_flight(self, max: u32) -> Self
pub fn max_read_batches_in_flight(self, max: u32) -> Self
The maximum number of concurrent read batches per shard (default: 4).
Works like max_write_batches_in_flight,
bounding the read RPCs outstanding per shard. Must be at least 1.
Sourcepub fn batch_max_size(self, batch_max_size: u32) -> Self
pub fn batch_max_size(self, batch_max_size: u32) -> Self
The maximum byte size of a batch (default: 128KiB).
Sourcepub fn max_requests_per_batch(self, max_requests_per_batch: u32) -> Self
pub fn max_requests_per_batch(self, max_requests_per_batch: u32) -> Self
The maximum number of operations in a batch (default: 1000).
Sourcepub fn session_timeout(self, session_timeout: Duration) -> Self
pub fn session_timeout(self, session_timeout: Duration) -> Self
The session timeout for ephemeral records (default: 15s). Ephemeral records disappear if the client fails to heartbeat for this long.
Sourcepub fn session_keep_alive(self, session_keep_alive: Duration) -> Self
pub fn session_keep_alive(self, session_keep_alive: Duration) -> Self
The interval between session keep-alive heartbeats (default:
session_timeout / 10).
Sourcepub fn request_timeout(self, request_timeout: Duration) -> Self
pub fn request_timeout(self, request_timeout: Duration) -> Self
The deadline applied to individual operations (default: 30s).
Sourcepub async fn build(self) -> Result<OxiaClient, OxiaError>
pub async fn build(self) -> Result<OxiaClient, OxiaError>
Connects to the cluster and returns the client.
Fails fast — within the request timeout — when the cluster is unreachable, the namespace does not exist, or the first shard assignments cannot be obtained.
Trait Implementations§
Source§impl Clone for OxiaClientBuilder
impl Clone for OxiaClientBuilder
Source§fn clone(&self) -> OxiaClientBuilder
fn clone(&self) -> OxiaClientBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OxiaClientBuilder
impl Debug for OxiaClientBuilder
Source§impl Default for OxiaClientBuilder
impl Default for OxiaClientBuilder
Source§fn default() -> OxiaClientBuilder
fn default() -> OxiaClientBuilder
Auto Trait Implementations§
impl Freeze for OxiaClientBuilder
impl RefUnwindSafe for OxiaClientBuilder
impl Send for OxiaClientBuilder
impl Sync for OxiaClientBuilder
impl Unpin for OxiaClientBuilder
impl UnsafeUnpin for OxiaClientBuilder
impl UnwindSafe for OxiaClientBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request