Class: Synapse::ProcessManager::ProcessRepository Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/process_manager/process_repository.rb

Overview

This class is abstract.

Represents a mechanism for storing and loading process instances

Direct Known Subclasses

InMemoryProcessRepository

Instance Method Summary collapse

Instance Method Details

#add(process) ⇒ undefined

This method is abstract.

Registers a newly created process with the repository

Once a process has been registered, it can be found using its correlations or by its unique identifier.

Note that if the added process is marked as inactive, it will not be stored.

Parameters:

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/synapse/process_manager/process_repository.rb', line 56

def add(process)
  raise NotImplementedError
end

#commit(process) ⇒ undefined

This method is abstract.

Commits the changes made to the process instance

If the committed process is marked as inactive, it should delete the process from the underlying storage and remove all correlations for that process.

Parameters:

Returns:

  • (undefined)

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/synapse/process_manager/process_repository.rb', line 42

def commit(process)
  raise NotImplementedError
end

#find(type, correlation) ⇒ Set

This method is abstract.

Returns a set of process identifiers for processes of the given type that have been correlated with the given key value pair

Processes that have been changed must be committed for changes to take effect

Parameters:

Returns:

  • (Set)

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/synapse/process_manager/process_repository.rb', line 15

def find(type, correlation)
  raise NotImplementedError
end

#load(id) ⇒ Process

This method is abstract.

Loads a known process by its unique identifier

Processes that have been changed must be committed for changes to take effect

Due to the concurrent nature of processes, it is not unlikely for a process to have ceased to exist after it has been found based on correlations. Therefore, a repository should gracefully handle a missing process.

Parameters:

  • id (String)

Returns:

  • (Process)

    Returns nil if process could not be found

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/synapse/process_manager/process_repository.rb', line 30

def load(id)
  raise NotImplementedError
end