Update zookeeper client

This commit is contained in:
ManyTheFish
2023-08-07 14:20:01 +02:00
parent 3d46e84d97
commit b311089435
4 changed files with 16 additions and 15 deletions

View File

@ -26,4 +26,4 @@ thiserror = "1.0.40"
time = { version = "0.3.20", features = ["serde-well-known", "formatting", "parsing", "macros"] }
tokio = { version = "1.27.0", features = ["full"] }
uuid = { version = "1.3.1", features = ["serde", "v4"] }
zookeeper-client = "0.4.0"
zookeeper-client = "0.5.0"

View File

@ -38,7 +38,7 @@ impl AuthController {
// setup the auth zk environment, the `auth` node
Some(ref zk) => {
let options =
zk::CreateOptions::new(zk::CreateMode::Persistent, zk::Acl::anyone_all());
zk::CreateMode::Persistent.with_acls(zk::Acls::anyone_all());
// TODO: we should catch the potential unexpected errors here https://docs.rs/zookeeper-client/latest/zookeeper_client/struct.Client.html#method.create
// for the moment we consider that `create` only returns Error::NodeExists.
match zk.create("/auth", &[], &options).await {
@ -159,7 +159,7 @@ impl AuthController {
// TODO: we may commit only after zk persisted the keys
let key = tokio::task::spawn_blocking(move || store.put_api_key(key)).await??;
if let Some(ref zk) = self.zk {
let options = zk::CreateOptions::new(zk::CreateMode::Persistent, zk::Acl::anyone_all());
let options = zk::CreateMode::Persistent.with_acls(zk::Acls::anyone_all());
zk.create(&format!("/auth/{}", key.uid), &serde_json::to_vec_pretty(&key)?, &options)
.await?;