pub struct ClientBuilder { /* private fields */ }
Expand description
Builder for Client with more options than Client::connect.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn with_session_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn with_session_timeout(&mut self, timeout: Duration) -> &mut Self
Specifies target session timeout to negotiate with ZooKeeper server.
Defaults to 6s.
Sourcepub fn with_connection_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn with_connection_timeout(&mut self, timeout: Duration) -> &mut Self
Specifies idle timeout to conclude a connection as loss.
Defaults to 2/5
of session timeout.
Sourcepub fn with_readonly(&mut self, readonly: bool) -> &mut ClientBuilder
pub fn with_readonly(&mut self, readonly: bool) -> &mut ClientBuilder
Specifies whether readonly session is allowed.
Sourcepub fn with_auth(&mut self, scheme: String, auth: Vec<u8>) -> &mut ClientBuilder
pub fn with_auth(&mut self, scheme: String, auth: Vec<u8>) -> &mut ClientBuilder
Specifies auth info for given authentication scheme.
Sourcepub fn assume_server_version(
&mut self,
major: u32,
minor: u32,
patch: u32,
) -> &mut Self
pub fn assume_server_version( &mut self, major: u32, minor: u32, patch: u32, ) -> &mut Self
Specifies client assumed server version of ZooKeeper cluster.
Client will issue server compatible protocol to avoid Error::Unimplemented for some operations. See Client::create for an example.
See ZOOKEEPER-1381 and ZOOKEEPER-3762 for references.
Sourcepub fn detach(&mut self) -> &mut Self
pub fn detach(&mut self) -> &mut Self
Detaches creating session so it will not be closed after all client instances dropped.
Sourcepub async fn connect(&mut self, cluster: &str) -> Result<Client, Error>
pub async fn connect(&mut self, cluster: &str) -> Result<Client, Error>
Connects to ZooKeeper cluster.
§Notable errors
- Error::NoHosts if no host is available
- Error::SessionExpired if specified session expired
Trait Implementations§
Source§impl Clone for ClientBuilder
impl Clone for ClientBuilder
Source§fn clone(&self) -> ClientBuilder
fn clone(&self) -> ClientBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe for ClientBuilder
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more