The RPCs between an event log and its remote server (Effect's
eventlog/EventLogMessage).
A client says Hello (the server's remote id and a one-time
challenge), Authenticate\s an identity by signing the challenge,
then writes entries (WriteSingle, or WriteChunked parts of at
most 512,000 bytes) and streams Changes. Writes and changes carry
their entries as SchemaBinary bytes: encrypted batches, or plain
entries for an unencrypted server.
Re-exports#
Values#
| Attribute | Type | Description |
|---|---|---|
CHUNK_SIZE | Literal[512000] = 512000 | |
WRITE_ENTRIES_CODEC | BytesCodec[WriteEntries] | |
WRITE_ENTRIES_UNENCRYPTED_CODEC | BytesCodec[WriteEntriesUnencrypted] | |
CHANGES_ENCRYPTED_CODEC | BytesCodec[tuple[EncryptedRemoteBatch, ...]] | |
CHANGES_UNENCRYPTED_CODEC | BytesCodec[tuple[RemoteEntry, ...]] | |
HelloRpc | Rpc[None, HelloResponse, Never, Never, Never, Literal['EventLog.Hello']] | |
AuthenticateRpc | Rpc[Authenticate, None, EventLogProtocolError, Never, Never, Literal['EventLog.Authenticate']] | |
WriteChunkedRpc | Rpc[ChunkedMessage, tuple[WriteAck, ...], EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.WriteChunked']] | |
WriteSingleRpc | Rpc[WriteSinglePayload, tuple[WriteAck, ...], EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.WriteSingle']] | |
ChangesRpc | StreamRpc[ChangesPayload, SingleMessage | ChunkedMessage, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.Changes']] | |
LatestSequenceRpc | Rpc[LatestSequencePayload, int | None, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.LatestSequence']] | The highest sequence the server has stored for an identity's store, or
|
CompactionBeginResultSchema | UnionSchema[CompactionStarted | CompactionBusy | CompactionNotWanted, Mapping[str, object], Never, Never] | |
CompactionResultSchema | UnionSchema[CompactionSnapshot | CompactionNoOp, Mapping[str, object], Never, Never] | |
COMPACTION_INPUT_HEADERS_CODEC | BytesCodec[tuple[CompactionInputHeader, ...]] | A |
COMPACTION_SEGMENT_CODEC | BytesCodec[tuple[EncryptedBatch, ...]] | A |
CompactionStatusRpc | Rpc[CompactionScopePayload, CompactionStatus, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionStatus']] | Reports a store's compaction state. |
CompactionBeginRpc | Rpc[CompactionScopePayload, CompactionStarted | CompactionBusy | CompactionNotWanted, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionBegin']] | Opens a compaction stage. |
CompactionInputRpc | StreamRpc[CompactionStagePayload, SingleMessage | ChunkedMessage, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionInput']] | Streams a stage's input batch headers in input order: the pinned
snapshot, then the originals up to the stage's |
CompactionFetchRpc | StreamRpc[CompactionFetchPayload, SingleMessage | ChunkedMessage, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionFetch']] | Streams the encrypted input batches at the given input sequences, framed
and encoded as in |
CompactionPartRpc | Rpc[CompactionPartPayload, None, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionPart']] | Uploads one piece of a snapshot segment (an encoded non-empty array of
encrypted batches, indexed by |
CompactionAbortRpc | Rpc[CompactionStagePayload, None, EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionAbort']] | Releases an open stage. A late abort is a no-op. |
CompactionCommitRpc | Rpc[CompactionCommitPayload, Literal['Committed', 'Superseded'], EventLogProtocolError, EventLogAuthentication, EventLogAuthentication, Literal['EventLog.CompactionCommit']] | Commits a stage: |
Types#
| Type | Definition | Description |
|---|---|---|
ProtocolErrorCode | type ProtocolErrorCode = Literal['Unauthorized', 'Forbidden', 'NotFound', 'InvalidRequest', 'InternalServerError'] | |
JoinState | type JoinState = dict[int, _Parts] | |
CompactionBeginResult | type CompactionBeginResult = CompactionStarted | CompactionBusy | CompactionNotWanted | |
CompactionResult | type CompactionResult = CompactionSnapshot | CompactionNoOp |
Classes#
Functions#
encode_changes_encrypted#
encode_changes_encrypted(batches) -> Effect[bytes, S.SchemaError]A Changes frame of encrypted batches (Effect's
ChangesRpc.encodeEncrypted).
| Parameter | Type | Description |
|---|---|---|
batches | Sequence[EncryptedRemoteBatch] |
Returns Effect[bytes, S.SchemaError]
def encode_changes_encrypted(
batches: Sequence[EncryptedRemoteBatch],
) -> Effect[bytes, S.SchemaError]:
"""A ``Changes`` frame of encrypted batches (Effect's
``ChangesRpc.encodeEncrypted``)."""
return S.encode_effect(CHANGES_ENCRYPTED_CODEC)(tuple(batches))decode_changes_encrypted#
decode_changes_encrypted(data, **options) -> Effect[tuple[EncryptedRemoteBatch, ...], S.SchemaError]| Parameter | Type | Description |
|---|---|---|
data | bytes | |
options | Unpack[S.ParseOptions] = {} |
Returns Effect[tuple[EncryptedRemoteBatch, ...], S.SchemaError]
def decode_changes_encrypted(
data: bytes, **options: Unpack[S.ParseOptions]
) -> Effect[tuple[EncryptedRemoteBatch, ...], S.SchemaError]:
return S.decode_effect(CHANGES_ENCRYPTED_CODEC, **options)(data)encode_changes_unencrypted#
encode_changes_unencrypted(entries) -> Effect[bytes, S.SchemaError]A Changes frame of plain entries (Effect's
ChangesRpc.encodeUnencrypted).
| Parameter | Type | Description |
|---|---|---|
entries | Sequence[RemoteEntry] |
Returns Effect[bytes, S.SchemaError]
def encode_changes_unencrypted(entries: Sequence[RemoteEntry]) -> Effect[bytes, S.SchemaError]:
"""A ``Changes`` frame of plain entries (Effect's
``ChangesRpc.encodeUnencrypted``)."""
return S.encode_effect(CHANGES_UNENCRYPTED_CODEC)(tuple(entries))decode_changes_unencrypted#
decode_changes_unencrypted(data, **options) -> Effect[tuple[RemoteEntry, ...], S.SchemaError]| Parameter | Type | Description |
|---|---|---|
data | bytes | |
options | Unpack[S.ParseOptions] = {} |
Returns Effect[tuple[RemoteEntry, ...], S.SchemaError]
def decode_changes_unencrypted(
data: bytes, **options: Unpack[S.ParseOptions]
) -> Effect[tuple[RemoteEntry, ...], S.SchemaError]:
return S.decode_effect(CHANGES_UNENCRYPTED_CODEC, **options)(data)encode_compaction_input_headers#
encode_compaction_input_headers(headers) -> Effect[bytes, S.SchemaError]| Parameter | Type | Description |
|---|---|---|
headers | Sequence[CompactionInputHeader] |
Returns Effect[bytes, S.SchemaError]
def encode_compaction_input_headers(
headers: Sequence[CompactionInputHeader],
) -> Effect[bytes, S.SchemaError]:
return S.encode_effect(COMPACTION_INPUT_HEADERS_CODEC)(tuple(headers))decode_compaction_input_headers#
decode_compaction_input_headers(data, **options) -> Effect[tuple[CompactionInputHeader, ...], S.SchemaError]| Parameter | Type | Description |
|---|---|---|
data | bytes | |
options | Unpack[S.ParseOptions] = {} |
Returns Effect[tuple[CompactionInputHeader, ...], S.SchemaError]
def decode_compaction_input_headers(
data: bytes, **options: Unpack[S.ParseOptions]
) -> Effect[tuple[CompactionInputHeader, ...], S.SchemaError]:
return S.decode_effect(COMPACTION_INPUT_HEADERS_CODEC, **options)(data)encode_compaction_segment#
encode_compaction_segment(batches) -> Effect[bytes, S.SchemaError]| Parameter | Type | Description |
|---|---|---|
batches | Sequence[EncryptedBatch] |
Returns Effect[bytes, S.SchemaError]
def encode_compaction_segment(batches: Sequence[EncryptedBatch]) -> Effect[bytes, S.SchemaError]:
return S.encode_effect(COMPACTION_SEGMENT_CODEC)(tuple(batches))decode_compaction_segment#
decode_compaction_segment(data, **options) -> Effect[tuple[EncryptedBatch, ...], S.SchemaError]| Parameter | Type | Description |
|---|---|---|
data | bytes | |
options | Unpack[S.ParseOptions] = {} |
Returns Effect[tuple[EncryptedBatch, ...], S.SchemaError]
def decode_compaction_segment(
data: bytes, **options: Unpack[S.ParseOptions]
) -> Effect[tuple[EncryptedBatch, ...], S.SchemaError]:
return S.decode_effect(COMPACTION_SEGMENT_CODEC, **options)(data)