GitHub

API reference for runners.

How runners talk to each other (Effect's Runners): ping a runner, send it a message, tell it a persisted message is waiting, and deliver to this runner's entities through storage.

make completes a RunnersTransport with local delivery; layer_noop serves a single runner, and layer_rpc speaks the Rpcs protocol to other runners through an RpcClientProtocol.

Values

AttributeTypeDescription
layer_noopLayer[Runners, Never, ShardingConfig | MessageStorage]

make_noop as a layer, with its own snowflake generator.

make_noopEffect[RunnersService, Never, MessageStorage | Generator | ShardingConfig | Scope]

Runners that deliver locally only.

ReplyEncodedSchemaCodec[WithExitEncoded | ChunkEncoded | bytes, Any, Never, Never]

A reply already encoded by the protocol's codec (Effect's Reply.Encoded, an opaque hole).

layer_rpcLayer[Runners, Never, MessageStorage | RpcClientProtocol | ShardingConfig]

make_rpc_runners as a layer, with its own snowflake generator.

make_rpc_clientEffect[Rpcs, Never, ClientProtocol | Scope]

A client of Rpcs over the ClientProtocol in the context.

make_rpc_runnersEffect[RunnersService, Never, Scope | RpcClientProtocol | MessageStorage | Generator | ShardingConfig]

Runners over RPC through the RpcClientProtocol (Effect's Runners.makeRpc).

Types

TypeDefinitionDescription
LocalSendErrortype LocalSendError = EntityNotAssignedToRunner | MailboxFull | AlreadyProcessingMessage

How delivering to a local entity fails.

NotifyLocalFntype NotifyLocalFn = Callable[[IncomingLocal], Effect[None, EntityNotAssignedToRunner]]
SendErrortype SendError = EntityNotAssignedToRunner | RunnerUnavailable | MailboxFull | AlreadyProcessingMessage | PersistenceError

How sending to a runner fails.

SendLocalFntype SendLocalFn = Callable[[IncomingLocal], Effect[None, LocalSendError]]

Classes

Functions

make

make(transport) -> Effect[RunnersService, Never, MessageStorage | Generator | ShardingConfig | Scope]

A Runners service sending remotely through transport and delivering locally through storage (Effect's Runners.make).

ParameterTypeDescription
transportRunnersTransport

Returns Effect[RunnersService, Never, MessageStorage | Generator | ShardingConfig | Scope]

def make(
    transport: RunnersTransport,
) -> Effect[RunnersService, Never, MessageStorage | Generator | ShardingConfig | Scope]:
    """A ``Runners`` service sending remotely through ``transport`` and
    delivering locally through storage (Effect's ``Runners.make``)."""

    @gen
    def run():
        storage = yield from MessageStorage()
        scope = yield from Scope()
        snowflakes = yield from Generator()
        config = yield from ShardingConfig()
        runners = _LocalRunners(transport, storage, scope, snowflakes)
        yield from runners._start(config.entity_reply_poll_interval)
        return cast("RunnersService", runners)

    return run