crdtosphere

Crates.iocrdtosphere
lib.rscrdtosphere
version0.1.0
created_at2025-06-05 18:35:33.963786+00
updated_at2025-06-05 18:35:33.963786+00
descriptionUniversal embedded CRDTs for distributed coordination across automotive, robotics, IoT, and industrial applications
homepagehttps://github.com/vertexclique/crdtosphere
repositoryhttps://github.com/vertexclique/crdtosphere
max_upload_size
id1702094
size998,544
Theo M. Bulut (vertexclique)

documentation

https://docs.rs/crdtosphere

README

CRDTosphere: Universal Embedded CRDTs for Distributed Coordination

Crates.io version Download docs.rs docs Build Status

API Docs | Examples | Contributing | Discussions

CRDTosphere is a comprehensive no_std Rust library implementing Conflict-free Replicated Data Types (CRDTs) optimized for embedded systems. It provides ultra-efficient, configurable CRDT implementations for automotive, robotics, IoT, and industrial applications across multiple platforms.

IMPORTANT SAFETY DISCLAIMER

This library is intended for NON-SAFETY-CRITICAL applications only. While CRDTosphere includes safety-oriented features and compliance support frameworks, it should NOT be used for safety-critical functions such as:

  • Primary vehicle control systems (steering, braking, acceleration)
  • Life-support or medical devices
  • Flight control systems
  • Nuclear reactor control
  • Emergency shutdown systems

Recommended Use Cases:

  • Infotainment systems
  • Telematics and connectivity features
  • Non-critical sensor data aggregation
  • Configuration management
  • Diagnostic and monitoring systems
  • User preference synchronization

The automotive examples in this library are for educational and demonstration purposes only. Any production automotive use should be limited to non-safety-critical domains such as infotainment, user preferences, and diagnostic data collection.

Features

  • Universal Platform Support - AURIX, STM32, ARM Cortex-M, RISC-V
  • Configurable Memory - 2KB to 1MB+ budgets with compile-time verification
  • Multi-Domain Ready - Automotive, robotics, IoT, industrial applications
  • Safety Critical - ISO 26262, IEC 61508, DO-178C compliance support
  • Ultra-Efficient - 5-100 byte CRDT instances with hardware optimizations
  • No Dynamic Allocation - Pure static allocation for deterministic behavior
  • Real-Time Guarantees - Bounded execution time (<1000 CPU cycles)

Quick Start

Add CRDTosphere to your Cargo.toml:

[dependencies]
crdtosphere = { version = "0.1", default-features = false }

# Enable platform-specific optimizations
[features]
stm32 = ["crdtosphere/stm32"]
# OR
aurix = ["crdtosphere/aurix"]

Configure memory for your platform:

#![no_std]
use crdtosphere::prelude::*;

// Define memory configuration for your platform
define_memory_config! {
    name: MyPlatformConfig,
    total_memory: 32 * 1024,  // 32KB budget
    max_registers: 100,
    max_counters: 50,
    max_sets: 20,
    max_maps: 10,
    max_nodes: 32,
}

// Use configurable CRDTs
let mut sensor_reading = LWWRegister::<i16, MyPlatformConfig>::new();
sensor_reading.set(42, clock.now());

// Automatic conflict resolution
sensor_reading.merge(&other_node_reading)?;

Platform Support

Platform Architecture Memory Use Cases
AURIX TC3xx/TC4xx TriCore/ARM Cortex-R52 240KB-1MB Automotive ECUs, safety systems
STM32 Series ARM Cortex-M0/M3/M4/M7 4KB-2MB General embedded, IoT, robotics
ARM Cortex-M M0/M0+/M3/M4/M7 2KB-1MB+ IoT devices, sensor networks
RISC-V RV32I/M/A/C 32KB-8MB+ Edge computing, custom applications

Domain Applications

Automotive

// Multi-ECU sensor fusion with ISO 26262 compliance
let mut temp_fusion = AutomotiveSensorFusion::<i16, AutomotiveConfig>::new();
temp_fusion.add_reading(85, ecu_1_clock, SENSOR_RELIABILITY_HIGH);
temp_fusion.add_reading(87, ecu_2_clock, SENSOR_RELIABILITY_MEDIUM);
let consensus_temp = temp_fusion.consensus_value();

Robotics

// Multi-robot task allocation
let mut task_allocation = RobotTaskAllocation::<RoboticsConfig>::new();
task_allocation.assign_task(task_id, robot_id, clock.now());

IoT

// Device mesh coordination
let mut device_mesh = DeviceMesh::<IoTConfig>::new();
device_mesh.add_device(device_id, capabilities, clock.now());

Industrial

// Equipment health monitoring
let mut equipment_health = EquipmentHealth::<IndustrialConfig>::new();
equipment_health.record_vibration(machine_id, level, clock.now());

Memory Configurations

Pre-configured setups for common platforms:

// High-performance automotive ECU
use crdtosphere::configs::AutomotiveECUConfig;  // 128KB budget

// General embedded device
use crdtosphere::configs::STM32F4Config;        // 32KB budget

// Constrained IoT sensor
use crdtosphere::configs::IoTSensorConfig;      // 4KB budget

// Industrial controller
use crdtosphere::configs::IndustrialConfig;     // 256KB budget

Examples

  • Automotive - ECU coordination, sensor fusion, safety systems
  • Robotics - Swarm coordination, task allocation, SLAM
  • IoT - Device mesh, sensor networks, low-power coordination
  • Industrial - Production monitoring, predictive maintenance
  • Platforms - Platform-specific optimizations

CRDT Types

Type Description Memory Use Case
LWWRegister Last-writer-wins register 5-16 bytes Sensor readings, configuration
GCounter Grow-only counter 8-32 bytes Event counting, telemetry
ORSet Observed-remove set 6-64 bytes Feature flags, device lists
LWWMap Last-writer-wins map Variable Key-value configuration

Safety & Compliance

  • ISO 26262 (Automotive) - ASIL-A through ASIL-D support
  • IEC 61508 (Industrial) - SIL-1 through SIL-4 support
  • DO-178C (Aerospace) - DAL-A through DAL-E support
  • Deterministic behavior with mathematical convergence guarantees
  • Bounded execution time for real-time systems

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  • Bug Reports - GitHub Issues
  • Feature Requests - GitHub Discussions
  • Documentation - Help improve our docs
  • Testing - Add tests for new platforms or use cases

License

Licensed under either of

at your option.


Built with ❤️ for the embedded systems community by vertexclique
Commit count: 8

cargo fmt