The RPCs of an event log server.
Attributes#
| Attribute | Type | Description |
|---|---|---|
hello | = HelloRpc | |
authenticate | = AuthenticateRpc | |
write_chunked | = WriteChunkedRpc | |
write_single | = WriteSingleRpc | |
changes | = ChangesRpc | |
latest_sequence | = LatestSequenceRpc |
Functions#
handlers#
handlers() -> Handlers[Self, Never, Tags_contra]No handlers yet: add one per RPC with handle.
Returns Handlers[Self, Never, Tags_contra]
@classmethod
def handlers(cls) -> Handlers[Self, Never, Tags_contra]:
"""No handlers yet: add one per RPC with ``handle``."""
return Handlers(cls, {})to_layer#
to_layer[R](handlers) -> Layer[HandlersFor[Self], Never, R]The layer of the group's handlers (Effect's toLayer). Each
handler runs with the services of the layer's context. An RPC left
without a handler is a pyright error when the group lists its tags
(RpcGroup[Literal[...]]), and a ValueError here either way.
| Parameter | Type | Description |
|---|---|---|
handlers | Handlers[Self, R, Never] |
Returns Layer[HandlersFor[Self], Never, R]
@classmethod
def to_layer[R](
cls, handlers: Handlers[Self, R, Never], /
) -> Layer[HandlersFor[Self], Never, R]:
"""The layer of the group's handlers (Effect's ``toLayer``). Each
handler runs with the services of the layer's context. An RPC left
without a handler is a pyright error when the group lists its tags
(``RpcGroup[Literal[...]]``), and a ``ValueError`` here either way."""
message = cls._missing_handlers(handlers)
if message is not None:
raise ValueError(message)
return cls.to_layer_effect(succeed(handlers))to_layer_effect#
to_layer_effect[EX, RR = Never](handlers) -> Layer[HandlersFor[Self], EX, RR]to_layer with the handlers made by an effect.
| Parameter | Type | Description |
|---|---|---|
handlers | Effect[Handlers[Self, RR, Never], EX, RR] |
Returns Layer[HandlersFor[Self], EX, RR]
@classmethod
def to_layer_effect[EX, RR = Never](
cls, handlers: Effect[Handlers[Self, RR, Never], EX, RR], /
) -> Layer[HandlersFor[Self], EX, RR]:
"""``to_layer`` with the handlers made by an effect."""
require_effect(handlers, "handlers")
return layer_effect_context(handlers.flat_map(cls._handler_context))