R-01 Domain Model (Draft)
Based on Target Architecture (Draft). For implementation, this document plus the code in
crates/meshlet-plannerare authoritative.
Five resource types (distinct, per Decision 4)
| Type | What it holds |
|---|---|
| Network | the virtual network itself (ID, name, Overlay CIDR, default Segment). |
| Segment | a trust group within a Network (policy template, member authorization). |
| Route | a published LAN route (prefix, owner, gateway, metric, health conditions, failover). |
| Alias | a mapping for overlapping address space (translation rules between a local LAN and a remote site). |
| PortForward | an L4 entry point (TCP/UDP, listener binding, target service, authorization, health probe). |
| HttpExposure | domain/path to service (including TLS termination policy). |
Device and NetworkAttachment are separate
- Device: device identity (public key, platform, registration/revocation state).
- NetworkAttachment: a device's membership in one Network (Overlay address, Segments, enabled state).
Revision state machine (no single Applied state)
Pending → Preparing → Applying → Succeeded; failure path: Failed → RollingBack → RolledBack.
Valid transitions are defined by can_transition_to in crates/meshlet-planner/src/lib.rs. Rollback creates a new revision (Decision 6).
Four state categories are never mixed
- DesiredState — desired state; the single source of truth.
- Revision/Plan/Receipt — execution records; immutable.
- ObservedState — actual kernel state; input for drift detection.
- Audit — audit history with a hash chain.