Class: Synapse::Repository::LockManager Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/repository/lock_manager.rb

Overview

This class is abstract.

Represents a mechanism for locking aggregates for modification

Instance Method Summary collapse

Instance Method Details

#obtain_lock(aggregate_id) ⇒ undefined

This method is abstract.

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.

Parameters:

  • aggregate_id (Object)

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


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

This method is abstract.

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.

Parameters:

  • aggregate_id (Object)

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/synapse/repository/lock_manager.rb', line 32

def release_lock(aggregate_id)
  raise NotImplementedError
end

#validate_lock(aggregate) ⇒ Boolean

This method is abstract.

Ensures that the current thread holds a valid lock for the given aggregate

Parameters:

  • aggregate (AggregateRoot)

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/synapse/repository/lock_manager.rb', line 11

def validate_lock(aggregate)
  raise NotImplementedError
end