Class CanvasPayload

java.lang.Object
protocols.apps.canvas.CanvasPayload

public final class CanvasPayload extends Object
The canvas's "application protocol" that rides inside the gossip broadcast's opaque byte[] payload. The dissemination layer doesn't know or care what these bytes mean — that's the point of layering: gossip moves bytes; the canvas decides they are a PaintOp.

One paint operation travels per broadcast. We hand-roll the encoding with DataOutputStream (delegating to PaintOp.writeTo(java.io.DataOutputStream)) so the wire format is obvious and matches the snapshot encoding used for sync.

  • Method Details

    • encode

      public static byte[] encode(PaintOp op)
      Serialize a paint op to the bytes carried inside a broadcast message.
    • decode

      public static PaintOp decode(byte[] bytes)
      Parse the bytes delivered by the gossip layer back into a paint op.