Crate opendal

source ·
Expand description

OpenDAL is the Open Data Access Layer to freely, painlessly, and efficiently access data.

  • Documentation: All docs are carried byself, visit docs for more.
  • Services: All supported services could be found at services.
  • Layers: All builtin layer could be found at layers.
  • Features: All features could be found at features.

Quick Start

use opendal::layers::LoggingLayer;
use opendal::services;
use opendal::Operator;
use opendal::Result;

#[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(())
}

Modules

This module holds documentation for OpenDAL.
Layer is the mechanism to intercept operations.
Ops provides the operation args struct like OpRead for user.
Raw modules provide raw APIs that used by underlying services
Services will provide builders to build underlying backends.

Structs

BlockingLister is designed to list entries at given path in a blocking manner.
BlockingOperator is the entry for all public blocking APIs.
BlockingReader is designed to read data from given path in an blocking manner.
BlockingWriter is designed to write data into given path in an blocking manner.
Entry is the file/dir entry returned by Lister.
Error is the error struct returned by all opendal functions.
Lister is designed to list entries at given path in an asynchronous manner.
Metadata carries all metadata associated with an path.
Operator is the entry for all public async APIs.
OperatorBuilder is a typed builder to build an Operator.
Metadata for operator, users can use this metadata to get information of operator.
Reader is designed to read data from given path in an asynchronous manner.
Writer is designed to write data into given path in an asynchronous manner.

Enums

EntryMode represents the mode.
ErrorKind is all kinds of Error of opendal.
Metakey describes the metadata keys that can be stored or queried.
Services that OpenDAL supports

Traits

Builder is used to build a storage accessor used by Operator.

Type Definitions

Result that is a wrapper of Result<T, opendal::Error>