GitHub

RpcSerializationService

API reference for RpcSerializationService.

A wire format of RPC messages (Effect's RpcSerialization): make_unsafe makes a parser per connection and codec_for the codecs of the values inside messages.

Attributes

AttributeTypeDescription
content_typestr = content_type

The HTTP content type of the frames.

includes_framingbool = includes_framing

Whether a frame can hold part of a message (so a stream can be split anywhere).

codec_forCodecFor

codec_for(schema): the codec of schema's values inside messages (S.to_codec_json for the text formats). The same function for every serialization sharing it, since encode caches compare it by identity.

Functions

__init__

__init__(make_unsafe, content_type, includes_framing, codec_for) -> None
ParameterTypeDescription
make_unsafeCallable[[], Parser]
content_typestr
includes_framingbool
codec_forCodecFor
def __init__(
    self,
    make_unsafe: Callable[[], Parser],
    content_type: str,
    includes_framing: bool,
    codec_for: CodecFor,
) -> None:
    self._make_unsafe = make_unsafe
    self.content_type = content_type
    self.includes_framing = includes_framing
    self._codec_for = codec_for

make_unsafe

make_unsafe() -> Parser

A new parser, holding the state of one connection (a partly received frame, say). Its decode raises on malformed data, or MaxBufferSizeExceeded when a framed format holds more than its buffer limit of an unfinished message.

Returns Parser

def make_unsafe(self) -> Parser:
    """A new parser, holding the state of one connection (a partly
    received frame, say). Its ``decode`` raises on malformed data, or
    ``MaxBufferSizeExceeded`` when a framed format holds more than its
    buffer limit of an unfinished message."""
    return self._make_unsafe()