|
parcel 0.2.4
Wrappable, wire-transferable C++23 value system with JSON serialization
|
Parcel adapters for the comms::Lifecycle family (status history).
More...
#include <parcel/cell.h>#include <parcel/common.h>#include <parcel/defaults.h>#include <parcel/descriptor.h>#include <parcel/json.h>#include <commons/json/lifecycle.hpp>#include <commons/lifecycle.hpp>#include <compare>#include <string>#include <string_view>#include <vector>

Go to the source code of this file.
Classes | |
| class | parcel::LifecycleStatusCell |
Cell wrapping comms::LifecycleStatus. More... | |
| class | parcel::StatusTransitionCell< P > |
Cell wrapping comms::StatusTransition<typename P::storage_t>, a single transition event. More... | |
| class | parcel::StatusReportCell< P > |
Cell wrapping comms::StatusReport<typename P::storage_t>, a per-status period summary. More... | |
| class | parcel::StatusTransitionTimelineCell< P > |
Cell carrying the serializable history of a comms::StatusTransitionTimeline<typename P::storage_t>. More... | |
Parcel adapters for the comms::Lifecycle family (status history).
LifecycleStatusCell — comms::LifecycleStatus → "lifecycle_status".StatusTransitionCell<P> — comms::StatusTransition<P::storage_t> → "status_transition:" + P::kind_id.StatusReportCell<P> — comms::StatusReport<P::storage_t> → "status_report:" + P::kind_id.StatusTransitionTimelineCell<P> — the transition history of a comms::StatusTransitionTimeline<P::storage_t> → "status_transition_timeline:" + P::kind_id.The lifecycle vocabulary types are generic on a status T (not a polymorphic open set). T defaults to the built-in comms::LifecycleStatus, and so do these cells' template parameter P (which defaults to LifecycleStatusCell). The P = LifecycleStatusCell instantiations — StatusTransitionCell<> etc. — are pre-registered in the default registry; any other status cell P is opt-in, registered per element cell via StatusTransitionCell<MyStatusCell>::descriptor(), exactly like TypedListCell<P> / ChangeAuditRecordCell<P>.
The status T = P::storage_t must satisfy comms::StatusType (default- constructible, copyable, equality-comparable — any cell storage does) and be JSON-serializable (so the inherited to_json / from_json route through commons' templated hooks). Statuses are rendered for to_string() through the element cell P, so a custom status cell's own to_string() is reused.
comms::StatusTransitionTimeline<T> owns a std::mutex, so it is non-copyable and non-movable and cannot itself be a cell's storage (a cell must clone()). StatusTransitionTimelineCell<P> therefore carries the timeline's serializable projection — its std::vector<StatusTransition<T>> history, which is exactly what commons encodes on the wire (a JSON array of transitions). Bridge to/from a live timeline with the constructor that takes a StatusTransitionTimeline and load_into() (subscribers are transient and never serialized, matching commons).
Timestamps and durations encode as epoch / count milliseconds (like audit.h), so sub-millisecond system_clock ticks are truncated; use ms-aligned values when an exact round-trip matters.