pub struct ReconnectingClient { /* private fields */ }Expand description
Reconnecting client wrapper with automatic reconnection Client with automatic reconnection and leader redirection support
Implementations§
Source§impl ReconnectingClient
impl ReconnectingClient
Sourcepub async fn connect(addr: &str) -> Result<Self, ClientError>
pub async fn connect(addr: &str) -> Result<Self, ClientError>
Create a new reconnecting client
The address can be either an IP:port (e.g., “127.0.0.1:1992”) or a hostname:port (e.g., “lance.example.com:1992”).
Sourcepub async fn connect_tls(
addr: &str,
tls_config: TlsClientConfig,
) -> Result<Self, ClientError>
pub async fn connect_tls( addr: &str, tls_config: TlsClientConfig, ) -> Result<Self, ClientError>
Create a new reconnecting client with TLS
The address can be either an IP:port (e.g., “127.0.0.1:1992”) or a hostname:port (e.g., “lance.example.com:1992”).
Sourcepub fn with_max_attempts(self, attempts: u32) -> Self
pub fn with_max_attempts(self, attempts: u32) -> Self
Set maximum reconnection attempts
Sourcepub fn with_follow_leader(self, follow: bool) -> Self
pub fn with_follow_leader(self, follow: bool) -> Self
Enable or disable automatic leader following
Sourcepub fn original_addr(&self) -> &str
pub fn original_addr(&self) -> &str
Get the original connection address
Sourcepub fn leader_addr(&self) -> Option<SocketAddr>
pub fn leader_addr(&self) -> Option<SocketAddr>
Get the current leader address if known
Sourcepub fn set_leader_addr(&mut self, addr: SocketAddr)
pub fn set_leader_addr(&mut self, addr: SocketAddr)
Update the known leader address (called when redirect received)
Sourcepub fn reconnect_attempts(&self) -> u32
pub fn reconnect_attempts(&self) -> u32
Get total reconnection attempts made
Sourcepub async fn client(&mut self) -> Result<&mut LanceClient, ClientError>
pub async fn client(&mut self) -> Result<&mut LanceClient, ClientError>
Get a reference to the underlying client, reconnecting if needed
Sourcepub async fn execute<F, T>(&mut self, op: F) -> Result<T, ClientError>
pub async fn execute<F, T>(&mut self, op: F) -> Result<T, ClientError>
Execute an operation with automatic reconnection on failure
Sourcepub fn mark_failed(&mut self)
pub fn mark_failed(&mut self)
Mark connection as failed
Auto Trait Implementations§
impl !Freeze for ReconnectingClient
impl !RefUnwindSafe for ReconnectingClient
impl Send for ReconnectingClient
impl Sync for ReconnectingClient
impl Unpin for ReconnectingClient
impl !UnwindSafe for ReconnectingClient
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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