This file provides guidance to AI coding agents (e.g., Claude Code, ChatGPT) when working with code in this repository.
While working on OpenDAL, please remember:
- Always use English in code and comments.
- Only add meaningful comments when the code's behavior is difficult to understand.
- Only add meaningful tests when they actually verify internal behaviors; otherwise, don't create them unless requested.
- All cargo commands must be executed within the
coredirectory. - All changes to
coremust pass the clippy check and behavior tests. - Don't change public API or behavior tests unless requested.
# Check code
cargo check
# Build
cargo build
# Run linter for all services.
cargo clippy --all-targets --all-features -- -D warnings
# Run linter for specific services.
cargo clippy --all-targets --features=services-s3 -- -D warnings
# Run tests (requires test features)
cargo test --features tests
# Run behavior tests
OPENDAL_TEST=s3 cargo test --features services-s3,tests behavior
# Run specific test
cargo test tests::it::services::fs
# Format code
cargo fmt
# Check formatting
cargo fmt --check
# Build documentation
cargo doc --lib --no-deps --all-features
# Run benchmarks
cargo bench# Run command across all packages
./scripts/workspace.py cargo check
./scripts/workspace.py cargo fmt -- --check# Generate bindings code
just generate python
just generate java
# Update version across project
just update-version
# Release process
just release# Copy environment template for tests
cp .env.example .env
# Edit .env with your service credentialsOpenDAL is a unified data access layer with a modular architecture:
- core/: Main Rust library implementing the storage abstraction
src/services/: 50+ storage service implementations (S3, Azure, GCS, etc.)src/layers/: Middleware for cross-cutting concerns (retry, metrics, tracing)src/raw/: Low-level traits and types for implementing backendssrc/types/: Core types and traits
Each service follows a consistent structure:
backend.rs: Main service implementation withAccessortraitconfig.rs: Configuration and builder patterncore.rs: Core logic and HTTP client setupwriter.rs,reader.rs,lister.rs: Operation implementationserror.rs: Service-specific error handling
- bindings/: Language-specific bindings (Python, Java, Go, Node.js, etc.)
- Each binding has its own build system and contributing guide
- Generated code uses the
devcrate for consistency
- oli: moved to a separate repository (see docs: https://opendal.apache.org/docs/40-apps/oli)
- ofs: moved to a separate repository (see docs: https://opendal.apache.org/docs/40-apps/ofs)
- oay: removed from this repository
- integrations/: Ecosystem integrations (FUSE, WebDAV, object_store)
Services are feature-gated to reduce binary size:
// Enable specific services
[features]
services-s3 = []
services-azblob = []Layers provide composable middleware:
op.layer(RetryLayer::new())
.layer(MetricsLayer::new())
.layer(LoggingLayer::new())All core operations are async with blocking wrappers available:
// Async API
let data = op.read("path").await?;
// Blocking API
let data = op.blocking().read("path")?;Use conventional commits:
feat(services/gcs): Add start-after support for list
fix(services/s3): Ignore prefix if it's empty
docs: Add troubleshooting guide
ci: Update GitHub Actions workflow
refactor(core): Simplify error handling
- Always follow OpenDAL's pull request template when creating a PR.
- Unit tests in
src/tests/ - Behavior tests validate service implementations
- Integration tests require service credentials in
.env - CI runs tests across multiple platforms and Rust versions
- Create new module in
core/src/services/ - Implement
Accessortrait - Add service feature flag in
Cargo.toml - Add service tests in behavior test suite
- Update documentation
- Enable debug logging:
RUST_LOG=debug - Use tracing layer for detailed operation tracking
- Check service-specific error types
- Verify credentials and endpoint configuration
- Minimum Rust version: 1.85 (MSRV)
- All services implement the same
Accessortrait - Use
justfor common development tasks - Check CI workflows for platform-specific requirements
- Services are tested against real backends (credentials required)