Class: RServiceBus2::SagaStorageInMemory
- Inherits:
-
Object
- Object
- RServiceBus2::SagaStorageInMemory
- Defined in:
- lib/rservicebus2/saga_storage/inmemory.rb
Overview
Saga Storage In Memory
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#begin ⇒ Object
Start.
-
#commit ⇒ Object
Finish.
- #delete(correlation_id) ⇒ Object
-
#get(correlation_id) ⇒ Object
Get.
-
#initialize(_uri) ⇒ SagaStorageInMemory
constructor
A new instance of SagaStorageInMemory.
- #rollback ⇒ Object
-
#set(data) ⇒ Object
Set.
Constructor Details
#initialize(_uri) ⇒ SagaStorageInMemory
Returns a new instance of SagaStorageInMemory.
6 7 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 6 def initialize(_uri) end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
4 5 6 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 4 def hash @hash end |
Instance Method Details
#begin ⇒ Object
Start
10 11 12 13 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 10 def begin @hash = {} @deleted = {} end |
#commit ⇒ Object
Finish
26 27 28 29 30 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 26 def commit @deleted.each do |correlation_id| @hash.delete(correlation_id) end end |
#delete(correlation_id) ⇒ Object
32 33 34 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 32 def delete(correlation_id) @deleted[correlation_id] = correlation_id end |
#get(correlation_id) ⇒ Object
Get
21 22 23 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 21 def get(correlation_id) @hash[correlation_id] end |
#rollback ⇒ Object
36 37 38 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 36 def rollback @deleted = {} end |
#set(data) ⇒ Object
Set
16 17 18 |
# File 'lib/rservicebus2/saga_storage/inmemory.rb', line 16 def set(data) @hash[data.correlation_id] = data end |