Interface IMaterializedLockingView<S, E, V>

Materialized Locking view interface is using/delegating a IView to handle events of type E and to maintain a state of projection(s) via ViewStateLockingRepository as a result. Essentially, it represents the query/view side of the CQRS pattern.

Author

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

Idugalic

interface IMaterializedLockingView {
    evolve: ((s, e) => S);
    fetchState: ((e) => Promise<readonly [null | S, null | V]>);
    handle: ((event) => Promise<readonly [S, V]>);
    initialState: S;
    save: ((s, currentStateVersion) => Promise<readonly [S, V]>);
}

Type Parameters

  • S

    Materialized IView state of type S

  • E

    Events of type E that are handled by this Materialized View

  • V

    Version of the state

Hierarchy

Implemented by

Properties

evolve: ((s, e) => S)

Type declaration

    • (s, e): S
    • Parameters

      • s: S
      • e: E

      Returns S

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

Type declaration

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

      Parameters

      • e: E

        Event of type E

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

      current state of type [S , V]

handle: ((event) => Promise<readonly [S, V]>)

Type declaration

    • (event): Promise<readonly [S, V]>
    • Handles the event of type E, and returns new persisted state of type S

      Parameters

      • event: E

        Event of type E to be handled

      Returns Promise<readonly [S, V]>

      State of type [S, V]

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

Type declaration

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

      Parameters

      • s: S

        State of type S

      • currentStateVersion: null | V

        State version of type V | null

      Returns Promise<readonly [S, V]>

      newly saved State of type [S, V]

Generated using TypeDoc