class Synapse::Repository::LockManager
Represents a mechanism for locking aggregates for modification @abstract
Public Instance Methods
obtain_lock(aggregate_id)
click to toggle source
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.
@abstract @param [Object] aggregate_id @return [undefined]
# File lib/synapse/repository/lock_manager.rb, line 21 def obtain_lock(aggregate_id) raise NotImplementedError end
release_lock(aggregate_id)
click to toggle source
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.
@abstract @param [Object] aggregate_id @return [undefined]
# File lib/synapse/repository/lock_manager.rb, line 32 def release_lock(aggregate_id) raise NotImplementedError end
validate_lock(aggregate)
click to toggle source
Ensures that the current thread holds a valid lock for the given aggregate
@abstract @param [AggregateRoot] aggregate @return [Boolean]
# File lib/synapse/repository/lock_manager.rb, line 11 def validate_lock(aggregate) raise NotImplementedError end