|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
JSON wire envelope used between any client and RemoteServer. More...
#include <wire.hpp>
Public Attributes | |
| std::string | kind |
| Discriminator — see class docstring for valid values. | |
| uint64_t | callId = 0 |
| Correlation id for matching async replies to their requests. | |
| std::string | typeId |
| Model type id for register. | |
| std::string | contextKey |
| Stable identity of the model instance being registered or attached to (e.g. an account id). Empty means "no identity" — the server-side holder gets no action log attached even if a LogProvider is configured. Carried on register and attach; ignored on every other kind. | |
| std::string | primary |
| Primary key of the instance being registered or attached to. | |
| bool | shared = false |
| Whether a register should join the shared instance directory. | |
| uint64_t | modelId = 0 |
| Existing model instance id for deregister, execute, ok(register). | |
| std::string | modelType |
| Model type id for execute (routing key in ActionDispatcher). | |
| std::string | actionType |
| Action type id for execute (the second routing key). | |
| std::string | body |
| Serialized JSON of the action payload (execute) or of the deserializable result (ok). | |
| std::string | message |
| Free-text error message on err. Empty on success. | |
| ::morph::session::Context | session |
| Session context for authorization and routing. Populated on execute; ignored on every other kind. | |
| std::uint32_t | protocolVersion = 0 |
| Protocol version the sender speaks. | |
| std::uint64_t | cancelCallId = 0 |
| The callId of the execute a "cancel" asks the server to stop. | |
JSON wire envelope used between any client and RemoteServer.
Supersedes the legacy pipe-delimited protocol: a single struct carries all request and reply variants, with the kind field acting as a discriminator. Empty/zero fields are tolerated — callers populate only what their kind needs.
| std::string morph::wire::Envelope::kind |
| uint64_t morph::wire::Envelope::callId = 0 |
| std::string morph::wire::Envelope::typeId |
| std::string morph::wire::Envelope::contextKey |
Stable identity of the model instance being registered or attached to (e.g. an account id). Empty means "no identity" — the server-side holder gets no action log attached even if a LogProvider is configured. Carried on register and attach; ignored on every other kind.
| std::string morph::wire::Envelope::primary |
Primary key of the instance being registered or attached to.
Carried on register (when shared is set) and on attach, always as the key's canonical string encoding (morph::model::keyToString) whatever its C++ type, so the server's directory needs one map type rather than one per key type. Empty means "no primary" — the instance is anonymous and cannot be shared. Ignored on every other kind.
Distinct from contextKey, which continues to mean only "entity key for the action log". A keyed model will normally set both to the same value, but conflating the fields would change behaviour for callers already setting contextKey for journal purposes.
| bool morph::wire::Envelope::shared = false |
Whether a register should join the shared instance directory.
true makes the request a register-or-attach: the server returns the existing instance for (typeId, primary) if one is live, otherwise creates it and enters it in the directory. false (the default, and the value every pre-existing client sends) is today's behaviour exactly — a private instance, invisible to the directory.
| uint64_t morph::wire::Envelope::modelId = 0 |
| std::string morph::wire::Envelope::modelType |
| std::string morph::wire::Envelope::actionType |
| std::string morph::wire::Envelope::body |
| std::string morph::wire::Envelope::message |
| ::morph::session::Context morph::wire::Envelope::session |
| std::uint32_t morph::wire::Envelope::protocolVersion = 0 |
Protocol version the sender speaks.
0 means "unspecified / legacy peer" — the value on every envelope an old encoder (unaware of this field) produces, and the value an old decoder (unaware of this field) leaves untouched when it receives one from a newer peer (ignored via decode's error_on_unknown_keys = false). Populated by makeHello() on "hello"; not otherwise inspected by other kinds today.
| std::uint64_t morph::wire::Envelope::cancelCallId = 0 |
The callId of the execute a "cancel" asks the server to stop.
Carried in its own field rather than in callId because a cancel is a request with a reply of its own: were the target's id in callId, the server's ok to the cancel would be matched by the client against the still-pending execute and settle it with an empty result. 0 names no call. Ignored on every other kind.