A remote an event log syncs with (Effect's EventLogRemote):
write sends it entries, changes streams the entries stored
there.
Attributes#
| Attribute | Type | Description |
|---|---|---|
id | RemoteId = id | The remote's id. |
first_sequence | int | None = first_sequence | The lowest sequence the remote assigns ( |
compaction | EventLogRemoteCompaction | None = compaction | Encrypted remote compaction: present when the remote advertises
|
latest_sequence | LatestSequence | None |
|
Functions#
__init__#
__init__(id, changes, write, first_sequence=None, when_authenticated=_authenticated, latest_sequence=None, compaction=None) -> None| Parameter | Type | Description |
|---|---|---|
id | RemoteId | |
changes | Changes | |
write | WriteFn | |
first_sequence | int | None = None | |
when_authenticated | WhenAuthenticated = _authenticated | |
latest_sequence | LatestSequence | None = None | |
compaction | EventLogRemoteCompaction | None = None |
def __init__( # noqa: PLR0917
self,
id: RemoteId,
changes: Changes,
write: WriteFn,
first_sequence: int | None = None,
when_authenticated: WhenAuthenticated = _authenticated,
latest_sequence: LatestSequence | None = None,
compaction: EventLogRemoteCompaction | None = None,
) -> None:
self.id = id
self._changes = changes
self._write = write
self.first_sequence = first_sequence
self._when_authenticated = when_authenticated
self._latest_sequence = latest_sequence
self.compaction = compactionchanges#
changes(*, identity, store_id, start_sequence, known_entries=None) -> Effect[Dequeue[RemoteEntry, EventLogRemoteError], Never, Scope]A queue of the entries of store_id stored on the remote for
identity, from start_sequence on and then as they arrive,
until the Scope closes. known_entries looks up entries
stored locally, so the remote can reuse them instead of decoding
the matching changes. Making it never fails; the queue fails with
an EventLogRemoteError when the subscription does.
| Parameter | Type | Description |
|---|---|---|
identity | IdentityService | |
store_id | StoreId | |
start_sequence | int | |
known_entries | EntriesById | None = None |
Returns Effect[Dequeue[RemoteEntry, EventLogRemoteError], Never, Scope]
def changes(
self,
*,
identity: IdentityService,
store_id: StoreId,
start_sequence: int,
known_entries: EntriesById | None = None,
) -> Effect[Dequeue[RemoteEntry, EventLogRemoteError], Never, Scope]:
"""A queue of the entries of ``store_id`` stored on the remote for
``identity``, from ``start_sequence`` on and then as they arrive,
until the ``Scope`` closes. ``known_entries`` looks up entries
stored locally, so the remote can reuse them instead of decoding
the matching changes. Making it never fails; the queue fails with
an ``EventLogRemoteError`` when the subscription does."""
return self._changes(
identity=identity,
store_id=store_id,
start_sequence=start_sequence,
known_entries=known_entries,
)write#
write(*, identity, store_id, entries) -> Effect[Sequence[WriteAck] | None, EventLogRemoteError]Sends entries of store_id for identity, giving the
remote's acks (None from a remote that sends none). Fails with
an EventLogRemoteError when the remote cannot be written.
| Parameter | Type | Description |
|---|---|---|
identity | IdentityService | |
store_id | StoreId | |
entries | Sequence[Entry] |
Returns Effect[Sequence[WriteAck] | None, EventLogRemoteError]
def write(
self, *, identity: IdentityService, store_id: StoreId, entries: Sequence[Entry]
) -> Effect[Sequence[WriteAck] | None, EventLogRemoteError]:
"""Sends ``entries`` of ``store_id`` for ``identity``, giving the
remote's acks (``None`` from a remote that sends none). Fails with
an ``EventLogRemoteError`` when the remote cannot be written."""
return self._write(identity=identity, store_id=store_id, entries=entries)when_authenticated#
when_authenticated[A, E, R](effect) -> Effect[A, E | EventLogRemoteError, R | Identity]Runs effect once the Identity in the context is
authenticated with the remote; fails with an
EventLogRemoteError when authenticating does, or as effect
does.
| Parameter | Type | Description |
|---|---|---|
effect | Effect[A, E, R] |
Returns Effect[A, E | EventLogRemoteError, R | Identity]
def when_authenticated[A, E, R](
self, effect: Effect[A, E, R], /
) -> Effect[A, E | EventLogRemoteError, R | Identity]:
"""Runs ``effect`` once the ``Identity`` in the context is
authenticated with the remote; fails with an
``EventLogRemoteError`` when authenticating does, or as ``effect``
does."""
require_effect(effect, "effect")
return self._when_authenticated(effect)