Abstract interface representing an event log

interface EventLog<T extends LogEntry> {
    addEntry(entry: T, sequenceId: bigint): ResultAsync<void, AddEntryError>;
    query(
        start: bigint | "snapshot" | "start",
        end: bigint | "end",
    ): ResultAsync<QueryValue<T>, QueryError>;
    setMetadata(
        sequenceId: bigint,
        metaData: LogMetadata,
    ): ResultAsync<void, MetadataError>;
    truncate(start: bigint): ResultAsync<void, TruncateError>;
}

Type Parameters

Implemented by

Methods

  • Return a range of entries from first to last inclusive

    The event log may return fewer entries than requested. If so, repeat the query starting from nextSequenceId.

    Parameters

    • start: bigint | "snapshot" | "start"

      SequenceId of first entry to return. Use 'start' to query from the first entry in the log. Use 'snapshot' to query from the most recent entry with a snapshot, or the first if no snapshot is defined.

    • end: bigint | "end"

      SequenceId one after the last entry to return. Use 'end' to query everything to the end of the log.

    Returns ResultAsync<QueryValue<T>, QueryError>