Spektrum API Reference - v1.2.0
    Preparing search index...

    Interface AttemptHandle<T>

    Handle returned by attempt(). The caller decides whether the speculative work survives (commit) or is rolled back (discard).

    interface AttemptHandle<T = any> {
        result: T;
        signal: AbortSignal;
        commit(): void;
        discard(): void;
    }

    Type Parameters

    • T = any
    Index

    Properties

    Methods

    Properties

    result: T

    Whatever the attempt callback returned (often a Promise).

    signal: AbortSignal

    The AbortSignal passed to the attempt callback. discard() aborts it, so async speculative work wired to it is cancelled.

    Methods

    • Mark the attempt as committed in history (records a checkpoint).

      Returns void

    • Replay back to before the attempt (aborting signal); the entries land on forks on the next mutation.

      Returns void