This documentation is part of the "Projects with Books" initiative at zenOSmosis.
The source code for this project is available on GitHub.
Development Guide
Loading…
Development Guide
Relevant source files
This document provides an overview of the development process for SIMD R Drive, covering workspace structure, feature flags, build commands, and development workflows. This page serves as an entry point for contributors and developers working on the codebase.
For detailed instructions on building and running tests, see Building and Testing. For information about the CI/CD pipeline and automated testing, see CI/CD Pipeline. For version history and migration guides, see Version History and Migration.
Prerequisites
SIMD R Drive requires:
- Rust : Edition 2024 (as specified in Cargo.toml4)
- Cargo : Workspace-aware build system
- Platform Support : Linux, macOS, Windows (tested via CI matrix)
Optional tools for specific workflows:
- Python 3.10-3.13 : For Python bindings development (see Python Integration)
- Maturin : For building Python wheels (see Building Python Bindings)
- Criterion : For benchmarking (included as dev-dependency)
Workspace Structure
SIMD R Drive uses a Cargo workspace architecture with multiple crates organized by function. The workspace is defined in Cargo.toml:65-78 with specific members included and Python bindings excluded from the main workspace due to Maturin’s incompatible build system.
graph TB
Root["simd-r-drive\nname: 'simd-r-drive'\npath: '.'"]
EntryHandle["simd-r-drive-entry-handle\npath: './simd-r-drive-entry-handle'"]
Extensions["simd-r-drive-extensions\npath: './extensions'"]
subgraph experiments["experiments/ (workspace members)"]
WSServer["simd-r-drive-ws-server\npath: 'experiments/simd-r-drive-ws-server'"]
WSClient["simd-r-drive-ws-client\npath: 'experiments/simd-r-drive-ws-client'"]
ServiceDef["simd-r-drive-muxio-service-definition\npath: 'experiments/simd-r-drive-muxio-service-definition'"]
end
subgraph excluded["excluded (maturin-managed)"]
PyBindings["simd-r-drive-py\npath: 'experiments/bindings/python'"]
PyWSClient["simd-r-drive-ws-client-py\npath: 'experiments/bindings/python-ws-client'"]
end
Root --> EntryHandle
WSServer --> Root
WSServer --> ServiceDef
WSClient --> Root
WSClient --> ServiceDef
PyWSClient --> WSClient
PyBindings --> Root
Extensions --> Root
Workspace Dependency Graph
Workspace Configuration:
[workspace]block: Cargo.toml:65-78members: Lines 66-73exclude: Lines 74-77resolver = "2": Line 78 (uses v2 feature resolver)
Sources: Cargo.toml:65-78 Cargo.toml:11-21
Workspace Member Descriptions
| Crate Path | Package Name | Purpose | Version Declaration |
|---|---|---|---|
. | simd-r-drive | Core DataStore engine with CLI | Cargo.toml:11-21 |
simd-r-drive-entry-handle | simd-r-drive-entry-handle | EntryHandle, EntryMetadata types | Cargo.toml83 |
extensions | simd-r-drive-extensions | Helper utilities and extensions | Cargo.toml69 |
experiments/simd-r-drive-ws-server | simd-r-drive-ws-server | WebSocket RPC server using Muxio | Cargo.toml70 |
experiments/simd-r-drive-ws-client | simd-r-drive-ws-client | Native Rust client for remote access | Cargo.toml71 Cargo.toml84 |
experiments/simd-r-drive-muxio-service-definition | simd-r-drive-muxio-service-definition | RPC method definitions and types | Cargo.toml72 Cargo.toml85 |
experiments/bindings/python | simd-r-drive-py | PyO3 direct bindings (excluded) | Cargo.toml75 |
experiments/bindings/python-ws-client | simd-r-drive-ws-client-py | Python WebSocket client (excluded) | Cargo.toml76 |
Exclusion Rationale: Python binding crates use Maturin’s PyO3 build system, which conflicts with Cargo’s workspace resolver. These crates must be built separately using maturin build or maturin develop. The exclusion is specified in Cargo.toml:74-77
Sources: Cargo.toml:11-21 Cargo.toml:65-78 Cargo.toml:81-85
Feature Flags
The core simd-r-drive crate exposes multiple feature flags that enable optional functionality. Features are defined in Cargo.toml:49-55
Feature Configuration and Dependencies
Sources: Cargo.toml:49-55 Cargo.toml:23-34
Feature Flag Reference
| Feature | Dependencies | Purpose | Common Use Cases |
|---|---|---|---|
default | None | Minimal feature set | Production builds |
expose-internal-api | None | Exposes internal structs/functions for testing | Test harnesses, benchmarks |
parallel | rayon = "1.10.0" | Enables parallel iteration via Rayon | High-throughput batch processing |
arrow | simd-r-drive-entry-handle/arrow | Proxy feature for Apache Arrow integration | Data analytics pipelines |
The arrow feature is a proxy feature: enabling simd-r-drive/arrow automatically enables simd-r-drive-entry-handle/arrow, allowing users to enable Arrow support without knowing the internal crate structure.
Sources: Cargo.toml:49-55 Cargo.toml30 Cargo.toml:54-55
Common Development Commands
Building
| Command | Purpose | Feature Flags Used |
|---|---|---|
cargo build | Build with default features | None |
cargo build --workspace | Build all workspace members | None |
cargo build --all-targets | Build binaries, libs, tests, benches | None |
cargo build --release | Optimized release build | None |
cargo build --features parallel | Build with parallel iteration | parallel |
cargo build --all-features | Build with all features enabled | parallel, arrow, expose-internal-api |
cargo build --no-default-features | Minimal build (no features) | None |
Build Target Types:
lib- Core library (src/lib.rs)bin- CLI executable (src/main.rs)test- Unit and integration tests (tests/)bench- Criterion benchmarks (benches/)
Testing
| Command | Purpose | Scope |
|---|---|---|
cargo test | Run core crate tests | Current crate only |
cargo test --workspace | Run all workspace tests | All members |
cargo test --all-targets | Test all targets (lib, bins, tests, benches) | Current crate |
cargo test --features expose-internal-api | Test with internal APIs exposed | Feature-specific |
cargo test -- --test-threads=1 | Sequential test execution | Useful for serial_test cases |
cargo test --workspace --all-targets --verbose | Full CI-style test run | Matches .github/workflows/rust-tests.yml57 |
Dev Dependencies for Testing:
tempfile = "3.19.0"- Temporary file creation (Cargo.toml45)serial_test = "3.2.0"- Sequential test execution (Cargo.toml44)rand = "0.9.0"- Random data generation (Cargo.toml41)
Benchmarking
The crate includes two Criterion-based benchmarks defined in Cargo.toml:57-63:
| Benchmark | Command | Purpose |
|---|---|---|
storage_benchmark | cargo bench --bench storage_benchmark | Measure write/read throughput |
contention_benchmark | cargo bench --bench contention_benchmark | Measure concurrent access performance |
Benchmark Configuration:
harness = false(Cargo.toml59 Cargo.toml63) - Use Criterion’s harness instead of libtest- Compile without running:
cargo bench --no-run(.github/workflows/rust-tests.yml:60-61)
Sources: Cargo.toml:36-47 Cargo.toml:57-63 .github/workflows/rust-tests.yml:53-61
Development Workflow
Standard Development Cycle
Sources: .github/workflows/rust-tests.yml:1-62
Multi-Platform Testing
The CI pipeline tests on three operating systems with multiple feature flag combinations. The test matrix is defined in .github/workflows/rust-tests.yml:14-30:
| Matrix Dimension | Values |
|---|---|
| OS | ubuntu-latest, macos-latest, windows-latest |
| Features | Default, No Default Features, Parallel, Expose Internal API, Parallel + Expose API, All Features |
This results in 18 test jobs (3 OS × 6 feature combinations) per CI run.
Build and Test Targets Flow
Sources: .github/workflows/rust-tests.yml:14-30 .github/workflows/rust-tests.yml:53-61
Ignored Files and Directories
The .gitignore:1-10 file specifies build artifacts and local files to exclude from version control:
| Pattern | Purpose |
|---|---|
**/target | Cargo build output (all workspace members) |
*.bin | Binary data files (test artifacts) |
/data | Local data directory for debugging |
out.txt | Temporary output file |
.cargo/config.toml | Local Cargo configuration overrides |
The /data directory is explicitly ignored for local development and experimentation without polluting the repository.
Sources: .gitignore:1-10
Dependency Management
Workspace-Level Dependencies
Shared dependencies are defined in [workspace.dependencies] block (Cargo.toml:80-112) to ensure version consistency across workspace members:
Core Storage Dependencies:
| Dependency | Version | Features | Usage |
|---|---|---|---|
xxhash-rust | 0.8.15 | xxh3, const_xxh3 | Key hashing (line 34) |
memmap2 | 0.9.5 | - | Memory-mapped file access (line 102) |
crc32fast | 1.4.2 | - | Entry checksum validation (line 97) |
dashmap | 6.1.0 | - | Concurrent KeyIndexer storage (line 27) |
Optional Feature Dependencies:
| Dependency | Version | Gated By | Line |
|---|---|---|---|
rayon | 1.10.0 | parallel feature | Cargo.toml30 |
arrow | 57.0.0 | arrow feature | Cargo.toml92 |
Development-Only Dependencies:
| Dependency | Version | Purpose | Line |
|---|---|---|---|
criterion | 0.6.0 | Benchmarking harness | Cargo.toml98 |
tempfile | 3.19.0 | Isolated test datastores | Cargo.toml107 |
serial_test | 3.2.0 | Sequential test execution | Cargo.toml106 |
tokio | 1.45.1 | Async testing (extensions only) | Cargo.toml109 |
Network Stack Dependencies (Muxio Framework):
| Dependency | Version | Used By | Line |
|---|---|---|---|
muxio-tokio-rpc-client | 0.9.0-alpha | simd-r-drive-ws-client | Cargo.toml86 |
muxio-tokio-rpc-server | 0.9.0-alpha | simd-r-drive-ws-server | Cargo.toml87 |
muxio-rpc-service | 0.9.0-alpha | RPC framework | Cargo.toml88 |
bitcode | 0.6.6 | Binary serialization | Cargo.toml95 |
Sources: Cargo.toml:23-34 Cargo.toml:36-47 Cargo.toml:80-112
Intra-Workspace Dependencies
Workspace crates reference each other using path dependencies with explicit versions:
This ensures workspace members can be published independently to crates.io while maintaining version consistency during development.
Sources: Cargo.toml:81-85
CI/CD Caching Strategy
The CI pipeline uses GitHub Actions cache to accelerate builds. The caching configuration is defined in .github/workflows/rust-tests.yml:40-51
Cached Directory Structure
Cache Key Components:
${{ runner.os }}- Platform-specific cache (ubuntu/macos/windows)${{ hashFiles('**/Cargo.lock') }}- Dependency version fingerprint${{ matrix.flags }}- Feature flag combination fingerprint
Fallback Strategy: If exact match fails, falls back to same OS + same Cargo.lock, recompiling only feature-specific code.
Sources: .github/workflows/rust-tests.yml:40-51
Publishing Configuration
All workspace crates share publishing configuration through Cargo.toml:1-9:
| Field | Value | Purpose |
|---|---|---|
authors | ["Jeremy Harris <jeremy.harris@zenosmosis.com>"] | Crate metadata |
version | "0.15.5-alpha" | Current release version |
edition | "2024" | Rust edition |
repository | "https://github.com/jzombie/rust-simd-r-drive" | Source location |
license | "Apache-2.0" | Open source license |
categories | ["database-implementations", "data-structures", "filesystem"] | crates.io categories |
keywords | ["storage-engine", "binary-storage", "append-only", "simd", "mmap"] | Search keywords |
publish | true | Enable publishing to crates.io |
Individual crates inherit these values using workspace inheritance: edition.workspace = true.
Sources: Cargo.toml:1-21
Next Steps
- Building and Testing : See Building and Testing for detailed instructions on running unit tests, integration tests, concurrency tests, and benchmarks.
- CI/CD Pipeline : See CI/CD Pipeline for information about GitHub Actions workflows, matrix testing strategy, and quality checks.
- Version History and Migration : See Version History and Migration for breaking changes, migration paths, and storage format evolution.
For information about specific subsystems:
- Storage engine internals: Core Storage Engine
- Network layer: Network Layer and RPC
- Python integration: Python Integration
- Performance features: Performance Optimizations
Dismiss
Refresh this wiki
Enter email to refresh