31 releases (15 breaking)

0.44.3 Jul 7, 2024
0.44.1 Jun 21, 2024
0.43.0 Mar 2, 2024
0.42.0 Nov 16, 2023
0.30.5 Mar 31, 2023

#939 in Database interfaces

Download history 78/week @ 2024-03-30 27/week @ 2024-04-06 153/week @ 2024-05-04 7/week @ 2024-05-11 10/week @ 2024-05-18 2/week @ 2024-05-25 138/week @ 2024-06-08 116/week @ 2024-06-15 40/week @ 2024-06-22 149/week @ 2024-06-29 166/week @ 2024-07-06 4/week @ 2024-07-13

459 downloads per month

Apache-2.0

3MB
59K SLoC

Apache OpenDAL™ object_store integration

Build Status Latest Version Crate Downloads chat

object_store_opendal is an object_store implementation using opendal.

This crate can help you to access 30 more storage services with the same object_store API.

Examples

Add the following dependencies to your Cargo.toml with correct version:

[dependencies]
object_store = "0.10.0"
object_store_opendal = "0.44.0"
opendal = { version = "0.47.0", features = ["services-s3"] }

Build OpendalStore via opendal::Operator:

use std::sync::Arc;

use bytes::Bytes;
use object_store::path::Path;
use object_store::ObjectStore;
use object_store_opendal::OpendalStore;
use opendal::services::S3;
use opendal::{Builder, Operator};

#[tokio::main]
async fn main() {
    let builder = S3::from_map(
        vec![
            ("access_key".to_string(), "my_access_key".to_string()),
            ("secret_key".to_string(), "my_secret_key".to_string()),
            ("endpoint".to_string(), "my_endpoint".to_string()),
            ("region".to_string(), "my_region".to_string()),
        ]
        .into_iter()
        .collect(),
    );

    // Create a new operator
    let operator = Operator::new(builder).unwrap().finish();

    // Create a new object store
    let object_store = Arc::new(OpendalStore::new(operator));

    let path = Path::from("data/nested/test.txt");
    let bytes = Bytes::from_static(b"hello, world! I am nested.");

    object_store.put(&path, bytes.clone().into()).await.unwrap();

    let content = object_store
        .get(&path)
        .await
        .unwrap()
        .bytes()
        .await
        .unwrap();

    assert_eq!(content, bytes);
}

Branding

The first and most prominent mentions must use the full form: Apache OpenDAL™ of the name for any individual usage (webpage, handout, slides, etc.) Depending on the context and writing style, you should use the full form of the name sufficiently often to ensure that readers clearly understand the association of both the OpenDAL project and the OpenDAL software product to the ASF as the parent organization.

For more details, see the Apache Product Name Usage Guide.

License and Trademarks

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0

Apache OpenDAL, OpenDAL, and Apache are either registered trademarks or trademarks of the Apache Software Foundation.

Dependencies

~11–24MB
~347K SLoC