Skip to main content

Module crdt

Module crdt 

Source
Expand description

CRDT (Conflict-free Replicated Data Types) for Peat-Lite

Provides lightweight CRDT implementations optimized for BLE sync:

  • LWW-Register: Last-Writer-Wins for single values
  • G-Counter: Grow-only counter for metrics

These are designed for minimal memory footprint and efficient serialization over constrained BLE connections.

Structs§

EmergencyEvent
An emergency event with acknowledgment tracking (CRDT)
GCounter
A Grow-only Counter (G-Counter)
HealthStatus
Health status data with LWW semantics
LwwRegister
A Last-Writer-Wins Register
Peripheral
A peripheral device attached to a Node (soldier)
PeripheralEvent
An event emitted by a peripheral (e.g., tap on Core2)
Position
Position data with LWW semantics

Enums§

CrdtOperation
CRDT operation types for sync
EventType
Event types that a peripheral can emit (e.g., from tap input)
PeripheralType
Type of peripheral device

Constants§

MAX_BATTERY_PERCENT
Maximum valid battery percentage (100%)
MAX_COUNTER_ENTRIES
Maximum number of counter entries (prevents DoS)
MAX_EMERGENCY_ACKS
Maximum number of ACK entries in an emergency event (prevents DoS)
MAX_HEART_RATE
Maximum valid heart rate (BPM) - anything above is likely garbage
MIN_HEART_RATE
Minimum valid heart rate (BPM) - anything below is likely garbage
MIN_VALID_TIMESTAMP
Minimum valid timestamp: 2020-01-01 00:00:00 UTC (milliseconds) Any timestamp before this is rejected as invalid/spoofed.

Type Aliases§

Timestamp
Timestamp for CRDT operations (milliseconds since epoch or monotonic)