Expand description
§Apache OpenDAL™ Core
opendal-core contains the storage abstraction, operator APIs, extension
traits, and shared infrastructure used by Apache OpenDAL™.
Most applications should depend on the opendal
facade. The facade re-exports the core APIs and wires optional service, layer,
executor, and HTTP transport crates behind feature flags.
Depend on opendal-core directly when implementing an OpenDAL service or layer,
building a minimal integration from the split crates, or managing service
registration and HTTP transport explicitly.
§Quick start
The in-memory service is always available:
cargo add opendal-coreuse opendal_core::services;
use opendal_core::Operator;
use opendal_core::Result;
fn build_operator() -> Result<Operator> {
Operator::new(services::Memory::default())
}Storage services and optional layers live in separate
opendal-service-* and opendal-layer-* crates. Applications using the facade
can enable them through services-* and layers-* features instead.
§Compose split crates
Applications that depend on opendal-core directly compose storage and runtime
behavior explicitly:
- A service crate exports a builder that implements
opendal_core::Builder. Pass the configured builder toOperator::new. - A layer crate exports a type that implements
opendal_core::raw::Layer. Pass the configured layer toOperator::layer. - An HTTP transport crate exports an
opendal_core::HttpTransportimplementation. Wrap it inHttpTransporterand place it in the operator’sOperationContext.
For example, the following dependencies compose S3, retry, and the reqwest HTTP
transport without the opendal facade:
cargo add opendal-core opendal-service-s3 opendal-layer-retry
cargo add opendal-http-transport-reqwestuse opendal_core::HttpTransporter;
use opendal_core::OperationContext;
use opendal_core::Operator;
use opendal_core::Result;
use opendal_http_transport_reqwest::ReqwestTransport;
use opendal_layer_retry::RetryLayer;
use opendal_service_s3::S3;
fn build_operator(builder: S3) -> Result<Operator> {
let context = OperationContext::new()
.with_http_transport(HttpTransporter::new(ReqwestTransport::default()));
Ok(Operator::new(builder)?
.with_context(context)
.layer(RetryLayer::default()))
}Configure builder for the target S3-compatible service before passing it to
build_operator.
Operator::new uses the builder directly and does not require service
registration. Call the service crate’s register_*_service function with
OperatorRegistry::get() only when using scheme-driven construction through
Operator::from_uri or Operator::via_iter.
§Documentation
§License
Licensed under the Apache License, Version 2.0.
Modules§
- blocking
blocking - blocking module provides blocking APIs for OpenDAL.
- executors
- executors module provides implementations for the
Executetrait for widely used runtimes. - layers
- Core layers used by
opendal-core. - operator_
futures - Futures provides the futures generated by
Operator - options
- Options module provides options definitions for operations.
- raw
- Raw modules provide raw APIs that used by underlying services
- services
- Built-in service support.
Structs§
- Buffer
- Buffer is a wrapper of contiguous
Bytesand non-contiguous[Bytes]. - Buffer
Sink - BufferSink is the adapter of
futures::Sinkgenerated byWriter::into_sink - Buffer
Stream - BufferStream is a stream of buffers, created by
Reader::into_stream - Capability
- Capability defines the supported operations and their constraints for a storage Operator.
- Copier
Copierdrives a long-running copy operation one step at a time.- Delete
Input - DeleteInput is the input for delete operations.
- Deleter
- Deleter is designed to continuously remove content from storage.
- Entry
Entryrepresents an entry’s path and metadata.- Error
- Error is the error struct returned by all opendal functions.
- Executor
- Executor that runs futures in background.
- Futures
Async Reader - FuturesAsyncReader is the adapter of
AsyncRead,AsyncBufReadandAsyncSeekgenerated byReader::into_futures_async_read. - Futures
Async Writer - FuturesIoAsyncWriter is the adapter of
AsyncWriteforWriter. - Futures
Bytes Sink - FuturesBytesSink is the adapter of
futures::Sinkgenerated byWriter::into_bytes_sink. - Futures
Bytes Stream - FuturesBytesStream is the adapter of
Streamgenerated byReader::into_bytes_stream. - Futures
Delete Sink - FuturesDeleteSink is a sink that generated by
Deleter - Http
Body - The streaming body returned by
HttpTransporter. - Http
Transporter - Type-erased HTTP transport handle.
- Lister
Listerlists entries at a given path asynchronously.- Metadata
- Metadata contains all the information related to a specific path.
- Operation
Context - Composed resources passed from operator to services and layers.
- Operator
- The
Operatorserves as the entry point for all public asynchronous APIs. - Operator
Info - Metadata for operator, users can use this metadata to get information of operator.
- Operator
Registry - Global registry that maps schemes to
OperatorFactoryfunctions. - Operator
Uri - Parsed representation of an operator URI with normalized components.
- Reader
- Reader is designed to read data from given path in an asynchronous manner.
- Writer
- Writer is designed to write data into given path in an asynchronous manner.
Enums§
- Bytes
Range - BytesRange carries a range of content.
- Entry
Mode - EntryMode represents the mode.
- Error
Kind - OpenDAL error categories.
Traits§
- Builder
- OpenDAL uses
Builderto set up a service. - Configurator
- OpenDAL uses
Configuratorto configure a service. - Execute
- Execute trait is used to execute task in background.
- Http
Transport - HTTP transport used by OpenDAL services.
- Into
Delete Input - IntoDeleteInput is a helper trait that makes it easier for users to play with
Deleter. - Into
Operator Uri - Conversion trait that builds
OperatorUrifrom various inputs.
Type Aliases§
- Operator
Factory - Factory signature used to construct
Operatorfrom a URI and extra options. - Result
- A specialized
std::result::Resultwhose default error type isError.