kezhuw commented on code in PR #2735:
URL: 
https://github.com/apache/incubator-opendal/pull/2735#discussion_r1308379479


##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,
+    /// the password file of the user to connect to zookeeper service, default 
None
+    password: Option<String>,
+}
+
+impl ZookeeperBuilder {
+    /// Set the network addresses of zookeeper service
+    pub fn endpoint(&mut self, endpoint: &str) -> &mut Self {
+        if !endpoint.is_empty() {
+            self.endpoint = Some(endpoint.to_string());
+        }
+        self
+    }
+
+    /// Set the username of zookeeper service
+    pub fn user(&mut self, user: &str) -> &mut Self {
+        if !user.is_empty() {
+            self.user = Some(user.to_string());
+        }
+        self
+    }
+
+    /// Specify the password of zookeeper service
+    pub fn password(&mut self, password: &str) -> &mut Self {
+        if !password.is_empty() {
+            self.password = Some(password.to_string());
+        }
+        self
+    }
+}
+
+impl Debug for ZookeeperBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+        if let Some(endpoint) = self.endpoint.clone() {
+            ds.field("endpoint", &endpoint);
+        }
+        if let Some(user) = self.user.clone() {
+            ds.field("user", &user);
+        }
+        ds.finish()
+    }
+}
+
+impl Builder for ZookeeperBuilder {
+    const SCHEME: Scheme = Scheme::Zookeeper;
+    type Accessor = ZookeeperBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let mut builder = ZookeeperBuilder::default();
+
+        map.get("endpoint").map(|v| builder.endpoint(v));
+        map.get("user").map(|v| builder.user(v));
+        map.get("password").map(|v| builder.password(v));
+
+        builder
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        let endpoint = match self.endpoint.clone() {
+            None => DEFAULT_ZOOKEEPER_ENDPOINT.to_string(),
+            Some(endpoint) => endpoint,
+        };
+        let (auth, acl) = match (self.user.clone(), self.password.clone()) {
+            (Some(user), Some(password)) => {
+                let auth = format!("{user}:{password}").as_bytes().to_vec();
+                (auth, zk::Acl::creator_all())
+            }
+            _ => {
+                warn!("username and password isn't set, default use `anyone` 
acl");
+                (Vec::<u8>::new(), zk::Acl::anyone_all())
+            }
+        };
+
+        Ok(ZookeeperBackend::new(ZkAdapter {
+            endpoint,
+            auth,
+            acl,
+            client: OnceCell::new(),
+        }))
+    }
+}
+
+/// Backend for Zookeeper service
+pub type ZookeeperBackend = kv::Backend<ZkAdapter>;
+
+#[derive(Clone)]
+pub struct ZkAdapter {
+    endpoint: String,
+    auth: Vec<u8>,
+    client: OnceCell<zk::Client>,
+    acl: &'static [zk::Acl],
+}
+
+impl Debug for ZkAdapter {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Adapter");
+        ds.field("endpoint", &self.endpoint);
+        ds.field("acl", &self.acl);
+        ds.finish()
+    }
+}
+
+impl ZkAdapter {
+    async fn get_connection(&self) -> Result<zk::Client> {
+        if let Some(client) = self.client.get() {
+            return Ok(client.clone());
+        }
+        match zk::Client::connect(&self.endpoint.clone()).await {
+            Ok(client) => {
+                if !self.auth.is_empty() {
+                    client
+                        .auth(ZOOKEEPER_AUTH_SCHEME.to_string(), 
self.auth.clone())
+                        .await
+                        .map_err(parse_zookeeper_error)?;
+                }
+                self.client.set(client.clone()).ok();
+                Ok(client)
+            }
+            Err(e) => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+        }
+    }
+
+    fn create_nested_node<'a>(
+        &'a self,
+        path: &'a str,
+        value: &'a [u8],
+    ) -> BoxFuture<'a, Result<()>> {
+        let mut path = path.to_string();
+        async move {
+            return match self
+                .get_connection()
+                .await?
+                .create(
+                    &path,
+                    value,
+                    &zk::CreateOptions::new(zk::CreateMode::Persistent, 
self.acl),
+                )
+                .await
+            {
+                Ok(_) => Ok(()),
+                Err(e) => match e {
+                    zk::Error::NoNode => {
+                        let idx = path.rfind('/').unwrap();
+                        let tmpath = path.clone();
+                        path = path.to_string().substring(0, idx).to_string();
+                        if path.as_bytes()[0] != b'/' {
+                            path =
+                                build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(&path));
+                        }
+                        match self.create_nested_node(&path, value).await {
+                            Ok(()) => {}
+                            Err(e) => {
+                                return Err(Error::new(
+                                    ErrorKind::Unexpected,
+                                    "error from zookeeper",
+                                )
+                                .set_source(e))
+                            }
+                        };
+                        match self
+                            .get_connection()
+                            .await?
+                            .create(
+                                &tmpath,
+                                value,
+                                
&zk::CreateOptions::new(zk::CreateMode::Persistent, self.acl),
+                            )
+                            .await
+                        {
+                            Ok(_) => Ok(()),
+                            Err(e) => {
+                                Err(Error::new(ErrorKind::Unexpected, "error 
from zookeeper")
+                                    .set_source(e))
+                            }
+                        }
+                    }
+                    _ => {
+                        Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e))
+                    }
+                },
+            };
+        }
+        .boxed()
+    }
+}
+
+#[async_trait]
+impl kv::Adapter for ZkAdapter {
+    fn metadata(&self) -> kv::Metadata {
+        kv::Metadata::new(
+            Scheme::Zookeeper,
+            "ZooKeeper",

Review Comment:
   @Xuanwo What `kv::Metadata::name` represent for ? I saw "memcached", "TiKV", 
but I also saw `self.addr.as_str()` and `&self.endpoints.join(",")`.



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,
+    /// the password file of the user to connect to zookeeper service, default 
None
+    password: Option<String>,
+}
+
+impl ZookeeperBuilder {
+    /// Set the network addresses of zookeeper service
+    pub fn endpoint(&mut self, endpoint: &str) -> &mut Self {
+        if !endpoint.is_empty() {
+            self.endpoint = Some(endpoint.to_string());
+        }
+        self
+    }
+
+    /// Set the username of zookeeper service
+    pub fn user(&mut self, user: &str) -> &mut Self {
+        if !user.is_empty() {
+            self.user = Some(user.to_string());
+        }
+        self
+    }
+
+    /// Specify the password of zookeeper service
+    pub fn password(&mut self, password: &str) -> &mut Self {
+        if !password.is_empty() {
+            self.password = Some(password.to_string());
+        }
+        self
+    }
+}
+
+impl Debug for ZookeeperBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+        if let Some(endpoint) = self.endpoint.clone() {
+            ds.field("endpoint", &endpoint);
+        }
+        if let Some(user) = self.user.clone() {
+            ds.field("user", &user);
+        }
+        ds.finish()
+    }
+}
+
+impl Builder for ZookeeperBuilder {
+    const SCHEME: Scheme = Scheme::Zookeeper;
+    type Accessor = ZookeeperBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let mut builder = ZookeeperBuilder::default();
+
+        map.get("endpoint").map(|v| builder.endpoint(v));
+        map.get("user").map(|v| builder.user(v));
+        map.get("password").map(|v| builder.password(v));
+
+        builder
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        let endpoint = match self.endpoint.clone() {
+            None => DEFAULT_ZOOKEEPER_ENDPOINT.to_string(),
+            Some(endpoint) => endpoint,
+        };
+        let (auth, acl) = match (self.user.clone(), self.password.clone()) {
+            (Some(user), Some(password)) => {
+                let auth = format!("{user}:{password}").as_bytes().to_vec();
+                (auth, zk::Acl::creator_all())
+            }
+            _ => {
+                warn!("username and password isn't set, default use `anyone` 
acl");
+                (Vec::<u8>::new(), zk::Acl::anyone_all())
+            }
+        };
+
+        Ok(ZookeeperBackend::new(ZkAdapter {
+            endpoint,
+            auth,
+            acl,
+            client: OnceCell::new(),
+        }))
+    }
+}
+
+/// Backend for Zookeeper service
+pub type ZookeeperBackend = kv::Backend<ZkAdapter>;
+
+#[derive(Clone)]
+pub struct ZkAdapter {
+    endpoint: String,
+    auth: Vec<u8>,
+    client: OnceCell<zk::Client>,
+    acl: &'static [zk::Acl],
+}
+
+impl Debug for ZkAdapter {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Adapter");
+        ds.field("endpoint", &self.endpoint);
+        ds.field("acl", &self.acl);
+        ds.finish()
+    }
+}
+
+impl ZkAdapter {
+    async fn get_connection(&self) -> Result<zk::Client> {
+        if let Some(client) = self.client.get() {
+            return Ok(client.clone());
+        }
+        match zk::Client::connect(&self.endpoint.clone()).await {
+            Ok(client) => {
+                if !self.auth.is_empty() {
+                    client
+                        .auth(ZOOKEEPER_AUTH_SCHEME.to_string(), 
self.auth.clone())
+                        .await
+                        .map_err(parse_zookeeper_error)?;
+                }
+                self.client.set(client.clone()).ok();
+                Ok(client)
+            }
+            Err(e) => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+        }
+    }
+
+    fn create_nested_node<'a>(
+        &'a self,
+        path: &'a str,
+        value: &'a [u8],
+    ) -> BoxFuture<'a, Result<()>> {
+        let mut path = path.to_string();
+        async move {
+            return match self
+                .get_connection()
+                .await?
+                .create(
+                    &path,
+                    value,
+                    &zk::CreateOptions::new(zk::CreateMode::Persistent, 
self.acl),
+                )
+                .await
+            {
+                Ok(_) => Ok(()),
+                Err(e) => match e {
+                    zk::Error::NoNode => {
+                        let idx = path.rfind('/').unwrap();
+                        let tmpath = path.clone();
+                        path = path.to_string().substring(0, idx).to_string();
+                        if path.as_bytes()[0] != b'/' {
+                            path =
+                                build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(&path));
+                        }
+                        match self.create_nested_node(&path, value).await {
+                            Ok(()) => {}
+                            Err(e) => {
+                                return Err(Error::new(

Review Comment:
   I saw 
[Error::set_temporary](https://github.com/apache/incubator-opendal/blob/54ffc88aea5f546873735e3fe7fb9c4baa1c6ace/core/src/types/error.rs#L389).
 I think it is a natural fit for `zk::Error::ConnectionLoss`.
   
   Besides this, is it better to enrich the error a bit ?
   
   @Xuanwo Is it better to shape `Error::new` to accept `message: impl 
Into<String>` ? I saw `Error::new(_, &format!(""))`.



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,

Review Comment:
   `username` ? For consistent with `etcd`, `redis`, `webdav` and etc. .



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,
+    /// the password file of the user to connect to zookeeper service, default 
None
+    password: Option<String>,
+}
+
+impl ZookeeperBuilder {
+    /// Set the network addresses of zookeeper service
+    pub fn endpoint(&mut self, endpoint: &str) -> &mut Self {
+        if !endpoint.is_empty() {
+            self.endpoint = Some(endpoint.to_string());
+        }
+        self
+    }
+
+    /// Set the username of zookeeper service
+    pub fn user(&mut self, user: &str) -> &mut Self {
+        if !user.is_empty() {
+            self.user = Some(user.to_string());
+        }
+        self
+    }
+
+    /// Specify the password of zookeeper service
+    pub fn password(&mut self, password: &str) -> &mut Self {
+        if !password.is_empty() {
+            self.password = Some(password.to_string());
+        }
+        self
+    }
+}
+
+impl Debug for ZookeeperBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+        if let Some(endpoint) = self.endpoint.clone() {
+            ds.field("endpoint", &endpoint);
+        }
+        if let Some(user) = self.user.clone() {
+            ds.field("user", &user);
+        }
+        ds.finish()
+    }
+}
+
+impl Builder for ZookeeperBuilder {
+    const SCHEME: Scheme = Scheme::Zookeeper;
+    type Accessor = ZookeeperBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let mut builder = ZookeeperBuilder::default();
+
+        map.get("endpoint").map(|v| builder.endpoint(v));
+        map.get("user").map(|v| builder.user(v));
+        map.get("password").map(|v| builder.password(v));
+
+        builder
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        let endpoint = match self.endpoint.clone() {
+            None => DEFAULT_ZOOKEEPER_ENDPOINT.to_string(),
+            Some(endpoint) => endpoint,
+        };
+        let (auth, acl) = match (self.user.clone(), self.password.clone()) {
+            (Some(user), Some(password)) => {
+                let auth = format!("{user}:{password}").as_bytes().to_vec();
+                (auth, zk::Acl::creator_all())
+            }
+            _ => {
+                warn!("username and password isn't set, default use `anyone` 
acl");
+                (Vec::<u8>::new(), zk::Acl::anyone_all())
+            }
+        };
+
+        Ok(ZookeeperBackend::new(ZkAdapter {
+            endpoint,
+            auth,
+            acl,
+            client: OnceCell::new(),
+        }))
+    }
+}
+
+/// Backend for Zookeeper service
+pub type ZookeeperBackend = kv::Backend<ZkAdapter>;
+
+#[derive(Clone)]
+pub struct ZkAdapter {
+    endpoint: String,
+    auth: Vec<u8>,
+    client: OnceCell<zk::Client>,
+    acl: &'static [zk::Acl],
+}
+
+impl Debug for ZkAdapter {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Adapter");
+        ds.field("endpoint", &self.endpoint);
+        ds.field("acl", &self.acl);
+        ds.finish()
+    }
+}
+
+impl ZkAdapter {
+    async fn get_connection(&self) -> Result<zk::Client> {
+        if let Some(client) = self.client.get() {
+            return Ok(client.clone());
+        }
+        match zk::Client::connect(&self.endpoint.clone()).await {
+            Ok(client) => {
+                if !self.auth.is_empty() {
+                    client
+                        .auth(ZOOKEEPER_AUTH_SCHEME.to_string(), 
self.auth.clone())
+                        .await
+                        .map_err(parse_zookeeper_error)?;
+                }
+                self.client.set(client.clone()).ok();
+                Ok(client)
+            }
+            Err(e) => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+        }
+    }
+
+    fn create_nested_node<'a>(
+        &'a self,
+        path: &'a str,
+        value: &'a [u8],
+    ) -> BoxFuture<'a, Result<()>> {
+        let mut path = path.to_string();
+        async move {
+            return match self
+                .get_connection()
+                .await?
+                .create(
+                    &path,
+                    value,
+                    &zk::CreateOptions::new(zk::CreateMode::Persistent, 
self.acl),
+                )
+                .await
+            {
+                Ok(_) => Ok(()),
+                Err(e) => match e {
+                    zk::Error::NoNode => {
+                        let idx = path.rfind('/').unwrap();
+                        let tmpath = path.clone();
+                        path = path.to_string().substring(0, idx).to_string();
+                        if path.as_bytes()[0] != b'/' {
+                            path =
+                                build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(&path));
+                        }
+                        match self.create_nested_node(&path, value).await {
+                            Ok(()) => {}
+                            Err(e) => {
+                                return Err(Error::new(
+                                    ErrorKind::Unexpected,
+                                    "error from zookeeper",
+                                )
+                                .set_source(e))
+                            }
+                        };
+                        match self
+                            .get_connection()
+                            .await?
+                            .create(
+                                &tmpath,
+                                value,
+                                
&zk::CreateOptions::new(zk::CreateMode::Persistent, self.acl),
+                            )
+                            .await
+                        {
+                            Ok(_) => Ok(()),
+                            Err(e) => {
+                                Err(Error::new(ErrorKind::Unexpected, "error 
from zookeeper")
+                                    .set_source(e))
+                            }
+                        }
+                    }
+                    _ => {
+                        Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e))
+                    }
+                },
+            };
+        }
+        .boxed()
+    }
+}
+
+#[async_trait]
+impl kv::Adapter for ZkAdapter {
+    fn metadata(&self) -> kv::Metadata {
+        kv::Metadata::new(
+            Scheme::Zookeeper,
+            "ZooKeeper",
+            Capability {
+                read: true,
+                write: true,
+                ..Default::default()

Review Comment:
   How about `delete` and `list`(e.g. `Adapter::scan` ? @Xuanwo ) ? It would be 
frustrated to create things with no way to delete/inspect them.
   
   Comparing to kv services, ZooKeeper is more like traditional file system as 
its [nodes are organized as 
tree](https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-server/src/main/java/org/apache/zookeeper/server/DataNode.java#L62)
 and has [`Stat` for each 
node](https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-jute/src/main/resources/zookeeper.jute#L28).
   
   * For `delete`, it has same limitation as filesystem, `delete` will fail on 
non empty directory. 
   * For `list`, ZooKeeper does not work well with [large number of 
children](https://issues.apache.org/jira/browse/ZOOKEEPER-272). I guess it 
won't be an issue here.
   
   PS: I saw tikv overrides `delete` but without `delete: true`.



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,305 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::io;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,
+    /// the path to the password file of the user to connect to zookeeper 
service, default None
+    digest_path: Option<String>,
+}
+
+impl ZookeeperBuilder {
+    /// Set the network addresses of zookeeper service
+    pub fn endpoint(&mut self, endpoint: &str) -> &mut Self {
+        if !endpoint.is_empty() {
+            self.endpoint = Some(endpoint.to_string());
+        }
+        self
+    }
+
+    /// Set the username of zookeeper service
+    pub fn user(&mut self, user: &str) -> &mut Self {
+        if !user.is_empty() {
+            self.user = Some(user.to_string());
+        }
+        self
+    }
+
+    /// Specify the auth digest path of zookeeper service
+    pub fn digest_path(&mut self, digest_path: &str) -> &mut Self {
+        if !digest_path.is_empty() {
+            self.digest_path = Some(digest_path.to_string());
+        }
+        self
+    }
+}
+
+impl Debug for ZookeeperBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+        if let Some(endpoint) = self.endpoint.clone() {
+            ds.field("endpoint", &endpoint);
+        }
+        if let Some(user) = self.user.clone() {
+            ds.field("user", &user);
+        }
+        if let Some(digest_path) = self.digest_path.clone() {
+            ds.field("digest_path", &digest_path);
+        }
+        ds.finish()
+    }
+}
+
+impl Builder for ZookeeperBuilder {
+    const SCHEME: Scheme = Scheme::Zookeeper;
+    type Accessor = ZookeeperBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let mut builder = ZookeeperBuilder::default();
+
+        map.get("endpoint").map(|v| builder.endpoint(v));
+        map.get("user").map(|v| builder.user(v));
+        map.get("digest_path").map(|v| builder.digest_path(v));
+
+        builder
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        let endpoint = match self.endpoint.clone() {
+            None => DEFAULT_ZOOKEEPER_ENDPOINT.to_string(),
+            Some(endpoint) => endpoint,
+        };
+        let (auth, acl) = match (self.user.clone(), self.digest_path.clone()) {
+            (Some(user), Some(digest_path)) => {
+                let password = 
std::fs::read(digest_path).map_err(parse_file_error)?;
+                let auth = [format!("{user}:").as_bytes().to_vec(), 
password].concat();
+                (auth, zk::Acl::creator_all())
+            }
+            _ => {
+                // TODO: change to warn
+                warn!("username and password isn't set, default use `anyone` 
acl");
+                (Vec::<u8>::new(), zk::Acl::anyone_all())
+            }
+        };
+
+        Ok(ZookeeperBackend::new(ZkAdapter {
+            endpoint,
+            auth,
+            acl,
+            client: OnceCell::new(),
+        }))
+    }
+}
+
+/// Backend for Zookeeper service
+pub type ZookeeperBackend = kv::Backend<ZkAdapter>;
+
+#[derive(Clone)]
+pub struct ZkAdapter {
+    endpoint: String,
+    auth: Vec<u8>,
+    client: OnceCell<zk::Client>,
+    acl: &'static [zk::Acl],
+}
+
+impl Debug for ZkAdapter {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Adapter");
+        ds.field("endpoint", &self.endpoint);
+        ds.field("acl", &self.acl);
+        ds.finish()
+    }
+}
+
+impl ZkAdapter {
+    async fn get_connection(&self) -> Result<zk::Client> {
+        if let Some(client) = self.client.get() {
+            return Ok(client.clone());
+        }
+        match zk::Client::connect(&self.endpoint.clone()).await {
+            Ok(client) => {
+                if !self.auth.is_empty() {
+                    client
+                        .auth(ZOOKEEPER_AUTH_SCHEME.to_string(), 
self.auth.clone())
+                        .await
+                        .map_err(parse_zookeeper_error)?;
+                }
+                self.client.set(client.clone()).ok();
+                Ok(client)
+            }
+            Err(e) => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+        }
+    }
+
+    fn create_nested_node<'a>(

Review Comment:
   I guess it is this form cause of recursion. I have a [similar version using 
loop](https://github.com/kezhuw/zookeeper-client-rust/blob/04385bf927c5dca6fc0957d6805b3e956d462a95/src/client/mod.rs#L918C14-L918C38).
 Hope it could help @Murphy-OrangeMud .
   
   PS: I think I should port some convenient methods from java world.



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,214 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::cell::OnceCell;
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,

Review Comment:
   It is traditional for ZooKeeper to reach a cluster using "host1,host2". I 
will write a test cluster in "zookeeper-client" crate to assert this, I was 
fearing to bootstrap a cluster in test case 😮‍💨 .
   
   I saw similar from [etcd with 
`endpoints`](https://github.com/apache/incubator-opendal/blob/54ffc88aea5f546873735e3fe7fb9c4baa1c6ace/core/src/services/etcd/backend.rs#L47)
 and [redis with 
`cluster_endpoints`](https://github.com/apache/incubator-opendal/blob/54ffc88aea5f546873735e3fe7fb9c4baa1c6ace/core/src/services/redis/backend.rs#L53).
 A rebalanced dns should also work in nature.
   
   * ZooKeeper connection string: 
https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java#L761



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder

Review Comment:
   Shall we document the limitations of this backend ?
   
   ZooKeeper, as an aged CP system, does not work well as file backend though 
its node hierarchy is shaped like a tree. I list some of notables here for what 
I know.
   1. [Data node size limitation is 
1MiB](https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java#L1393).
   2. Does not work well when `list` directory with [large number of 
children](https://issues.apache.org/jira/browse/ZOOKEEPER-272).
   
   The first might be crucial.



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,214 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::cell::OnceCell;
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,

Review Comment:
   Besides this, I think we should support two more options for custom.
   
   1. Session timeout is [mandatory in Java 
world](https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java#L447)
 and  is important enough to gain attention as session expired is a terminal 
state. All operations will fail after session expired.
   2. `root`. I saw it in `etcd` and `redis`. It is also attractive to have in 
zookeeper. Though, caller can specify a `chroot` in connection string, but it 
might be less well-known and `chroot` are [supposed to be 
exist](https://issues.apache.org/jira/browse/KAFKA-404).



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,297 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+use tokio::sync::OnceCell;
+
+use crate::raw::build_rooted_abs_path;
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+use futures::future::{BoxFuture, FutureExt};
+use substring::Substring;
+
+use log::warn;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+/// Zookeeper backend builder
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,
+    /// the user to connect to zookeeper service, default None
+    user: Option<String>,
+    /// the password file of the user to connect to zookeeper service, default 
None
+    password: Option<String>,
+}
+
+impl ZookeeperBuilder {
+    /// Set the network addresses of zookeeper service
+    pub fn endpoint(&mut self, endpoint: &str) -> &mut Self {
+        if !endpoint.is_empty() {
+            self.endpoint = Some(endpoint.to_string());
+        }
+        self
+    }
+
+    /// Set the username of zookeeper service
+    pub fn user(&mut self, user: &str) -> &mut Self {
+        if !user.is_empty() {
+            self.user = Some(user.to_string());
+        }
+        self
+    }
+
+    /// Specify the password of zookeeper service
+    pub fn password(&mut self, password: &str) -> &mut Self {
+        if !password.is_empty() {
+            self.password = Some(password.to_string());
+        }
+        self
+    }
+}
+
+impl Debug for ZookeeperBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+        if let Some(endpoint) = self.endpoint.clone() {
+            ds.field("endpoint", &endpoint);
+        }
+        if let Some(user) = self.user.clone() {
+            ds.field("user", &user);
+        }
+        ds.finish()
+    }
+}
+
+impl Builder for ZookeeperBuilder {
+    const SCHEME: Scheme = Scheme::Zookeeper;
+    type Accessor = ZookeeperBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let mut builder = ZookeeperBuilder::default();
+
+        map.get("endpoint").map(|v| builder.endpoint(v));
+        map.get("user").map(|v| builder.user(v));
+        map.get("password").map(|v| builder.password(v));
+
+        builder
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        let endpoint = match self.endpoint.clone() {
+            None => DEFAULT_ZOOKEEPER_ENDPOINT.to_string(),
+            Some(endpoint) => endpoint,
+        };
+        let (auth, acl) = match (self.user.clone(), self.password.clone()) {
+            (Some(user), Some(password)) => {
+                let auth = format!("{user}:{password}").as_bytes().to_vec();
+                (auth, zk::Acl::creator_all())
+            }
+            _ => {
+                warn!("username and password isn't set, default use `anyone` 
acl");
+                (Vec::<u8>::new(), zk::Acl::anyone_all())
+            }
+        };
+
+        Ok(ZookeeperBackend::new(ZkAdapter {
+            endpoint,
+            auth,
+            acl,
+            client: OnceCell::new(),
+        }))
+    }
+}
+
+/// Backend for Zookeeper service
+pub type ZookeeperBackend = kv::Backend<ZkAdapter>;
+
+#[derive(Clone)]
+pub struct ZkAdapter {
+    endpoint: String,
+    auth: Vec<u8>,
+    client: OnceCell<zk::Client>,
+    acl: &'static [zk::Acl],
+}
+
+impl Debug for ZkAdapter {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Adapter");
+        ds.field("endpoint", &self.endpoint);
+        ds.field("acl", &self.acl);
+        ds.finish()
+    }
+}
+
+impl ZkAdapter {
+    async fn get_connection(&self) -> Result<zk::Client> {
+        if let Some(client) = self.client.get() {
+            return Ok(client.clone());
+        }
+        match zk::Client::connect(&self.endpoint.clone()).await {
+            Ok(client) => {
+                if !self.auth.is_empty() {
+                    client
+                        .auth(ZOOKEEPER_AUTH_SCHEME.to_string(), 
self.auth.clone())
+                        .await
+                        .map_err(parse_zookeeper_error)?;
+                }
+                self.client.set(client.clone()).ok();
+                Ok(client)
+            }
+            Err(e) => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+        }
+    }
+
+    fn create_nested_node<'a>(
+        &'a self,
+        path: &'a str,
+        value: &'a [u8],
+    ) -> BoxFuture<'a, Result<()>> {
+        let mut path = path.to_string();
+        async move {
+            return match self
+                .get_connection()
+                .await?
+                .create(
+                    &path,
+                    value,
+                    &zk::CreateOptions::new(zk::CreateMode::Persistent, 
self.acl),
+                )
+                .await
+            {
+                Ok(_) => Ok(()),
+                Err(e) => match e {
+                    zk::Error::NoNode => {
+                        let idx = path.rfind('/').unwrap();
+                        let tmpath = path.clone();
+                        path = path.to_string().substring(0, idx).to_string();
+                        if path.as_bytes()[0] != b'/' {
+                            path =
+                                build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(&path));
+                        }
+                        match self.create_nested_node(&path, value).await {
+                            Ok(()) => {}
+                            Err(e) => {
+                                return Err(Error::new(
+                                    ErrorKind::Unexpected,
+                                    "error from zookeeper",
+                                )
+                                .set_source(e))
+                            }
+                        };
+                        match self
+                            .get_connection()
+                            .await?
+                            .create(
+                                &tmpath,
+                                value,
+                                
&zk::CreateOptions::new(zk::CreateMode::Persistent, self.acl),
+                            )
+                            .await
+                        {
+                            Ok(_) => Ok(()),
+                            Err(e) => {
+                                Err(Error::new(ErrorKind::Unexpected, "error 
from zookeeper")
+                                    .set_source(e))
+                            }
+                        }
+                    }
+                    _ => {
+                        Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e))
+                    }
+                },
+            };
+        }
+        .boxed()
+    }
+}
+
+#[async_trait]
+impl kv::Adapter for ZkAdapter {
+    fn metadata(&self) -> kv::Metadata {
+        kv::Metadata::new(
+            Scheme::Zookeeper,
+            "ZooKeeper",
+            Capability {
+                read: true,
+                write: true,
+                ..Default::default()
+            },
+        )
+    }
+
+    async fn get(&self, path: &str) -> Result<Option<Vec<u8>>> {
+        let path = build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(path));
+        match self.get_connection().await?.get_data(&path).await {
+            Ok(data) => Ok(Some(data.0)),
+            Err(e) => match e {
+                zk::Error::NoNode => Ok(None),
+                _ => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+            },
+        }
+    }
+
+    async fn set(&self, path: &str, value: &[u8]) -> Result<()> {
+        let path = build_rooted_abs_path("/", 
path.strip_suffix('/').unwrap_or(path));
+        match self
+            .get_connection()
+            .await?
+            .set_data(&path, value, None)
+            .await
+        {
+            Ok(_) => Ok(()),
+            Err(e) => match e {
+                zk::Error::NoNode => {
+                    return self.create_nested_node(&path, value).await;
+                }
+                _ => Err(Error::new(ErrorKind::Unexpected, "error from 
zookeeper").set_source(e)),
+            },
+        }
+    }
+
+    async fn delete(&self, path: &str) -> Result<()> {

Review Comment:
   Hmm, I saw this, but not `delete: true`. Do we need `rm -r` semantic here 
@Xuanwo  ?



##########
core/src/services/zookeeper/backend.rs:
##########
@@ -0,0 +1,214 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::cell::OnceCell;
+use std::collections::HashMap;
+use zookeeper_client as zk;
+
+use crate::raw::adapters::kv;
+use crate::Scheme;
+use async_trait::async_trait;
+
+use crate::Builder;
+use crate::Error;
+use crate::ErrorKind;
+use crate::*;
+
+use std::fmt::Debug;
+use std::fmt::Formatter;
+
+const DEFAULT_ZOOKEEPER_ENDPOINT: &str = "127.0.0.1:2181";
+/// The scheme for zookeeper authentication
+/// currently we do not support sasl authentication
+const ZOOKEEPER_AUTH_SCHEME: &str = "digest";
+
+#[derive(Clone, Default)]
+pub struct ZookeeperBuilder {
+    /// network address of the Zookeeper service
+    /// Default: 127.0.0.1:2181
+    endpoint: Option<String>,

Review Comment:
   It is traditional for ZooKeeper to reach a cluster using "host1,host2". I 
will write a test cluster in "zookeeper-client" crate to assert this, I was 
fearing to bootstrap a cluster in test case 😮‍💨 .
   
   I saw similar from [etcd with 
`endpoints`](https://github.com/apache/incubator-opendal/blob/54ffc88aea5f546873735e3fe7fb9c4baa1c6ace/core/src/services/etcd/backend.rs#L47)
 and [redis with 
`cluster_endpoints`](https://github.com/apache/incubator-opendal/blob/54ffc88aea5f546873735e3fe7fb9c4baa1c6ace/core/src/services/redis/backend.rs#L53).
 A rebalanced dns should also work in nature.
   
   * ZooKeeper connection string: 
https://github.com/apache/zookeeper/blob/bc0e61854ca362261d899295422ac14dd5d82e59/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java#L761



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to