Class: Synapse::Repository::LockManager Abstract
- Inherits:
-
Object
- Object
- Synapse::Repository::LockManager
- Defined in:
- lib/synapse/repository/lock_manager.rb
Overview
Represents a mechanism for locking aggregates for modification
Direct Known Subclasses
NullLockManager, OptimisticLockManager, PessimisticLockManager
Instance Method Summary collapse
-
#obtain_lock(aggregate_id) ⇒ undefined
abstract
Obtains a lock for an aggregate with the given aggregate identifier.
-
#release_lock(aggregate_id) ⇒ undefined
abstract
Releases the lock held for an aggregate with the given aggregate identifier.
-
#validate_lock(aggregate) ⇒ Boolean
abstract
Ensures that the current thread holds a valid lock for the given aggregate.
Instance Method Details
#obtain_lock(aggregate_id) ⇒ undefined
Obtains a lock for an aggregate with the given aggregate identifier. Depending on the strategy, this method may return immediately or block until a lock is held.
21 22 23 |
# File 'lib/synapse/repository/lock_manager.rb', line 21 def obtain_lock(aggregate_id) raise NotImplementedError end |
#release_lock(aggregate_id) ⇒ undefined
Releases the lock held for an aggregate with the given aggregate identifier. The caller of this method must ensure a valid lock was requested using #obtain_lock. If no lock was successfully obtained, the behavior of this method is undefined.
32 33 34 |
# File 'lib/synapse/repository/lock_manager.rb', line 32 def release_lock(aggregate_id) raise NotImplementedError end |
#validate_lock(aggregate) ⇒ Boolean
Ensures that the current thread holds a valid lock for the given aggregate
11 12 13 |
# File 'lib/synapse/repository/lock_manager.rb', line 11 def validate_lock(aggregate) raise NotImplementedError end |