pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub async fn connect(endpoints: Vec<String>) -> Result<Self, ClientError>
Sourcepub fn cached_leader(&self) -> Option<String>
pub fn cached_leader(&self) -> Option<String>
The endpoint the client currently believes is the leader, or None
if no leader has been observed yet or the cached entry has aged past
the configured leader_ttl.
Read-only diagnostic surface for ops dashboards and integration tests
asserting that a client has converged to the expected leader. It
reflects the cache as last updated by a completed RPC — it neither
triggers nor waits on any network round-trip, and the TTL check is
lazy (an expired entry reads as None).
pub async fn get_ts(&self) -> Result<Timestamp, ClientError>
pub async fn get_ts_batch( &self, count: u32, ) -> Result<Vec<Timestamp>, ClientError>
Sourcepub async fn get_current_max_safe(&self) -> Result<MaxSafe, ClientError>
pub async fn get_current_max_safe(&self) -> Result<MaxSafe, ClientError>
Read the leader’s current safe-point in physical-millisecond units.
Targets the cached leader if known, otherwise the first configured
endpoint. Followers return MaxSafe::max_safe_physical_ms == 0 rather
than erroring, matching the proto contract; pollers needing freshness
should target the leader endpoint.
Single-shot by design — the proto contract is “followers return 0”
rather than NOT_LEADER, so there is no hint to chase and no worklist
to drain; a caller polling for freshness retries the next tick rather
than the next endpoint. The one (connect, RPC) pair is bounded by
RetryPolicy::per_attempt_deadline (shared across both phases via
PairBudget, exactly like one get_ts attempt), and a transport-class
failure evicts the cached channel so a half-open / black-holing
connection is dropped before the next poll lands on it.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl !UnwindSafe for Client
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> 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