GitHub

event_log_remote

API reference for event_log_remote.

Remotes an event log syncs with (Effect's eventlog/EventLogRemote).

A remote sends the journal's new entries with write and streams the entries others wrote with changes. make_encrypted and make_unencrypted are remotes over the EventLogRemoteRpcs of an EventLogRemoteClient; they authenticate each identity once (again after a Forbidden) and register with the log's Registry.

Re-exports

Values

AttributeTypeDescription
layer_clientLayer[EventLogRemoteClient, Never, ClientProtocol]

EventLogRemoteClient over the ClientProtocol, with both groups.

make_encryptedEffect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | EventLogEncryption | Registry]

A remote sending entries encrypted with the EventLogEncryption (make_encrypted_with opts out of running compaction).

make_unencryptedEffect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | Registry]

A remote sending plain entries (to an unencrypted server).

layer_encryptedLayer[EventLogRemote, EventLogRemoteError, ClientProtocol | Registry]

An encrypted remote over the ClientProtocol (layer_encrypted_with opts out of running compaction).

layer_unencryptedLayer[EventLogRemote, EventLogRemoteError, ClientProtocol | Registry]

An unencrypted remote over the ClientProtocol.

Types

TypeDefinitionDescription
EncodeWritetype EncodeWrite = Callable[[IdentityService, StoreId, Sequence[Entry]], Effect[bytes, SchemaError]]
DecodeChangestype DecodeChanges = Callable[[IdentityService, StoreId, bytes, EntriesById | None], Effect[Sequence[RemoteEntry], SchemaError | EventJournalError]]
MakeCompactiontype MakeCompaction = Callable[[RemoteSession, EventLogRemoteRpcs], EventLogRemoteCompaction | None]

Classes

Functions

make_with

make_with(encode_write, decode_changes) -> Effect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | Registry]

A remote over the EventLogRemoteClient writing entries encoded by encode_write and decoding changes with decode_changes, registered with the Registry until the scope closes.

ParameterTypeDescription
encode_writeEncodeWrite
decode_changesDecodeChanges

Returns Effect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | Registry]

def make_with(
    encode_write: EncodeWrite, decode_changes: DecodeChanges
) -> Effect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | Registry]:
    """A remote over the ``EventLogRemoteClient`` writing entries encoded
    by ``encode_write`` and decoding changes with ``decode_changes``,
    registered with the ``Registry`` until the scope closes."""
    return _make_remote(encode_write, decode_changes, None)

make_encrypted_with

make_encrypted_with(*, compaction=True) -> Effect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | EventLogEncryption | Registry]

A remote sending entries encrypted with the EventLogEncryption. It has a compaction member when the server advertises compaction and the RPC client includes EventLogCompactionRpcs, unless built with compaction=False; without one this client never calls the compaction RPCs.

ParameterTypeDescription
compactionbool = True

Returns Effect[EventLogRemoteService, EventLogRemoteError, Scope | EventLogRemoteClient | EventLogEncryption | Registry]

def make_encrypted_with(
    *, compaction: bool = True
) -> Effect[
    EventLogRemoteService,
    EventLogRemoteError,
    Scope | EventLogRemoteClient | EventLogEncryption | Registry,
]:
    """A remote sending entries encrypted with the ``EventLogEncryption``.
    It has a ``compaction`` member when the server advertises compaction and
    the RPC client includes ``EventLogCompactionRpcs``, unless built with
    ``compaction=False``; without one this client never calls the
    compaction RPCs."""
    return gen(lambda: _encrypted(compaction))

layer_encrypted_with

layer_encrypted_with(*, compaction=True) -> Layer[EventLogRemote, EventLogRemoteError, ClientProtocol | Registry]

An encrypted remote over the ClientProtocol; compaction=False leaves it without its compaction member, so this client never calls the compaction RPCs.

ParameterTypeDescription
compactionbool = True

Returns Layer[EventLogRemote, EventLogRemoteError, ClientProtocol | Registry]

def layer_encrypted_with(
    *, compaction: bool = True
) -> Layer[EventLogRemote, EventLogRemoteError, ClientProtocol | Registry]:
    """An encrypted remote over the ``ClientProtocol``; ``compaction=False``
    leaves it without its ``compaction`` member, so this client never calls
    the compaction RPCs."""
    return (
        layer_effect(EventLogRemote, make_encrypted_with(compaction=compaction))
        .pipe(layer_provide(layer_client))
        .pipe(layer_provide(layer_subtle))
    )