A client transport (Effect's RpcClient.Protocol): run
delivers the responses for a client, send writes its messages.
with_run_client builds one from its parts.
Attributes#
| Attribute | Type | Description |
|---|---|---|
supports_ack | bool = supports_ack | Whether the server expects an |
codec_for | CodecFor |
|
Functions#
__init__#
__init__(run, send, supports_ack, codec_for) -> None| Parameter | Type | Description |
|---|---|---|
run | Callable[[int, WriteResponse], Effect[Never]] | |
send | Callable[[int, Message], Effect[None, RpcClientError]] | |
supports_ack | bool | |
codec_for | CodecFor |
def __init__(
self,
run: Callable[[int, WriteResponse], Effect[Never]],
send: Callable[[int, Message], Effect[None, RpcClientError]],
supports_ack: bool,
codec_for: CodecFor,
) -> None:
self._run = run
self._send = send
self.supports_ack = supports_ack
self._codec_for = codec_forrun#
run(client_id, f) -> Effect[Never]Hands each encoded response for client_id to f, until
interrupted (it never returns and never fails).
| Parameter | Type | Description |
|---|---|---|
client_id | int | |
f | WriteResponse |
Returns Effect[Never]
def run(self, client_id: int, f: WriteResponse) -> Effect[Never]:
"""Hands each encoded response for ``client_id`` to ``f``, until
interrupted (it never returns and never fails)."""
return self._run(client_id, f)send#
send(client_id, message) -> Effect[None, RpcClientError]Writes the encoded message of client_id; fails with
RpcClientError when the transport cannot write it (and, for a
protocol from with_run_client, once its scope has closed).
| Parameter | Type | Description |
|---|---|---|
client_id | int | |
message | Message |
Returns Effect[None, RpcClientError]
def send(self, client_id: int, message: Message) -> Effect[None, RpcClientError]:
"""Writes the encoded ``message`` of ``client_id``; fails with
``RpcClientError`` when the transport cannot write it (and, for a
protocol from ``with_run_client``, once its scope has closed)."""
return self._send(client_id, message)