Skip to content

0.10.0

Compare
Choose a tag to compare
@angelo-rendina-prima angelo-rendina-prima released this 01 Dec 10:34
· 56 commits to master since this release
241903c

[[#133]]: atomic read/writes rework to avoid deadlocks in Policies.

Changed

  • Aggregate:
    • apply_events has been removed, and its default implementation moved to a method of AggregateState.
  • AggregateManager:
    • lock_and_load acquires a lock, then loads into memory the AggregateState
      preventing other atomic accesses. Dropping the AggregateState releases the resource.
    • lock has been removed in favour of lock_and_load.
    • handle_command does not return the AggregateState anymore. This avoids race conditions where the
      returned state is already outdated, if another concurrent access has taken place at the same time.
    • apply_events has been removed, and its default implementation moved to a method of AggregateState.
    • load has been changed to return a Result<Option<_>, _>, to explicit expose errors.
  • AggregateState:
    • new lock field, which contains the exclusive access guard created when lock_and_loading.
      All other fields are now private for better encapsulation.
    • new takes no argument, and generates a new state with a random UUID.
    • with_id generates a new state with the given UUID.
    • apply_store_events applies the given list of Events on self.
    • set_lock and take_lock methods to set and get the lock,
      to use when overriding the AggregateManager functionality.

Commits

  • v0.10.0 (#134) by angelo-rendina-prima
  • lock inside state (#133) by angelo-rendina-prima