Class: Phronomy::Persistence

Inherits:
Object
  • Object
show all
Defined in:
lib/phronomy/persistence.rb,
lib/phronomy/persistence/in_memory.rb

Defined Under Namespace

Classes: ConflictError, InMemory, NotFoundError, UnsupportedBackendError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contents:, agents:, journals:, executions:, activations:) ⇒ Persistence

Returns a new instance of Persistence.



11
12
13
14
15
16
17
18
# File 'lib/phronomy/persistence.rb', line 11

def initialize(contents:, agents:, journals:, executions:, activations:)
  @contents = contents
  @agents = agents
  @journals = journals
  @executions = executions
  @activations = activations
  validate_capabilities!
end

Instance Attribute Details

#activationsObject (readonly)

Returns the value of attribute activations.



9
10
11
# File 'lib/phronomy/persistence.rb', line 9

def activations
  @activations
end

#agentsObject (readonly)

Returns the value of attribute agents.



9
10
11
# File 'lib/phronomy/persistence.rb', line 9

def agents
  @agents
end

#contentsObject (readonly)

Returns the value of attribute contents.



9
10
11
# File 'lib/phronomy/persistence.rb', line 9

def contents
  @contents
end

#executionsObject (readonly)

Returns the value of attribute executions.



9
10
11
# File 'lib/phronomy/persistence.rb', line 9

def executions
  @executions
end

#journalsObject (readonly)

Returns the value of attribute journals.



9
10
11
# File 'lib/phronomy/persistence.rb', line 9

def journals
  @journals
end

Instance Method Details

#capabilitiesObject



20
21
22
# File 'lib/phronomy/persistence.rb', line 20

def capabilities
  {atomic_all: false, atomic_admission: false}.freeze
end

#transactionObject



24
25
26
# File 'lib/phronomy/persistence.rb', line 24

def transaction
  raise UnsupportedBackendError, "#{self.class} does not provide atomic_all"
end