Open Data Access Layer: Access data freely, painlessly, and efficiently
You may be looking for:
- azblob: Azure Storage Blob services.
- azdfs: Azure Data Lake Storage Gen2 services. (As known as abfs)
- fs: POSIX alike file system.
- ftp: FTP and FTPS support.
- gcs: Google Cloud Storage Service.
- hdfs: Hadoop Distributed File System(HDFS).
- http: HTTP read-only services.
- ipfs: InterPlanetary File System HTTP Gateway support.
- ipmfs: InterPlanetary File System MFS API support.
- memory: In memory backend.
- moka: moka backend support.
- obs: Huawei Cloud Object Storage Service (OBS).
- oss: Aliyun Object Storage Service (OSS).
- redis: Redis services support.
- rocksdb: RocksDB services support.
- s3: AWS S3 alike services.
Access data freely
- Access different storage services in the same way
- Behavior tests for all services
Access data painlessly
- 100% documents covered
- Powerful
Layers
- Automatic retry support
- Full observability support: logging, tracing, metrics.
- Native decompress support
- Native service-side encryption support
Access data efficiently
- Zero cost: mapping to underlying API calls directly
- Auto metadata reuse: avoid extra
metadata
calls
use anyhow::Result;
use futures::StreamExt;
use futures::TryStreamExt;
use opendal::ObjectStreamer;
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 os = o.list().await?;
while let Some(entry) = os.try_next().await? {
let path = entry.path();
let mode = entry.mode().await?;
}
Ok(())
}
More examples could be found at Documentation.
- Databend: A modern Elasticity and Performance cloud data warehouse.
- GreptimeDB: An open-source, cloud-native, distributed time-series database.
- deepeth/mars: The powerful analysis platform to explore and visualize data from blockchain.
Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.
Submit issues for bug report or asking questions in discussion.
Licensed under Apache License, Version 2.0.