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 92ab09451 docs: add service doc for gcs (#2930)
92ab09451 is described below
commit 92ab09451b4b42d116cea1865263f86300244545
Author: Mingzhuo Yin <[email protected]>
AuthorDate: Fri Aug 25 11:15:51 2023 +0800
docs: add service doc for gcs (#2930)
Signed-off-by: silver-ymz <[email protected]>
---
core/src/services/gcs/backend.rs | 61 +-----------------------------
core/src/services/gcs/docs.md | 57 ++++++++++++++++++++++++++++
website/docs/services/azblob.mdx | 5 +--
website/docs/services/azdfs.mdx | 5 +--
website/docs/services/cos.mdx | 5 +--
website/docs/services/fs.mdx | 5 +--
website/docs/services/ftp.mdx | 5 +--
website/docs/services/{oss.mdx => gcs.mdx} | 48 ++++++++++-------------
website/docs/services/hdfs.mdx | 5 +--
website/docs/services/ipfs.mdx | 5 +--
website/docs/services/memory.mdx | 5 +--
website/docs/services/oss.mdx | 5 +--
website/docs/services/redis.mdx | 5 +--
website/docs/services/rocksdb.mdx | 5 +--
website/docs/services/s3.mdx | 5 +--
website/docs/services/sftp.mdx | 5 +--
website/docs/services/sled.mdx | 5 +--
website/docs/services/webhdfs.mdx | 5 +--
18 files changed, 110 insertions(+), 131 deletions(-)
diff --git a/core/src/services/gcs/backend.rs b/core/src/services/gcs/backend.rs
index 62470ab24..dd402d7f6 100644
--- a/core/src/services/gcs/backend.rs
+++ b/core/src/services/gcs/backend.rs
@@ -42,65 +42,8 @@ const DEFAULT_GCS_ENDPOINT: &str =
"https://storage.googleapis.com";
const DEFAULT_GCS_SCOPE: &str =
"https://www.googleapis.com/auth/devstorage.read_write";
/// It's recommended that you use at least 8 MiB for the chunk size.
const DEFAULT_WRITE_FIXED_SIZE: usize = 8 * 1024 * 1024;
-/// Google Cloud Storage service.
-///
-/// # Capabilities
-///
-/// This service can be used to:
-///
-/// - [x] stat
-/// - [x] read
-/// - [x] write
-/// - [x] create_dir
-/// - [x] delete
-/// - [x] copy
-/// - [ ] rename
-/// - [x] list
-/// - [x] scan
-/// - [x] presign
-/// - [ ] blocking
-///
-/// # Configuration
-///
-/// - `root`: Set the work directory for backend
-/// - `bucket`: Set the container name for backend
-/// - `endpoint`: Customizable endpoint setting
-/// - `credentials`: Credential string for GCS OAuth2
-/// - `predefined_acl`: Predefined ACL for GCS
-/// - `default_storage_class`: Default storage class for GCS
-///
-/// You can refer to [`GcsBuilder`]'s docs for more information
-///
-/// # Example
-///
-/// ## Via Builder
-///
-/// ```no_run
-/// use anyhow::Result;
-/// use opendal::services::Gcs;
-/// use opendal::Operator;
-///
-/// #[tokio::main]
-/// async fn main() -> Result<()> {
-/// // create backend builder
-/// let mut builder = Gcs::default();
-///
-/// // set the storage bucket for OpenDAL
-/// builder.bucket("test");
-/// // set the working directory root for GCS
-/// // all operations will happen within it
-/// builder.root("/path/to/dir");
-/// // set the credentials for GCS OAUTH2 authentication
-/// builder.credential("authentication token");
-/// // set the predefined ACL for GCS
-/// builder.predefined_acl("publicRead");
-/// // set the default storage class for GCS
-/// builder.default_storage_class("STANDARD");
-///
-/// let op: Operator = Operator::new(builder)?.finish();
-/// Ok(())
-/// }
-/// ```
+
+/// [Google Cloud Storage](https://cloud.google.com/storage) services support.
#[derive(Default)]
pub struct GcsBuilder {
/// root URI, all operations happens under `root`
diff --git a/core/src/services/gcs/docs.md b/core/src/services/gcs/docs.md
new file mode 100644
index 000000000..6b9fd62ee
--- /dev/null
+++ b/core/src/services/gcs/docs.md
@@ -0,0 +1,57 @@
+## Capabilities
+
+This service can be used to:
+
+- [x] stat
+- [x] read
+- [x] write
+- [x] create_dir
+- [x] delete
+- [x] copy
+- [ ] rename
+- [x] list
+- [x] scan
+- [x] presign
+- [ ] blocking
+
+## Configuration
+
+- `root`: Set the work directory for backend
+- `bucket`: Set the container name for backend
+- `endpoint`: Customizable endpoint setting
+- `credentials`: Credential string for GCS OAuth2
+- `predefined_acl`: Predefined ACL for GCS
+- `default_storage_class`: Default storage class for GCS
+
+Refer to public API docs for more information.
+
+## Example
+
+### Via Builder
+
+```rust
+use anyhow::Result;
+use opendal::services::Gcs;
+use opendal::Operator;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+ // create backend builder
+ let mut builder = Gcs::default();
+
+ // set the storage bucket for OpenDAL
+ builder.bucket("test");
+ // set the working directory root for GCS
+ // all operations will happen within it
+ builder.root("/path/to/dir");
+ // set the credentials for GCS OAUTH2 authentication
+ builder.credential("authentication token");
+ // set the predefined ACL for GCS
+ builder.predefined_acl("publicRead");
+ // set the default storage class for GCS
+ builder.default_storage_class("STANDARD");
+
+ let op: Operator = Operator::new(builder)?.finish();
+ Ok(())
+}
+```
\ No newline at end of file
diff --git a/website/docs/services/azblob.mdx b/website/docs/services/azblob.mdx
index 7a3e31286..53ebe3ce8 100644
--- a/website/docs/services/azblob.mdx
+++ b/website/docs/services/azblob.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/azdfs.mdx b/website/docs/services/azdfs.mdx
index cb5b1466b..b87547147 100644
--- a/website/docs/services/azdfs.mdx
+++ b/website/docs/services/azdfs.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/cos.mdx b/website/docs/services/cos.mdx
index b0c7012fe..012a7fb79 100644
--- a/website/docs/services/cos.mdx
+++ b/website/docs/services/cos.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/fs.mdx b/website/docs/services/fs.mdx
index 851addb59..46707cbd3 100644
--- a/website/docs/services/fs.mdx
+++ b/website/docs/services/fs.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/ftp.mdx b/website/docs/services/ftp.mdx
index d25ccd9f5..6bb870dbe 100644
--- a/website/docs/services/ftp.mdx
+++ b/website/docs/services/ftp.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/oss.mdx b/website/docs/services/gcs.mdx
similarity index 51%
copy from website/docs/services/oss.mdx
copy to website/docs/services/gcs.mdx
index c97762ae9..68db48d7d 100644
--- a/website/docs/services/oss.mdx
+++ b/website/docs/services/gcs.mdx
@@ -1,14 +1,13 @@
---
-title: OSS
+title: Gcs
---
-Aliyun Object Storage Service (OSS) support.
+Google Cloud Storage Support
-import Docs from '../../../core/src/services/oss/docs.md'
+import Docs from '../../../core/src/services/gcs/docs.md'
<Docs components={props.components} />
-
### Via Config
import Tabs from '@theme/Tabs';
@@ -18,22 +17,20 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
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("bucket".to_string(), "test".to_string());
- map.insert("endpoint".to_string(),
"https://oss-cn-beijing.aliyuncs.com".to_string());
- map.insert("access_key_id".to_string(), "access_key_id".to_string());
- map.insert("access_key_secret".to_string(),
"access_key_secret".to_string());
-
- let op: Operator = Operator::via_map(Scheme::Oss, map)?;
+ map.insert("root".to_string(), "/path/to/dir".to_string());
+ map.insert("credential".to_string(), "authentication token".to_string());
+ map.insert("predefined_acl".to_string(), "publicRead".to_string());
+ map.insert("default_storage_class".to_string(), "STANDARD".to_string());
+ let op: Operator = Operator::via_map(Scheme::Gcs, map)?;
Ok(())
}
```
@@ -43,14 +40,13 @@ async fn main() -> Result<()> {
```javascript
import { Operator } from "opendal";
-
async function main() {
- const op = new Operator("oss", {
- root: "/path/to/dir",
+ const op = new Operator("gcs", {
bucket: "test",
- endpoint: "https://oss-cn-beijing.aliyuncs.com",
- access_key_id: "access_key_id",
- access_key_secret: "access_key_secret",
+ root: "/path/to/dir",
+ credential: "authentication token",
+ predefined_acl: "publicRead",
+ default_storage_class: "STANDARD",
});
}
```
@@ -60,16 +56,14 @@ async function main() {
```python
import opendal
-
-op = opendal.Operator("oss",
- root="/path/to/dir",
+op = opendal.Operator("gcs",
bucket="test",
- endpoint="https://oss-cn-beijing.aliyuncs.com",
- access_key_id="access_key_id",
- access_key_secret="access_key_secret",
+ root="/path/to/dir",
+ credential="authentication token",
+ predefined_acl="publicRead",
+ default_storage_class="STANDARD",
)
```
</TabItem>
-</Tabs>
-
+</Tabs>
\ No newline at end of file
diff --git a/website/docs/services/hdfs.mdx b/website/docs/services/hdfs.mdx
index 6f29a7dab..c8125898a 100644
--- a/website/docs/services/hdfs.mdx
+++ b/website/docs/services/hdfs.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/ipfs.mdx b/website/docs/services/ipfs.mdx
index db98fcb27..b858b7a0f 100644
--- a/website/docs/services/ipfs.mdx
+++ b/website/docs/services/ipfs.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/memory.mdx b/website/docs/services/memory.mdx
index 2a4ea6868..aff2e1465 100644
--- a/website/docs/services/memory.mdx
+++ b/website/docs/services/memory.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/oss.mdx b/website/docs/services/oss.mdx
index c97762ae9..24575f58a 100644
--- a/website/docs/services/oss.mdx
+++ b/website/docs/services/oss.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/redis.mdx b/website/docs/services/redis.mdx
index 9bccb2e97..5e4fad2f6 100644
--- a/website/docs/services/redis.mdx
+++ b/website/docs/services/redis.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/rocksdb.mdx
b/website/docs/services/rocksdb.mdx
index 1afd0f4f5..13ddde594 100644
--- a/website/docs/services/rocksdb.mdx
+++ b/website/docs/services/rocksdb.mdx
@@ -17,11 +17,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/s3.mdx b/website/docs/services/s3.mdx
index 36f06da89..90562f6cd 100644
--- a/website/docs/services/s3.mdx
+++ b/website/docs/services/s3.mdx
@@ -19,11 +19,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/sftp.mdx b/website/docs/services/sftp.mdx
index afb8d32b2..55f70ef10 100644
--- a/website/docs/services/sftp.mdx
+++ b/website/docs/services/sftp.mdx
@@ -26,11 +26,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/sled.mdx b/website/docs/services/sled.mdx
index b82d1227a..8feec4daa 100644
--- a/website/docs/services/sled.mdx
+++ b/website/docs/services/sled.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/website/docs/services/webhdfs.mdx
b/website/docs/services/webhdfs.mdx
index c152335e9..1a1f251f8 100644
--- a/website/docs/services/webhdfs.mdx
+++ b/website/docs/services/webhdfs.mdx
@@ -18,11 +18,10 @@ import TabItem from '@theme/TabItem';
<TabItem value="rust" label="Rust" default>
```rust
-use std::sync::Arc;
-
use anyhow::Result;
-use opendal::Scheme;
use opendal::Operator;
+use opendal::Scheme;
+use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<()> {