Tay.Executor.Protocol (tay v1.3.2)

Copy Markdown View Source

Small, transport-neutral codec for the public Executor Protocol v1.

The durable Event codec is deliberately not used here. Executor peers speak length-prefixed UTF-8 JSON so a non-BEAM runtime never has to understand ETF or Tay's on-disk value representation.

Summary

Functions

Decodes all complete frames in a byte buffer, retaining an incomplete tail.

Decodes and validates a single JSON protocol envelope.

Validates the common version, type, and request_id envelope fields.

Encodes one JSON message with an unsigned 32-bit big-endian length prefix.

Encodes one JSON-safe value and verifies its independent byte budget.

Validates portable JSON values without admitting arbitrary BEAM terms.

Types

message()

@type message() :: %{required(binary()) => term()}

Functions

decode_frames(buffer, max_frame_bytes \\ 1_048_576)

Decodes all complete frames in a byte buffer, retaining an incomplete tail.

decode_message(bytes, max_frame_bytes \\ 1_048_576)

Decodes and validates a single JSON protocol envelope.

default_max_frame_bytes()

envelope(message)

Validates the common version, type, and request_id envelope fields.

error(request_id, code, fields \\ %{})

frame(message, max_frame_bytes \\ 1_048_576)

Encodes one JSON message with an unsigned 32-bit big-endian length prefix.

identifier?(value)

json_bytes(value, max_bytes)

Encodes one JSON-safe value and verifies its independent byte budget.

json_value?(value, limits \\ %{depth: 32, nodes: 10000})

Validates portable JSON values without admitting arbitrary BEAM terms.

reply(type, request_id, fields \\ %{})

request_id(arg1)

task_key?(value)

version()