Struct Connector

Source
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

Source

pub fn with_session_timeout(self, timeout: Duration) -> Self

Specifies target session timeout to negotiate with ZooKeeper server.

Defaults to 6s.

Source

pub fn session_timeout(&mut self, timeout: Duration) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_session_timeout instead

Specifies target session timeout to negotiate with ZooKeeper server.

Defaults to 6s.

Source

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.

Source

pub fn connection_timeout(&mut self, timeout: Duration) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_connection_timeout instead

Specifies idle timeout to conclude a connection as loss.

Defaults to 2/5 of session timeout.

Source

pub fn with_readonly(self, readonly: bool) -> Self

Specifies whether readonly session is allowed.

Source

pub fn readonly(&mut self, readonly: bool) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_readonly instead

Specifies whether readonly session is allowed.

Source

pub fn with_auth(self, scheme: &str, auth: &[u8]) -> Self

Adds auth info for given authentication scheme.

Source

pub fn auth(&mut self, scheme: String, auth: Vec<u8>) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_auth instead

Specifies auth info for given authentication scheme.

Source

pub fn with_session(self, session: SessionInfo) -> Self

Specifies session to reestablish.

Source

pub fn session(&mut self, session: SessionInfo) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_session instead

Specifies session to reestablish.

Source

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.

Source

pub fn server_version( &mut self, major: u32, minor: u32, patch: u32, ) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_server_version instead

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.

Source

pub fn with_detached(self) -> Self

Detaches created session so it will not be closed after all client instances dropped.

Source

pub fn detached(&mut self) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_detached instead

Detaches created session so it will not be closed after all client instances dropped.

Source

pub fn with_tls(self, options: TlsOptions) -> Self

Available on crate feature tls only.

Specifies tls options for connections to ZooKeeper.

Source

pub fn tls(&mut self, options: TlsOptions) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_tls instead
Available on crate feature tls only.

Specifies tls options for connections to ZooKeeper.

Source

pub fn with_sasl(self, options: impl Into<SaslOptions>) -> Self

Available on crate features sasl or sasl-gssapi or sasl-digest-md5 only.

Specifies SASL options.

Source

pub fn sasl(&mut self, options: impl Into<SaslOptions>) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_sasl instead
Available on crate features sasl or sasl-gssapi or sasl-digest-md5 only.

Specifies SASL options.

Source

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.

Source

pub fn fail_eagerly(&mut self) -> &mut Self

👎Deprecated since 0.11.0: use Connector::with_fail_eagerly instead

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.

Source

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.

Source

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

Trait Implementations§

Source§

impl Clone for Connector

Source§

fn clone(&self) -> Connector

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Connector

Source§

fn fmt(&self, __f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more