Interface StateLockingRepository<C, S, V>

State Locking repository interface

Author

Иван Дугалић / Ivan Dugalic /

Idugalic

interface StateLockingRepository {
    fetchState: ((c) => Promise<readonly [null | S, null | V]>);
    save: ((s, v) => Promise<readonly [S, V]>);
}

Type Parameters

  • C

    Command

  • S

    State

  • V

    Version

Hierarchy

Properties

Properties

fetchState: ((c) => Promise<readonly [null | S, null | V]>)

Type declaration

    • (c): Promise<readonly [null | S, null | V]>
    • Fetch state and version

      Parameters

      • c: C

        Command of type C

      Returns Promise<readonly [null | S, null | V]>

      the pair of current State/[S] and current Version/[V]

save: ((s, v) => Promise<readonly [S, V]>)

Type declaration

    • (s, v): Promise<readonly [S, V]>
    • Save state

      You can update/save the item/state, but only if the version number in the storage has not changed.

      Parameters

      • s: S

        State of type S

      • v: null | V

        The current version of the state

      Returns Promise<readonly [S, V]>

      newly saved State of type [S, V]

Generated using TypeDoc