Skip to main content

Core

Apache OpenDAL™ Rust Core: One Layer, All Storage.

Build Status Latest Version Crate Downloads chat

Apache OpenDAL™ is an Open Data Access Layer that enables seamless interaction with diverse storage services.

OpenDAL Architectural

Services

OpenDAL supports the following storage services:

TypeServices
Standard Storage Protocolsftp http sftp webdav
Object Storage Servicesazblob cos gcs obs oss s3
b2 openstack_swift upyun vercel_blob
File Storage Servicesfs alluxio azdls azfile compfs
dbfs gridfs hdfs hdfs_native ipfs webhdfs
Consumer Cloud Storage Servicealiyun_drive gdrive onedrive dropbox icloud koofr
pcloud seafile yandex_disk
Key-Value Storage Servicescacache cloudflare_kv dashmap memory etcd
foundationdb persy redis rocksdb sled
redb tikv atomicserver
Database Storage Servicesd1 mongodb mysql postgresql sqlite surrealdb
Cache Storage Servicesghac memcached mini_moka moka vercel_artifacts
Git Based Storage Serviceshuggingface

Layers

OpenDAL supports the following storage layers to extend the behavior:

NameDependsDescription
AsyncBacktraceLayerasync-backtraceAdd Efficient, logical 'stack' traces of async functions for the underlying services.
AwaitTreeLayerawait-treeAdd a Instrument await-tree for actor-based applications to the underlying services.
BlockingLayertokioAdd blocking API support for non-blocking services.
ChaosLayerrandInject chaos into underlying services for robustness test.
ConcurrentLimitLayertokioAdd concurrent request limit.
DtraceLayerprobeSupport User Statically-Defined Tracing(aka USDT) on Linux
LoggingLayerlogAdd log for every operations.
MetricsLayermetricsAdd metrics for every operations.
MimeGuessLayermime_guessAdd Content-Type automatically based on the file extension in the operation path.
FastraceLayerfastraceAdd fastrace for every operations.
OtelMetricsLayer[opentelemetry::metrics]Add opentelemetry::metrics for every operations.
OtelTraceLayeropentelemetry::traceAdd opentelemetry::trace for every operations.
PrometheusClientLayerprometheus_clientAdd prometheus metrics for every operations.
PrometheusLayerprometheusAdd prometheus metrics for every operations.
RetryLayerbackonAdd retry for temporary failed operations.
ThrottleLayergovernorAdd a bandwidth rate limiter to the underlying services.
TimeoutLayertokioAdd timeout for every operations to avoid slow or unexpected hang operations.
TracingLayertracingAdd tracing for every operations.

Quickstart

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::new(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(())
}

Examples

NameDescription
BasicShow how to use opendal to operate storage service.
Concurrent UploadShow how to perform upload concurrently to a storage service.
Multipart UploadShow how to perform a multipart upload to a storage service.

Contributing

Check out the CONTRIBUTING guide for more details on getting started with contributing to this project.

Used by

Check out the users list for more details on who is using OpenDAL.

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.