Crate zookeeper_client

Source
Expand description

zookeeper-client is an async Rust client library for Apache ZooKeeper.

§Opinionated API

This library is written from scratch. Its API is pretty different from Java counterpart or even other Rust clients. Some of them are listed here for a glance.

  • No callbacks.
  • No catch-all watcher.
  • StateWatcher tracks session state updates.
  • OneshotWatcher tracks oneshot ZooKeeper node event.
  • PersistentWatcher tracks persistent and recursive persistent ZooKeeper node events.
  • No event type XyzWatchRemoved as Rust has Drop.
  • Most data operations are ordered at future creation time but not polling time.
  • Client::chroot and Client::clone enable session sharing cross multiple different rooted clients.

§Feature flags

  • tls: Toggle TLS support.
  • sasl: Toggle SASL support.
  • sasl-gssapi: Toggle only GSSAPI SASL support. This relies on binding package libgssapi-sys.
  • sasl-digest-md5: Toggle only DIGEST-MD5 SASL support.

§Async runtime support

This library uses asyncs and spawns to spawn asynchronous tasks. It exposes runtime feature flags for handy. Please refer their docs for references.

  • tokio: Toggle support for tokio.
  • smol: Toggle support for smol builtin global executor.
  • async-global-executor: Toggle support for async-global-executor.

Structs§

Acl
Acl expresses node permission for node accessors.
Acls
List of Acls to carry different permissions for different auth identities.
AuthId
AuthId represents authenticated identity and expresses authentication requirement in Acl.
AuthUser
AuthUser represents display info for authenticated identity.
CheckWriter
Similar to MultiWriter expect for CheckWriter::commit.
Client
Client encapsulates ZooKeeper session to interact with ZooKeeper cluster.
ClientBuilder
Builder for Client with more options than Client::connect.
Connector
A builder for Client with more options than Client::connect.
CreateOptions
Options for node creation, constructed from CreateMode::with_acls.
CreateSequence
Thin wrapper to encapsulate sequential node’s sequence number.
DigestMd5SaslOptions
DIGEST-MD5 SASL options.
GssapiSaslOptions
GSSAPI SASL options.
LockClient
Guard client writes by owned ZooKeeper lock path which will be deleted in background when dropped.
LockOptions
Options to cover Acls for lock path and CreateOptions for ancestor nodes if they don’t exist.
LockPrefix
Prefix pattern for lock path creation.
MultiReader
MultiReader commits multiple read operations in one request to achieve snapshot like semantics.
MultiWriter
MultiWriter commits write and condition check operations in one request to achieve transaction like semantics.
OneshotWatcher
Watcher for stat, data and child event.
OwnedLockClient
Owned version of LockClient.
Permission
Permission expresses rights accessors should have to operate on attached node.
PersistentWatcher
Watcher for persistent and recursive watch.
SaslOptions
Client side SASL options.
SessionId
Thin wrapper for zookeeper session id. It prints in hex format headed with 0x.
SessionInfo
ZooKeeper session info.
Stat
ZooKeeper node stat.
StateWatcher
StateWatcher tracks session state updates.
TlsOptions
Options for tls connection.
WatchedEvent
WatchedEvent represents update to watched node or session.

Enums§

AddWatchMode
Watch mode.
CheckWriteError
Error for CheckWriter::commit.
CreateMode
CreateMode specifies ZooKeeper znode type. It covers all znode types with help from CreateOptions::with_ttl.
EnsembleUpdate
EnsembleUpdate specifies an update to ZooKeeper ensemble membership.
Error
Errors for ZooKeeper operations.
EventType
Event type for watch notifications.
MultiReadResult
Individual result for one operation in MultiReader.
MultiWriteError
Error for MultiWriter::commit.
MultiWriteResult
Individual result for one operation in MultiWriter.
SessionState
ZooKeeper session states.