@dxos/compute - v0.16.0
    Preparing search index...

    Interface Durable<S>

    A reducer whose state can be stored, so a reader resumes from a saved checkpoint instead of refolding the feed.

    interface Durable<S> {
        fold?: (state: S, events: readonly Trajectory.Event[]) => S;
        id: string;
        initial: S;
        rebind?: (state: S, makeRef: MakeRef) => S;
        schema: Codec<S, unknown>;
        step: (state: S, event: Trajectory.Event) => S;
    }

    Type Parameters

    • S

    Hierarchy (View Summary)

    Index

    Properties

    fold?: (state: S, events: readonly Trajectory.Event[]) => S

    Folds a batch at once, equal to stepping each event; lets a reducer copy its state once per batch rather than once per event, which keeps a long fold linear. The state passed in is never modified.

    id: string

    Names the reducer and its state shape; a stored checkpoint under a different id is never read back.

    initial: S
    rebind?: (state: S, makeRef: MakeRef) => S

    Points decoded refs at a database, since a stored ref keeps its URI but not what resolves it.

    schema: Codec<S, unknown>
    step: (state: S, event: Trajectory.Event) => S