Distributed Sensor Hub is a decentralized runtime where each node executes the same stack:
- sensor production
- local state merge/store
- peer membership + failure detection
- TCP protocol transport/dispatch
- HTTP read API
No coordinator is required for normal operation.
- System architecture (distributed nodes):
docs/diagrams/src/distributed-system-architecture.dot - Internal node layered architecture:
docs/diagrams/src/node-internal-layered-architecture.dot - Observability flow architecture:
docs/diagrams/src/observability-flow-architecture.dot
| Module | Responsibility | Reference |
|---|---|---|
runtime |
Composition root, startup/shutdown ordering, background loops | runtime/README.md |
protocol |
Message types/contracts, codec, dispatcher, protocol handlers | protocol/README.md |
networking |
Length-prefixed TCP transport, reconnect/send queues | networking/README.md |
membership |
Peer table, liveness metadata, merge of membership views | membership/README.md |
fd |
Phi-accrual computation and detector-local status | fd/README.md |
gossip |
Best-effort dissemination of membership snapshots | gossip/README.md |
state |
Authoritative local winners and replication deltas | state/README.md |
sensors |
Provider lifecycle and conversion to canonical events | sensors/README.md |
topology |
Policy-driven connection target selection | topology/README.md |
introspection |
Aggregate read-only observability snapshots | introspection/README.md |
webapi |
Read-only HTTP observation endpoints | webapi/README.md |
web |
Static browser observability dashboard | web/README.md |
utils |
Shared configuration, logging, and typing helpers | utils/README.md |
- Load config and logging.
- Start state worker first.
- Wire networking + protocol dispatcher + peer table.
- Seed bootstrap peers and send
JOIN_REQUEST. - Request initial
FULL_SYNC. - Start heartbeat loop (
PING/PONG+ membership gossip + phi evaluation). - Start sensor providers and periodic push/pull replication.
- Expose HTTP snapshots via Web API.
- Membership discovery:
JOIN_REQUEST,PEER_LIST - Liveness:
PING,PONG - State replication:
SENSOR_UPDATE - Membership dissemination:
GOSSIP_STATE - Incremental sync:
GET_DELTA,DELTA_UNAVAILABLE - Full sync:
FULL_SYNC_REQUEST,FULL_SYNC_RESPONSE - Reserved:
ERROR,ACK(registered placeholders)
- State convergence uses LWW ordering
(ts_ms, origin). - Incremental replication cursors use monotonic per-node
seqvalues (transport only, not conflict resolution). - Replication is periodic push/pull and best-effort.
- Membership convergence uses gossip merge with last-write-wins on
status_ts_ms. - Liveness suspicion is local phi-accrual (
alive,suspected,dead) and then disseminated.
- Separate membership data from sensor-state data.
- Keep sensor providers decoupled from networking/protocol.
- Keep transport concerns (
networking) isolated from protocol semantics (protocol). - Maintain independent incremental streams for UI and replication consumers.