Crates.io | object_store_opendal |
lib.rs | object_store_opendal |
version | 0.48.2 |
source | src |
created_at | 2023-01-28 09:34:35.490568 |
updated_at | 2024-11-07 06:01:45.222019 |
description | object_store Integration for Apache OpenDAL |
homepage | https://opendal.apache.org/ |
repository | https://github.com/apache/opendal |
max_upload_size | |
id | 770271 |
size | 94,481 |
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.
Add the following dependencies to your Cargo.toml
with correct version:
[dependencies]
object_store = "0.11.0"
object_store_opendal = "0.47.0"
opendal = { version = "0.49.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(),
).unwrap();
// 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);
}
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.
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.