Class StateStoredLockingAggregate<C, S, E, V>

State stored locking aggregate is using/delegating a decider of type Decider<C, S, E> to handle commands and produce new state. In order to handle the command, aggregate needs to fetch the current state via StateLockingRepository.fetchState function first, and then delegate the command to the decider which can produce new state as a result.

New state is then stored via StateLockingRepository.save function.

Author

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

Idugalic

Type Parameters

  • C

    Commands of type C that this aggregate can handle

  • S

    Aggregate state of type S

  • E

    Events of type E that this aggregate can publish

  • V

    The Version of the stored State

Hierarchy

Implements

Constructors

Properties

decider: IDecider<C, S, E>
initialState: S
stateRepository: StateLockingRepository<C, S, V>

Methods

  • 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