functai for TypeScript - v0.1.0
    Preparing search index...

    Interface EventStore

    Anything that keeps logs for others to read: a journal's store. Each claim and each append is one step per log. A store that cannot take a claim and an append as one step (a compare-and-set) gives no claim.

    interface EventStore {
        writer?: number;
        append(
            events: readonly Readonly<Rec>[],
            opts?: { signal?: AbortSignal },
        ): Promise<AppendAnswer>;
        claim?(tree: string): Promise<ClaimAnswer>;
        read(
            tree: string,
            after: Position | null,
        ): Promise<ReadAnswer<StreamEvent>>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    writer?: number

    The writer whose process this is; absent for a store.

    • Append one log's events, in order, as one step: kept whole or not at all. Answer "kept", "duplicate" or a refusal. Throwing, rejecting or not answering in time is no answer (the events are sent again); any other answer is a refusal. The events are the store's own copies. signal aborts when the journal stops waiting for this append (its timeout): stop then if you can; a late answer is not read (the writer sends again, and a kept event is then a duplicate).

      Parameters

      • events: readonly Readonly<Rec>[]
      • Optionalopts: { signal?: AbortSignal }

      Returns Promise<AppendAnswer>

    • A later writer claims an unfinished log: the next writer number, fencing every earlier one.

      Parameters

      • tree: string

      Returns Promise<ClaimAnswer>