Class ModelCommitWireCodec

java.lang.Object
io.fluxzero.common.api.modeling.ModelCommitWireCodec

public final class ModelCommitWireCodec extends Object
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 Details

    • tryEncode

      public static byte[] tryEncode(JsonType value) throws IOException
      Encodes a supported homogeneous request or result batch, returning null when the ordinary transport codec should be used.
      Throws:
      IOException
    • tryDecode

      public static JsonType tryDecode(byte[] bytes) throws IOException
      Decodes a compact batch, returning null when the payload uses the ordinary transport representation.
      Throws:
      IOException
    • restoreResultContext

      public static RequestResult restoreResultContext(RequestResult candidate, CommitModels request)
      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

      public static boolean requiresRequestContext(RequestResult candidate)
      Returns whether a decoded transport result still needs its correlated request context.
    • isCompactResult

      public static boolean isCompactResult(RequestResult candidate)
      Returns whether a result can use the compact single-target wire representation.