Skip to content

Open Data Access Layer that connect the whole world together.

License

Notifications You must be signed in to change notification settings

MODULUSREBUS/opendal

 
 

Repository files navigation

OpenDAL   Build Status Latest Version

Open Data Access Layer that connect the whole world together.


You may be looking for:

Status

OpenDAL is in alpha stage and has been early adopted by databend. Welcome any feedback at Discussions!

Supported Services

  • azblob: Azure Storage Blob services.
  • fs: POSIX alike file system.
  • memory: In memory backend.
  • s3: AWS S3 alike services.

Quickstart

use anyhow::Result;
use futures::StreamExt;
use opendal::services::fs;
use opendal::ObjectMode;
use opendal::Operator;
use opendal::Metadata;
use opendal::Object;
use opendal::ObjectStreamer;

#[tokio::main]
async fn main() -> Result<()> {
    // Init Operator
    let op = Operator::new(fs::Backend::build().root("/tmp").finish().await?);

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

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

    // Read data from object;
    let bs: Vec<u8> = o.read().await?;

    // Read range from object;
    let bs: Vec<u8> = o.range_read(1..=11).await?;

    // Get object's Metadata
    let meta: Metadata = o.metadata().await?;
    let path: &str = meta.path();
    let mode: ObjectMode = meta.mode();
    let length: u64 = meta.content_length();
    let content_md5: Option<String> = meta.content_md5();

    // Delete object.
    let _: () = o.delete().await?;

    // List dir object.
    let o: Object = op.object("test_dir/");
    let mut obs: ObjectStreamer = o.list().await?;
    while let Some(entry) = obs.next().await {
        let entry: Object = entry?;
    }

    Ok(())
}

More examples could be found at examples.

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

Licensed under Apache License, Version 2.0.

About

Open Data Access Layer that connect the whole world together.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 99.8%
  • Shell 0.2%