Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

GitHub

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:

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-78
  • members: Lines 66-73
  • exclude: Lines 74-77
  • resolver = "2": Line 78 (uses v2 feature resolver)

Sources: Cargo.toml:65-78 Cargo.toml:11-21

Workspace Member Descriptions

Crate PathPackage NamePurposeVersion Declaration
.simd-r-driveCore DataStore engine with CLICargo.toml:11-21
simd-r-drive-entry-handlesimd-r-drive-entry-handleEntryHandle, EntryMetadata typesCargo.toml83
extensionssimd-r-drive-extensionsHelper utilities and extensionsCargo.toml69
experiments/simd-r-drive-ws-serversimd-r-drive-ws-serverWebSocket RPC server using MuxioCargo.toml70
experiments/simd-r-drive-ws-clientsimd-r-drive-ws-clientNative Rust client for remote accessCargo.toml71 Cargo.toml84
experiments/simd-r-drive-muxio-service-definitionsimd-r-drive-muxio-service-definitionRPC method definitions and typesCargo.toml72 Cargo.toml85
experiments/bindings/pythonsimd-r-drive-pyPyO3 direct bindings (excluded)Cargo.toml75
experiments/bindings/python-ws-clientsimd-r-drive-ws-client-pyPython 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

FeatureDependenciesPurposeCommon Use Cases
defaultNoneMinimal feature setProduction builds
expose-internal-apiNoneExposes internal structs/functions for testingTest harnesses, benchmarks
parallelrayon = "1.10.0"Enables parallel iteration via RayonHigh-throughput batch processing
arrowsimd-r-drive-entry-handle/arrowProxy feature for Apache Arrow integrationData 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

CommandPurposeFeature Flags Used
cargo buildBuild with default featuresNone
cargo build --workspaceBuild all workspace membersNone
cargo build --all-targetsBuild binaries, libs, tests, benchesNone
cargo build --releaseOptimized release buildNone
cargo build --features parallelBuild with parallel iterationparallel
cargo build --all-featuresBuild with all features enabledparallel, arrow, expose-internal-api
cargo build --no-default-featuresMinimal 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

CommandPurposeScope
cargo testRun core crate testsCurrent crate only
cargo test --workspaceRun all workspace testsAll members
cargo test --all-targetsTest all targets (lib, bins, tests, benches)Current crate
cargo test --features expose-internal-apiTest with internal APIs exposedFeature-specific
cargo test -- --test-threads=1Sequential test executionUseful for serial_test cases
cargo test --workspace --all-targets --verboseFull CI-style test runMatches .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:

BenchmarkCommandPurpose
storage_benchmarkcargo bench --bench storage_benchmarkMeasure write/read throughput
contention_benchmarkcargo bench --bench contention_benchmarkMeasure concurrent access performance

Benchmark Configuration:

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 DimensionValues
OSubuntu-latest, macos-latest, windows-latest
FeaturesDefault, 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:

PatternPurpose
**/targetCargo build output (all workspace members)
*.binBinary data files (test artifacts)
/dataLocal data directory for debugging
out.txtTemporary output file
.cargo/config.tomlLocal 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:

DependencyVersionFeaturesUsage
xxhash-rust0.8.15xxh3, const_xxh3Key hashing (line 34)
memmap20.9.5-Memory-mapped file access (line 102)
crc32fast1.4.2-Entry checksum validation (line 97)
dashmap6.1.0-Concurrent KeyIndexer storage (line 27)

Optional Feature Dependencies:

DependencyVersionGated ByLine
rayon1.10.0parallel featureCargo.toml30
arrow57.0.0arrow featureCargo.toml92

Development-Only Dependencies:

DependencyVersionPurposeLine
criterion0.6.0Benchmarking harnessCargo.toml98
tempfile3.19.0Isolated test datastoresCargo.toml107
serial_test3.2.0Sequential test executionCargo.toml106
tokio1.45.1Async testing (extensions only)Cargo.toml109

Network Stack Dependencies (Muxio Framework):

DependencyVersionUsed ByLine
muxio-tokio-rpc-client0.9.0-alphasimd-r-drive-ws-clientCargo.toml86
muxio-tokio-rpc-server0.9.0-alphasimd-r-drive-ws-serverCargo.toml87
muxio-rpc-service0.9.0-alphaRPC frameworkCargo.toml88
bitcode0.6.6Binary serializationCargo.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:

  1. ${{ runner.os }} - Platform-specific cache (ubuntu/macos/windows)
  2. ${{ hashFiles('**/Cargo.lock') }} - Dependency version fingerprint
  3. ${{ 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:

FieldValuePurpose
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
publishtrueEnable 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:

Dismiss

Refresh this wiki

Enter email to refresh