ViewModel property transport¶
The observable-state half of the UI connector: how a ViewModel is published,
how its fields are typed, and how the deterministic core is protected from the
UI consumer. This cluster :satisfies: UI connector (MVVM) (FEAT_0092).
A ViewModel is a fixed-layout POD struct published atomically over one
iceoryx2 service with latest-value (history-depth-1) semantics. The
producer writes the struct into a seqlock cell on the hot path (no
allocation, torn-read-safe); a non-RT publisher pump snapshots changed
ViewModels at a configurable cadence, JSON-encodes off-RT, and publishes,
coalescing intermediate values. Clients reconstruct per-field
|
The connector crate shall expose |
Each ViewModel shall be published as a single iceoryx2 pub/sub service
carrying one fixed-layout struct, published atomically (one envelope per
update) with publisher history depth 1 so that a late-joining subscriber
immediately receives the current value. Cross-property coherence shall hold
within a ViewModel (all fields of one publish share one |
The |
ViewModel and command-payload fields shall be drawn from a closed,
fixed-size POD type set: Note Partially implemented — kept ``draft``. The derive
(taktora-connector-ui-derive... (BB_0047)) implements and is tested for the scalar, fixed
array, inline bounded UTF-8 string, and C-like enum members, and
rejects the heap-backed / tagged-union / 128-bit cases at compile
time (verified by Non-POD ViewModel fields re... (TEST_0875)). The nested POD struct
member of the closed set is deferred: a nested-struct field
currently lands on a purposeful “not yet supported”
|
The |
Updating a ViewModel from the producing task shall write the POD struct
into a per-ViewModel seqlock latest-value cell with no heap allocation, no
iceoryx2 call, and no codec invocation on that path, so the update is safe
to perform from the executor’s RT context. Concurrent reads by the
publisher pump shall be torn-read-safe (seqlock retry), mirroring the
|
A non-RT publisher pump shall snapshot changed ViewModel cells, JSON-encode them off the RT thread, and publish them at a configurable UI cadence (default in the 30–60 Hz range). The producer (RT) cadence and the publish (UI) cadence shall be fully decoupled; intermediate values between two publishes shall be coalesced to the latest value (lossy by design for state properties). The pump shall not run on the executor’s WaitSet thread (mirrors Tokio sidecar contained ins... (REQ_0321) / Tokio sidecar inside the ga... (REQ_0258)). |
When iceoryx2 reports zero subscribers for a ViewModel’s service, the pump
shall skip encoding and publishing that ViewModel to avoid wasted work, and
resume on the next tick once a subscriber attaches. The manifest service
(Single instance-namespaced ... (REQ_0872)) and the |
The author shall be able to opt a single hot scalar field out of its enclosing ViewModel struct and publish it on its own iceoryx2 service, for cases where one value updates far more often than the rest of the ViewModel. The promoted field shall appear in the manifest as its own entry; default behaviour remains struct-per-ViewModel. Note Implemented in its minimal form: |
The reference client shall raise per-field |