Class: Airflow::Persistence::InMemoryRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/async_flow/persistence.rb

Direct Known Subclasses

WorkflowRunRepository

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store = {}) ⇒ InMemoryRepository

Returns a new instance of InMemoryRepository.



21
22
23
# File 'lib/async_flow/persistence.rb', line 21

def initialize(store = {})
  @store = store
end

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



19
20
21
# File 'lib/async_flow/persistence.rb', line 19

def store
  @store
end

Instance Method Details

#allObject



25
26
27
# File 'lib/async_flow/persistence.rb', line 25

def all
  store.values
end

#clearObject



33
34
35
# File 'lib/async_flow/persistence.rb', line 33

def clear
  @store = {}
end

#find(id) ⇒ Object



29
30
31
# File 'lib/async_flow/persistence.rb', line 29

def find(id)
  @store[id] || raise(EntityNotFound, "missing entity with id #{id}")
end