This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. Most of the commands are for stuff inside iceberg_rust_ffi folder, with the exception of the RustyIceberg.jl section below.
cargo build- Build the Rust FFI library (debug)cargo build --release- Build the Rust FFI library (production)
make run-containers- Start Docker containers for S3 testingmake test- Run the Julia tests (requires build and containers)make stop-containers- Stop Docker containers
cargo fmt- Format Rust codecargo clippy- Run Rust lintercargo check- Quick check for Rust compilation errors
make clean- Clean build artifacts (but keep target directory)make clean-all- Clean everything including target directory
This project provides a Foreign Function Interface (FFI) for Apache Iceberg, allowing C programs (and other languages through C bindings) to access Iceberg tables stored in object storage systems like S3. The majority of the infrastucture relies on object_store_ffi crate. If you don't have access to that crate's code locally, access it at this URL.
- Core FFI Implementation: Exposes Iceberg functionality through C-compatible functions
- Async Runtime Integration: Uses Tokio for async operations with object_store_ffi for callback handling. Async operations rely on
export_runtime_op!macro, which has a sync block, which is a builder function, where all deserialization and conversion is done. Then the result of that is passed to an async block. Each parameter has to implement Send trait, in order to be passed to the async block - Julia Integration: Conditional compilation features for Julia interop (
juliafeature flag) - Memory Management: Safe FFI patterns with proper cleanup functions
The FFI uses an async callback pattern where:
- C calls an async function with a response structure
- Rust spawns the operation and returns immediately
- When complete, Rust invokes a callback to signal completion
- C polls or waits for completion, then checks the response structure
- Owned Pointers: Rust allocates, C receives opaque pointers
- Cleanup Functions: Every allocated resource has a corresponding
_freefunction - Error Handling: Errors are returned via response structures with allocated error strings
- Operations return a context pointer that can be used for cancellation
iceberg_cancel_contextandiceberg_destroy_contextfunctions manage operation lifecycle
The test expects AWS S3 credentials through environment variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_REGIONorAWS_DEFAULT_REGIONAWS_ENDPOINT_URL(for MinIO or custom S3-compatible storage)
Use the .env file or export variables directly. The test is designed to fail with permission errors when S3 paths are inaccessible, which confirms the API is working correctly.
- Default features:
["julia"] juliafeature: Enables Julia thread adoption and GC integration
Whenever making API changes in the iceberg_rust_ffi, the corresponding changes should be made in its parent folder. The parent folder is home for Julia package, which provides Julia bindings on top of the FFI.
Once changes are made there, they should be tested by running make test. If error is related to missing minio/s3 or Iceberg REST catalog server etc., suggest to user to run make run-containers.
- Always check for null pointers in C code before dereferencing
- Use the provided
_freefunctions to avoid memory leaks - Error messages are allocated strings that must be freed with
iceberg_destroy_cstring
Run make test after making changes to verify the FFI still works.
This crate depends on object_store_ffi for async runtime management and callback handling. The integration provides:
- Cross-platform async runtime setup
- Callback infrastructure for async operations
- Context management for cancellation support