Class ModelCommitWireCodec
java.lang.Object
io.fluxzero.common.api.modeling.ModelCommitWireCodec
Compact websocket representation for the common one-event, one-target model commit.
The regular polymorphic JSON/CBOR representation remains authoritative and is used automatically for every commit shape this codec does not support. This format only removes repeated object descriptors from homogeneous transport batches; it does not combine logical commits or alter their individual request IDs, idempotency keys, results, or transaction boundaries.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RequestResultcompactAcceptedResult(long requestId, long stateIndex, Long eventIndex, long sequenceNumber, boolean historyComplete) Creates the compact transport form of an accepted single-target result without the durable commit and model identities owned by its correlated request.static booleanisCompactResult(RequestResult candidate) Returns whether a result can use the compact single-target wire representation.static booleanrequiresRequestContext(RequestResult candidate) Returns whether a decoded transport result still needs its correlated request context.static RequestResultrestoreResultContext(RequestResult candidate, CommitModels request) Completes a compact decoded result with identities owned by its correlated request.static JsonTypetryDecode(byte[] bytes) Decodes a compact batch, returningnullwhen the payload uses the ordinary transport representation.static byte[]Encodes a supported homogeneous request or result batch, returningnullwhen the ordinary transport codec should be used.
-
Method Details
-
tryEncode
Encodes a supported homogeneous request or result batch, returningnullwhen the ordinary transport codec should be used.- Throws:
IOException
-
tryDecode
Decodes a compact batch, returningnullwhen the payload uses the ordinary transport representation.- Throws:
IOException
-
restoreResultContext
Completes a compact decoded result with identities owned by its correlated request. Other result representations are returned unchanged. -
compactAcceptedResult
public static RequestResult compactAcceptedResult(long requestId, long stateIndex, Long eventIndex, long sequenceNumber, boolean historyComplete) Creates the compact transport form of an accepted single-target result without the durable commit and model identities owned by its correlated request. The SDK restores those identities before publication. -
requiresRequestContext
Returns whether a decoded transport result still needs its correlated request context. -
isCompactResult
Returns whether a result can use the compact single-target wire representation.
-