docs: Add docs for gcs backend (#535)

* docs: final works for GCS backend support

1. add documentations for GCS backend
2. add a runnable example for GCS backend

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>

* refactor: fix typo in gcs example

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>

* refactor: make docs compile

1. add more document comment in lib.rs services/gcs/mod.rs
2. fix typo in examples/gcs.rs

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>

* refactor: make clippy happy

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>

Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
Co-authored-by: Xuanwo <github@xuanwo.io>
7 files changed
tree: 52e748dbfd5a0d0695fc080933d3d2f1f6cf68a1
  1. .github/
  2. benches/
  3. docs/
  4. examples/
  5. oay/
  6. oli/
  7. src/
  8. testdata/
  9. tests/
  10. .env.example
  11. .gitignore
  12. .licenserc.yaml
  13. .taplo.toml
  14. book.toml
  15. Cargo.toml
  16. CHANGELOG.md
  17. CONTRIBUTING.md
  18. LICENSE
  19. README.md
  20. rust-toolchain.toml
  21. rustfmt.toml
README.md

OpenDAL   Build Status Latest Version Crate Downloads

Open Data Access Layer: Access data freely, painless, and efficiently


You may be looking for:

Services

  • azblob: Azure Storage Blob services.
  • fs: POSIX alike file system.
  • hdfs: Hadoop Distributed File System(HDFS).
  • http: HTTP read-only services.
  • memory: In memory backend.
  • s3: AWS S3 alike services.

Features

  • Access different storage system in the same way
  • Native decompress support
  • Native service-side encryption support
  • Powerful Layer
  • 100% documents covered
  • Behavior tests for all services

Quickstart

use anyhow::Result;
use futures::StreamExt;
use futures::TryStreamExt;
use opendal::DirEntry;
use opendal::DirStreamer;
use opendal::Object;
use opendal::ObjectMetadata;
use opendal::ObjectMode;
use opendal::Operator;
use opendal::Scheme;

#[tokio::main]
async fn main() -> Result<()> {
    // Init Operator
    let op = Operator::from_env(Scheme::Fs)?;

    // Create object handler.
    let o = op.object("test_file");

    // Write data info object;
    o.write("Hello, World!").await?;

    // Read data from object;
    let bs = o.read().await?;

    // Read range from object;
    let bs = o.range_read(1..=11).await?;

    // Get object's path
    let name = o.name();
    let path = o.path();

    // Fetch more meta about object.
    let meta = o.metadata().await?;
    let mode = meta.mode();
    let length = meta.content_length();
    let content_md5 = meta.content_md5();
    let etag = meta.etag();

    // Delete object.
    o.delete().await?;

    // List dir object.
    let o = op.object("test_dir/");
    let mut ds = o.list().await?;
    while let Some(entry) = ds.try_next().await? {
        let path = entry.path();
        let mode = entry.mode();
    }

    Ok(())
}

More examples could be found at Documentation.

Projects

  • databend: A modern Elasticity and Performance cloud data warehouse.

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

License