pub struct Connector { /* private fields */ }
Expand description
A builder for Client with more options than Client::connect.
Uses Client::connector to construct one.
Implementations§
Source§impl Connector
impl Connector
Sourcepub fn with_session_timeout(self, timeout: Duration) -> Self
pub fn with_session_timeout(self, timeout: Duration) -> Self
Specifies target session timeout to negotiate with ZooKeeper server.
Defaults to 6s.
Sourcepub fn session_timeout(&mut self, timeout: Duration) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_session_timeout instead
pub fn 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(self, timeout: Duration) -> Self
pub fn with_connection_timeout(self, timeout: Duration) -> Self
Specifies idle timeout to conclude a connection as loss.
Defaults to 2/5
of session timeout.
Sourcepub fn connection_timeout(&mut self, timeout: Duration) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_connection_timeout instead
pub fn 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(self, readonly: bool) -> Self
pub fn with_readonly(self, readonly: bool) -> Self
Specifies whether readonly session is allowed.
Sourcepub fn readonly(&mut self, readonly: bool) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_readonly instead
pub fn readonly(&mut self, readonly: bool) -> &mut Self
Specifies whether readonly session is allowed.
Sourcepub fn with_auth(self, scheme: &str, auth: &[u8]) -> Self
pub fn with_auth(self, scheme: &str, auth: &[u8]) -> Self
Adds auth info for given authentication scheme.
Sourcepub fn auth(&mut self, scheme: String, auth: Vec<u8>) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_auth instead
pub fn auth(&mut self, scheme: String, auth: Vec<u8>) -> &mut Self
Specifies auth info for given authentication scheme.
Sourcepub fn with_session(self, session: SessionInfo) -> Self
pub fn with_session(self, session: SessionInfo) -> Self
Specifies session to reestablish.
Sourcepub fn session(&mut self, session: SessionInfo) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_session instead
pub fn session(&mut self, session: SessionInfo) -> &mut Self
Specifies session to reestablish.
Sourcepub fn with_server_version(self, major: u32, minor: u32, patch: u32) -> Self
pub fn with_server_version(self, major: u32, minor: u32, patch: u32) -> Self
Specifies target 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 server_version(
&mut self,
major: u32,
minor: u32,
patch: u32,
) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_server_version instead
pub fn server_version( &mut self, major: u32, minor: u32, patch: u32, ) -> &mut Self
Specifies target 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 with_detached(self) -> Self
pub fn with_detached(self) -> Self
Detaches created session so it will not be closed after all client instances dropped.
Sourcepub fn detached(&mut self) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_detached instead
pub fn detached(&mut self) -> &mut Self
Detaches created session so it will not be closed after all client instances dropped.
Sourcepub fn with_tls(self, options: TlsOptions) -> Self
Available on crate feature tls
only.
pub fn with_tls(self, options: TlsOptions) -> Self
tls
only.Specifies tls options for connections to ZooKeeper.
Sourcepub fn tls(&mut self, options: TlsOptions) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_tls insteadAvailable on crate feature tls
only.
pub fn tls(&mut self, options: TlsOptions) -> &mut Self
tls
only.Specifies tls options for connections to ZooKeeper.
Sourcepub fn with_sasl(self, options: impl Into<SaslOptions>) -> Self
Available on crate features sasl
or sasl-gssapi
or sasl-digest-md5
only.
pub fn with_sasl(self, options: impl Into<SaslOptions>) -> Self
sasl
or sasl-gssapi
or sasl-digest-md5
only.Specifies SASL options.
Sourcepub fn sasl(&mut self, options: impl Into<SaslOptions>) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_sasl insteadAvailable on crate features sasl
or sasl-gssapi
or sasl-digest-md5
only.
pub fn sasl(&mut self, options: impl Into<SaslOptions>) -> &mut Self
sasl
or sasl-gssapi
or sasl-digest-md5
only.Specifies SASL options.
Sourcepub fn with_fail_eagerly(self) -> Self
pub fn with_fail_eagerly(self) -> Self
Fail session establishment eagerly with Error::NoHosts when all hosts has been tried.
This permits fail-fast without wait up to Self::session_timeout in Self::connect. This is not suitable for situations where ZooKeeper cluster is accessible via a single virtual IP.
Sourcepub fn fail_eagerly(&mut self) -> &mut Self
👎Deprecated since 0.11.0: use Connector::with_fail_eagerly instead
pub fn fail_eagerly(&mut self) -> &mut Self
Fail session establishment eagerly with Error::NoHosts when all hosts has been tried.
This permits fail-fast without wait up to Self::session_timeout in Self::connect. This is not suitable for situations where ZooKeeper cluster is accessible via a single virtual IP.
Sourcepub async fn secure_connect(self, cluster: &str) -> Result<Client, Error>
pub async fn secure_connect(self, cluster: &str) -> Result<Client, Error>
Connects to ZooKeeper cluster.
Same to Self::connect except that server1
will use tls encrypted protocol given
the connection string server1,tcp://server2,tcp+tls://server3
.
Sourcepub async fn connect(self, cluster: &str) -> Result<Client, Error>
pub async fn connect(self, cluster: &str) -> Result<Client, Error>
Connects to ZooKeeper cluster.
Parameter cluster
specifies connection string to ZooKeeper cluster. It has same syntax as
Java client except that you can specifies protocol for server individually. For example,
server1,tcp://server2,tcp+tls://server3
. This claims that server1
and server2
use
plaintext protocol, while server3
uses tls encrypted protocol.
§Notable errors
- Error::NoHosts if no host is available and Self::fail_eagerly is turn on
- Error::SessionExpired if specified session expired
- Error::Timeout if no session established with in approximate Self::session_timeout
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Connector
impl RefUnwindSafe for Connector
impl Send for Connector
impl Sync for Connector
impl Unpin for Connector
impl UnwindSafe for Connector
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> 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>
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>
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