This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 65aa8fe6f docs: add service doc for etcd & dropbox & foundationdb & 
moka (#2986)
65aa8fe6f is described below

commit 65aa8fe6fe2d5600689b6f9e536d56c17ff21bd3
Author: G-XD <[email protected]>
AuthorDate: Thu Aug 31 15:30:13 2023 +0800

    docs: add service doc for etcd & dropbox & foundationdb & moka (#2986)
    
    * docs: add service doc for etcd
    
    * docs: add service doc for dropbox
    
    * docs: add service doc for foundationdb
    
    * docs: add service doc for moka
---
 core/src/services/dropbox/builder.rs      | 68 +----------------------------
 core/src/services/dropbox/docs.md         | 64 +++++++++++++++++++++++++++
 core/src/services/etcd/docs.md            |  2 +-
 core/src/services/foundationdb/backend.rs |  2 +-
 core/src/services/foundationdb/docs.md    |  3 +-
 core/src/services/moka/docs.md            | 30 +++++++++++++
 website/docs/services/dropbox.mdx         | 66 ++++++++++++++++++++++++++++
 website/docs/services/etcd.mdx            | 72 +++++++++++++++++++++++++++++++
 website/docs/services/foundationdb.mdx    | 66 ++++++++++++++++++++++++++++
 website/docs/services/moka.mdx            | 63 +++++++++++++++++++++++++++
 10 files changed, 366 insertions(+), 70 deletions(-)

diff --git a/core/src/services/dropbox/builder.rs 
b/core/src/services/dropbox/builder.rs
index 42711b210..d80f705e6 100644
--- a/core/src/services/dropbox/builder.rs
+++ b/core/src/services/dropbox/builder.rs
@@ -31,73 +31,7 @@ use crate::raw::*;
 use crate::*;
 
 /// [Dropbox](https://www.dropbox.com/) backend support.
-///
-/// # Capabilities
-///
-/// This service can be used to:
-///
-/// - [x] read
-/// - [x] write
-/// - [x] delete
-/// - [x] create_dir
-/// - [ ] list
-/// - [ ] copy
-/// - [ ] rename
-/// - [x] batch
-///
-/// # Notes
-///
-///
-/// # Configuration
-///
-/// - `root`: Set the work directory for this backend.
-///
-/// ## Credentials related
-///
-/// ### Just provide Access Token (Temporary)
-///
-/// - `access_token`: set the access_token for this backend.
-/// Please notice its expiration.
-///
-/// ### Or provide Client ID and Client Secret and refresh token (Long Term)
-///
-/// If you want to let OpenDAL to refresh the access token automatically,
-/// please provide the following fields:
-///
-/// - `refresh_token`: set the refresh_token for dropbox api
-/// - `client_id`: set the client_id for dropbox api
-/// - `client_secret`: set the client_secret for dropbox api
-///
-/// OpenDAL is a library, it cannot do the first step of OAuth2 for you.
-/// You need to get authorization code from user by calling Dropbox's 
authorize url
-/// and exchange it for refresh token.
-///
-/// Please refer to [Dropbox OAuth2 
Guide](https://www.dropbox.com/developers/reference/oauth-guide)
-/// for more information.
-///
-/// You can refer to [`DropboxBuilder`]'s docs for more information.
-///
-/// # Example
-///
-/// ## Via Builder
-///
-/// ```rust
-/// use anyhow::Result;
-/// use opendal::raw::OpWrite;
-/// use opendal::services::Dropbox;
-/// use opendal::Operator;
-///
-/// #[tokio::main]
-/// async fn main() -> Result<()> {
-///     let mut builder = Dropbox::default();
-///     builder.root("/test");
-///     builder.access_token("<token>");
-///
-///     let op: Operator = Operator::new(builder)?.finish();
-///     Ok(())
-/// }
-/// ```
-
+#[doc = include_str!("docs.md")]
 #[derive(Default)]
 pub struct DropboxBuilder {
     root: Option<String>,
diff --git a/core/src/services/dropbox/docs.md 
b/core/src/services/dropbox/docs.md
new file mode 100644
index 000000000..c84ac4615
--- /dev/null
+++ b/core/src/services/dropbox/docs.md
@@ -0,0 +1,64 @@
+## Capabilities
+
+This service can be used to:
+
+- [x] stat
+- [x] read
+- [x] write
+- [x] create_dir
+- [x] delete
+- [ ] copy
+- [ ] rename
+- [ ] list
+- [x] batch
+- [ ] blocking
+
+## Configuration
+
+- `root`: Set the work directory for this backend.
+
+### Credentials related
+
+#### Just provide Access Token (Temporary)
+
+- `access_token`: set the access_token for this backend.
+Please notice its expiration.
+
+#### Or provide Client ID and Client Secret and refresh token (Long Term)
+
+If you want to let OpenDAL to refresh the access token automatically,
+please provide the following fields:
+
+- `refresh_token`: set the refresh_token for dropbox api
+- `client_id`: set the client_id for dropbox api
+- `client_secret`: set the client_secret for dropbox api
+
+OpenDAL is a library, it cannot do the first step of OAuth2 for you.
+You need to get authorization code from user by calling Dropbox's authorize url
+and exchange it for refresh token.
+
+Please refer to [Dropbox OAuth2 
Guide](https://www.dropbox.com/developers/reference/oauth-guide)
+for more information.
+
+You can refer to [`DropboxBuilder`]'s docs for more information
+
+## Example
+
+### Via Builder
+
+```rust
+use anyhow::Result;
+use opendal::raw::OpWrite;
+use opendal::services::Dropbox;
+use opendal::Operator;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut builder = Dropbox::default();
+    builder.root("/opendal");
+    builder.access_token("<token>");
+
+    let op: Operator = Operator::new(builder)?.finish();
+    Ok(())
+}
+```
diff --git a/core/src/services/etcd/docs.md b/core/src/services/etcd/docs.md
index affbad71d..5a798998f 100644
--- a/core/src/services/etcd/docs.md
+++ b/core/src/services/etcd/docs.md
@@ -18,7 +18,7 @@ This service can be used to:
 
 - `root`: Set the working directory of `OpenDAL`
 - `endpoints`: Set the network address of etcd servers
-- `username`: Set the username of Redis
+- `username`: Set the username of Etcd
 - `password`: Set the password for authentication
 - `ca_path`: Set the ca path to the etcd connection
 - `cert_path`: Set the cert path to the etcd connection
diff --git a/core/src/services/foundationdb/backend.rs 
b/core/src/services/foundationdb/backend.rs
index 9cf2cdf87..7b49f031c 100644
--- a/core/src/services/foundationdb/backend.rs
+++ b/core/src/services/foundationdb/backend.rs
@@ -32,7 +32,7 @@ use crate::ErrorKind;
 use crate::Scheme;
 use crate::*;
 
-/// Foundationdb service support.
+/// [foundationdb](https://www.foundationdb.org/) service support.
 #[doc = include_str!("docs.md")]
 #[derive(Default)]
 pub struct FoundationdbBuilder {
diff --git a/core/src/services/foundationdb/docs.md 
b/core/src/services/foundationdb/docs.md
index fd75fd41f..f05488396 100644
--- a/core/src/services/foundationdb/docs.md
+++ b/core/src/services/foundationdb/docs.md
@@ -12,12 +12,13 @@ This service can be used to:
 - [ ] ~~list~~
 - [ ] scan
 - [ ] ~~presign~~
-- [] blocking
+- [ ] blocking
 
 **Note**: As for [Known Limitations - 
FoundationDB](https://apple.github.io/foundationdb/known-limitations), keys 
cannot exceed 10,000 bytes in size, and values cannot exceed 100,000 bytes in 
size. Errors will be raised by OpenDAL if these limits are exceeded.
 
 ## Configuration
 
+- `root`: Set the work directory for this backend.
 - `config_path`: Set the configuration path for foundationdb. If not provided, 
the default configuration path will be used.
 
 You can refer to [`FoundationdbBuilder`]'s docs for more information
diff --git a/core/src/services/moka/docs.md b/core/src/services/moka/docs.md
index 89546b9c9..1c5e3e827 100644
--- a/core/src/services/moka/docs.md
+++ b/core/src/services/moka/docs.md
@@ -13,3 +13,33 @@ This service can be used to:
 - [x] scan
 - [ ] presign
 - [ ] blocking
+
+## Configuration
+
+- `name`: Set the name for this cache instance.
+- `max_capacity`: Set the max capacity of the cache.
+- `time_to_live`: Set the time to live of the cache.
+- `time_to_idle`: Set the time to idle of the cache.
+- `num_segments`: Set the segments number of the cache.
+- `thread_pool_enabled`: Decides whether to enable thread pool of the cache.
+
+You can refer to [`MokaBuilder`]'s docs for more information
+
+## Example
+
+### Via Builder
+
+```rust
+use anyhow::Result;
+use opendal::services::Moka;
+use opendal::Operator;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut builder = Moka::default();
+    builder.name("opendal");
+
+    let op: Operator = Operator::new(builder)?.finish();
+    Ok(())
+}
+```
diff --git a/website/docs/services/dropbox.mdx 
b/website/docs/services/dropbox.mdx
new file mode 100644
index 000000000..6b04605aa
--- /dev/null
+++ b/website/docs/services/dropbox.mdx
@@ -0,0 +1,66 @@
+---
+title: Dropbox
+---
+
+[Dropbox](https://www.dropbox.com/) services support.
+
+import Docs from '../../../core/src/services/dropbox/docs.md'
+
+<Docs components={props.components} />
+
+### Via Config
+
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+  <TabItem value="rust" label="Rust" default>
+
+```rust
+use anyhow::Result;
+use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut map = HashMap::new();
+    map.insert("root".to_string(), "/path/to/dir".to_string());
+    map.insert("access_token".to_string(), "your_access_token".to_string());
+
+    let op: Operator = Operator::via_map(Scheme::Dropbox, map)?;
+    Ok(())
+}
+```
+
+  </TabItem>
+  <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from "opendal";
+
+async function main() {
+  const op = new Operator("dropbox", {
+    root: "/path/to/dir",
+    access_token: "your_access_token",
+  });
+}
+```
+
+  </TabItem>
+  <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("dropbox",
+  root="/path/to/dir",
+  access_token="your_access_token",
+)
+```
+
+  </TabItem>
+</Tabs>
+
+
diff --git a/website/docs/services/etcd.mdx b/website/docs/services/etcd.mdx
new file mode 100644
index 000000000..e0ca963a7
--- /dev/null
+++ b/website/docs/services/etcd.mdx
@@ -0,0 +1,72 @@
+---
+title: Etcd
+---
+
+[Etcd](https://etcd.io/) services support.
+
+import Docs from '../../../core/src/services/etcd/docs.md'
+
+<Docs components={props.components} />
+
+### Via Config
+
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+  <TabItem value="rust" label="Rust" default>
+
+```rust
+use anyhow::Result;
+use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut map = HashMap::new();
+    map.insert("root".to_string(), "/path/to/dir".to_string());
+    map.insert("endpoints".to_string(), "http://127.0.0.1:2379".to_string());
+    map.insert("username".to_string(), "your_username".to_string());
+    map.insert("password".to_string(), "your_password".to_string());
+
+    let op: Operator = Operator::via_map(Scheme::Etcd, map)?;
+    Ok(())
+}
+```
+
+  </TabItem>
+  <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from "opendal";
+
+async function main() {
+  const op = new Operator("etcd", {
+    root: "/path/to/dir",
+    endpoint: "http://127.0.0.1:2379";,
+    username: "your_username",
+    password: "your_password",
+  });
+}
+```
+
+  </TabItem>
+  <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("etcd",
+  root="/path/to/dir",
+  endpoint="http://127.0.0.1:2379";,
+  username="your_username",
+  password="your_password",
+)
+```
+
+  </TabItem>
+</Tabs>
+
+
diff --git a/website/docs/services/foundationdb.mdx 
b/website/docs/services/foundationdb.mdx
new file mode 100644
index 000000000..b148ec2ed
--- /dev/null
+++ b/website/docs/services/foundationdb.mdx
@@ -0,0 +1,66 @@
+---
+title: FoundationDB
+---
+
+[FoundationDB](https://www.foundationdb.org/) services support.
+
+import Docs from '../../../core/src/services/foundationdb/docs.md'
+
+<Docs components={props.components} />
+
+### Via Config
+
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+  <TabItem value="rust" label="Rust" default>
+
+```rust
+use anyhow::Result;
+use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut map = HashMap::new();
+    map.insert("root".to_string(), "/path/to/dir".to_string());
+    map.insert("config_path".to_string(), "/path/to/config".to_string());
+
+    let op: Operator = Operator::via_map(Scheme::Foundationdb, map)?;
+    Ok(())
+}
+```
+
+  </TabItem>
+  <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from "opendal";
+
+async function main() {
+  const op = new Operator("foundationdb", {
+    root: "/path/to/dir",
+    config_path: "/path/to/config",
+  });
+}
+```
+
+  </TabItem>
+  <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("foundationdb",
+  root="/path/to/dir",
+  config_path="/path/to/config",
+)
+```
+
+  </TabItem>
+</Tabs>
+
+
diff --git a/website/docs/services/moka.mdx b/website/docs/services/moka.mdx
new file mode 100644
index 000000000..8c8f42850
--- /dev/null
+++ b/website/docs/services/moka.mdx
@@ -0,0 +1,63 @@
+---
+title: Moka
+---
+
+[Moka](https://github.com/moka-rs/moka) services support.
+
+import Docs from '../../../core/src/services/moka/docs.md'
+
+<Docs components={props.components} />
+
+### Via Config
+
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+<Tabs>
+  <TabItem value="rust" label="Rust" default>
+
+```rust
+use anyhow::Result;
+use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let mut map = HashMap::new();
+    map.insert("name".to_string(), "your_cache_name".to_string());
+
+    let op: Operator = Operator::via_map(Scheme::Moka, map)?;
+    Ok(())
+}
+```
+
+  </TabItem>
+  <TabItem value="node.js" label="Node.js">
+
+```javascript
+import { Operator } from "opendal";
+
+async function main() {
+  const op = new Operator("moka", {
+    name: "your_cache_name",
+  });
+}
+```
+
+  </TabItem>
+  <TabItem value="python" label="Python">
+
+```python
+import opendal
+
+op = opendal.Operator("moka",
+  name="your_cache_name",
+)
+```
+
+  </TabItem>
+</Tabs>
+
+

Reply via email to