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 packagelibgssapi-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.
- Auth
User - AuthUser represents display info for authenticated identity.
- Check
Writer - Similar to MultiWriter expect for CheckWriter::commit.
- Client
- Client encapsulates ZooKeeper session to interact with ZooKeeper cluster.
- Client
Builder - Builder for Client with more options than Client::connect.
- Connector
- A builder for Client with more options than Client::connect.
- Create
Options - Options for node creation, constructed from CreateMode::with_acls.
- Create
Sequence - Thin wrapper to encapsulate sequential node’s sequence number.
- Digest
Md5Sasl Options - DIGEST-MD5 SASL options.
- Gssapi
Sasl Options - GSSAPI SASL options.
- Lock
Client - Guard client writes by owned ZooKeeper lock path which will be deleted in background when dropped.
- Lock
Options - Options to cover Acls for lock path and CreateOptions for ancestor nodes if they don’t exist.
- Lock
Prefix - Prefix pattern for lock path creation.
- Multi
Reader - MultiReader commits multiple read operations in one request to achieve snapshot like semantics.
- Multi
Writer - MultiWriter commits write and condition check operations in one request to achieve transaction like semantics.
- Oneshot
Watcher - Watcher for stat, data and child event.
- Owned
Lock Client - Owned version of LockClient.
- Permission
- Permission expresses rights accessors should have to operate on attached node.
- Persistent
Watcher - Watcher for persistent and recursive watch.
- Sasl
Options - Client side SASL options.
- Session
Id - Thin wrapper for zookeeper session id. It prints in hex format headed with 0x.
- Session
Info - ZooKeeper session info.
- Stat
- ZooKeeper node stat.
- State
Watcher - StateWatcher tracks session state updates.
- TlsOptions
- Options for tls connection.
- Watched
Event - WatchedEvent represents update to watched node or session.
Enums§
- AddWatch
Mode - Watch mode.
- Check
Write Error - Error for CheckWriter::commit.
- Create
Mode - CreateMode specifies ZooKeeper znode type. It covers all znode types with help from CreateOptions::with_ttl.
- Ensemble
Update - EnsembleUpdate specifies an update to ZooKeeper ensemble membership.
- Error
- Errors for ZooKeeper operations.
- Event
Type - Event type for watch notifications.
- Multi
Read Result - Individual result for one operation in MultiReader.
- Multi
Write Error - Error for MultiWriter::commit.
- Multi
Write Result - Individual result for one operation in MultiWriter.
- Session
State - ZooKeeper session states.