Skip to content

unienv_interface.remote.codec

Portable v1 binary envelope. No Python object deserialization is performed.

PROTOCOL_VERSION module-attribute

PROTOCOL_VERSION: int = 1

DEFAULT_MAX_MESSAGE_SIZE module-attribute

DEFAULT_MAX_MESSAGE_SIZE: int = 64 * 1024 * 1024

CodecError

Bases: ValueError

A value or envelope cannot be represented by the v1 codec.

Codec

Codec(max_message_size: int = DEFAULT_MAX_MESSAGE_SIZE)

Encode a tagged value tree and contiguous binary attachments.

Limits apply to the whole envelope, on both send and receive. Arrays decode to independently owned NumPy memory; clients may subsequently map backends.

max_message_size instance-attribute

max_message_size = max_message_size

encode

encode(value: Any) -> bytes

decode

decode(payload: bytes) -> Any

map_arrays

map_arrays(value: Any, backend: ComputeBackend, device: Optional[object] = None) -> Any

Copy received arrays into the chosen local compute backend.