apache / incubator-opendal
- суббота, 18 марта 2023 г. в 00:13:43
Apache OpenDAL: Access data freely, painlessly, and efficiently.
Open Data Access Layer: Access data freely, painlessly, and efficiently
Access data freely
Access data painlessly
Layers
Access data efficiently
use opendal::Result;
use opendal::layers::LoggingLayer;
use opendal::services;
use opendal::Operator;
#[tokio::main]
async fn main() -> Result<()> {
// Pick a builder and configure it.
let mut builder = services::S3::default();
builder.bucket("test");
// Init an operator
let op = Operator::create(builder)?
// Init with logging layer enabled.
.layer(LoggingLayer::default())
.finish();
// Write data
op.write("hello.txt", "Hello, World!").await?;
// Read data
let bs = op.read("hello.txt").await?;
// Fetch metadata
let meta = op.stat("hello.txt").await?;
let mode = meta.mode();
let length = meta.content_length();
// Delete
op.delete("hello.txt").await?;
Ok(())
}
More examples could be found at Documentation.
Check out the CONTRIBUTING guide for more details on getting started with contributing to this project.
Submit issues for bug report or asking questions in the Discussions forum.
Talk to develops at discord.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0