tpt-rust3

Rust

TUP-native edge memory and routing layer: zero-loss WAL, store-and-forward buffering, and real-time materialized state for physical assets on unreliable edge hardware.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust100.0%
README

tpt-rust3 — The Memory & Edge Routing

tpt-rust3 is the edge memory and routing layer of the wider TPT Unified Protocol (TUP) platform. It sits directly downstream of tpt-protocol: it ingests TUP envelopes, buffers them against network and power failures, stores them efficiently, and maintains a real-time materialized view of the physical world on the edge device.

Position in the TUP platform

                ┌──────────────── tpt-protocol ────────────────┐
physical field  │  modbus / j1939 / bacnet / opcua / ...        │
      │         │        │  (protocol crates normalize)         │
      │         │        ▼                                       │
      │         │   TUP DataPoint (CBOR envelope)               │
      ▼         └──────────────────────┬────────────────────────┘
  sensors/actuators                    │
                                       ▼
                         ┌────────── tpt-rust3 ──────────┐
   Ingest Path:          │  tpt-tup-router  ──► tpt-edge-wal
                         │        │             └─► tpt-state-snapshot
                         │        │  (fan-out: durability + materialized view)
                         │        ▼
                         │  tpt-sensor-health  (watchdogs on the same stream)
                         │
   Compression Path:     │  tpt-edge-wal ──► tpt-parquet-partitioner
                         │                       (with tpt-edge-compress codecs)
                         │
   Sync Path:            │  tpt-edge-buffer ──► tpt-edge-sync ──► cloud historian
                         │
                         │  tpt-edge-config  (device manifest, feeds router/monitor)
                         │  tpt-audit-trail  (tamper-evident operator-action log)
                         └──────────────────────────────────┘

Ingest Path

TUP envelopes arrive at tpt-tup-router, which routes each (device_id, point_id, channel) to subscribers. On dispatch the router fans out every sample into tpt-edge-wal (durable, crash-safe append log) and tpt-state-snapshot (always-current "last known good" view, quality-aware). tpt-sensor-health consumes the same stream to raise drift / freeze / timeout alarms.

Compression Path

Rotated, synced tpt-edge-wal segments are drained into time-partitioned Parquet by tpt-parquet-partitioner (DST-aware), with tpt-edge-compress's Gorilla codecs available for column storage.

Sync Path

tpt-edge-buffer stages unsynced records with per-record ack state, backpressure, and retry. tpt-edge-sync ships only the unsynced range to a cloud historian via a pluggable SyncClient and resolves edge/cloud conflicts (edge-authoritative by default).

See spec.txt for the full design document and crate inventory, and todo.md for the build checklist / phase plan.

Crates

Crateno_std?Role
tpt-edge-configno_std+allocHardware-port → TUP device/point manifest, hot-reload
tpt-tup-routerno_std+allocTUP-native pub/sub + topic routing
tpt-edge-walstdDurable append-only log for TUP CBOR blobs
tpt-state-snapshotno_std+allocMaterialized "last known good" view
tpt-edge-compressno_std+allocGorilla-style delta/XOR compression
tpt-parquet-partitionerstdTime-based Parquet partitioning (DST-aware)
tpt-edge-bufferstdStore-and-forward queue w/ retry + backpressure
tpt-edge-syncstdDelta-sync + conflict resolution to cloud
tpt-sensor-healthno_std+allocDrift / freeze / timeout watchdogs
tpt-audit-trailstdCryptographically chained audit log

Core principles

  1. TUP-Native Routing — the router routes on TUP asset IDs and channels, not generic strings.
  2. Zero-Loss Edge Storage — power failures and cellular dropouts must not lose telemetry.
  3. Materialized State — the last known good state is always in memory, no DB query required.

License

Dual-licensed under MIT and Apache-2.0.