Class: Stoplight::Infrastructure::Storage::CompatibilityState
- Inherits:
-
Object
- Object
- Stoplight::Infrastructure::Storage::CompatibilityState
- Defined in:
- lib/stoplight/infrastructure/storage/compatibility_state.rb
Overview
Temporary adapter that bridges Domain::Storage::State to existing DataStore.
This compatibility layer allows the state abstraction to be introduced without breaking existing data store implementations. It delegates all state operations to the data store’s original methods.
This adapter will be removed in a future versions once all data stores have native state storage implementations.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(data_store:, config:) ⇒ CompatibilityState
constructor
A new instance of CompatibilityState.
- #set_state(state) ⇒ Object
- #state_snapshot ⇒ Object
- #transition_to_color(color) ⇒ Object
Constructor Details
#initialize(data_store:, config:) ⇒ CompatibilityState
Returns a new instance of CompatibilityState.
24 25 26 27 |
# File 'lib/stoplight/infrastructure/storage/compatibility_state.rb', line 24 def initialize(data_store:, config:) @data_store = data_store @config = config end |
Instance Method Details
#clear ⇒ Object
35 |
# File 'lib/stoplight/infrastructure/storage/compatibility_state.rb', line 35 def clear = data_store.delete_light(config) |
#set_state(state) ⇒ Object
31 |
# File 'lib/stoplight/infrastructure/storage/compatibility_state.rb', line 31 def set_state(state) = data_store.set_state(config, state) |
#state_snapshot ⇒ Object
29 |
# File 'lib/stoplight/infrastructure/storage/compatibility_state.rb', line 29 def state_snapshot = data_store.get_state_snapshot(config) |
#transition_to_color(color) ⇒ Object
33 |
# File 'lib/stoplight/infrastructure/storage/compatibility_state.rb', line 33 def transition_to_color(color) = data_store.transition_to_color(config, color) |