pub struct CoordinatorClient { /* private fields */ }Expand description
A coordinator client wrapper with automatic reconnection.
This wrapper maintains a connection to the coordinator and automatically attempts to reconnect if the connection is lost.
Implementations§
Source§impl CoordinatorClient
impl CoordinatorClient
Sourcepub fn new(addr: SocketAddr) -> Self
pub fn new(addr: SocketAddr) -> Self
Create a new coordinator client.
This does not establish a connection immediately; the connection
is created lazily on the first call to get.
Sourcepub fn with_config(addr: SocketAddr, config: ClientConfig) -> Self
pub fn with_config(addr: SocketAddr, config: ClientConfig) -> Self
Create a new coordinator client with custom configuration.
Sourcepub async fn get(&self) -> Result<CoordinatorServiceClient, Error>
pub async fn get(&self) -> Result<CoordinatorServiceClient, Error>
Get the coordinator client, creating a connection if needed.
Sourcepub async fn reconnect(&self) -> Result<CoordinatorServiceClient, Error>
pub async fn reconnect(&self) -> Result<CoordinatorServiceClient, Error>
Force a reconnection.
Useful after detecting a connection failure.
Sourcepub async fn invalidate(&self)
pub async fn invalidate(&self)
Invalidate the cached connection without reconnecting.
Sourcepub fn addr(&self) -> SocketAddr
pub fn addr(&self) -> SocketAddr
Get the coordinator’s address.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CoordinatorClient
impl !UnwindSafe for CoordinatorClient
impl Freeze for CoordinatorClient
impl Send for CoordinatorClient
impl Sync for CoordinatorClient
impl Unpin for CoordinatorClient
impl UnsafeUnpin for CoordinatorClient
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
Mutably borrows from an owned value. Read more