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::create(builder)?
        // Init with logging layer enabled.
        .layer(LoggingLayer::default())
        .finish();

    // Create object handler.
    let mut o = op.object("test_file");

    // Write data
    o.write("Hello, World!").await?;

    // Read data
    let bs = o.read().await?;

    // Fetch metadata
    let meta = o.stat().await?;
    let mode = meta.mode();
    let length = meta.content_length();

    // Delete
    o.delete().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

  • BatchOperator is used to take batch operations like walk_dir and remove_all, should be constructed by Operator::batch().
  • Error is the error struct returned by all opendal functions.
  • Object is the handler for all object related operations.
  • ObjectLister is returned by Object::list to list objects.
  • Metadata carries all object metadata.
  • ObjectMultipart represent an ongoing multipart upload.
  • ObjectPart is generated by write_multipart operation, carries required information for complete_multipart.
  • ObjectReader is the public API for users.
  • Operator is the user-facing APIs for object and object streams.
  • OperatorBuilder is a typed builder to builder an Operator.
  • Metadata for operator, users can use this metadata to get information of operator.

Enums

  • ErrorKind is all kinds of opendal’s Error.
  • ObjectMetakey describes the metadata keys that can be stored or queried.
  • ObjectMode represents the corresponding object’s mode.
  • Services that OpenDAL supports

Traits

  • Builder will build an accessor;

Type Definitions

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