Module: Stoplight::Domain::_DataStore

Included in:
Infrastructure::FailSafe::DataStore, Infrastructure::Memory::DataStore, Infrastructure::Redis::DataStore
Defined in:
sig/_private/stoplight/domain/ports/data_store.rbs

Instance Method Summary collapse

Instance Method Details

#acquire_recovery_lock_RecoveryLockToken?

Acquires recovery lock for serializing probe execution.

Parameters:

Returns:



43
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 43

def acquire_recovery_lock: (Config) -> _RecoveryLockToken?

#clear_metricsvoid

This method returns an undefined value.

Clears windowed metrics (successes/errors) to prevent stale failures from before recovery from affecting post-recovery decisions. Consecutive counts are intentionally preserved as they track current streaks.

Parameters:



23
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 23

def clear_metrics: (Config) -> void

#clear_recovery_metricsvoid

This method returns an undefined value.

Parameters:



25
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 25

def clear_recovery_metrics: (Config) -> void

#delete_lightvoid

This method returns an undefined value.

Deletes metadata (and related persistent state) for the given light.

Implementations may choose to only remove metadata; metrics may expire via TTL.

Parameters:



73
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 73

def delete_light: (Config) -> void

#get_metricsDomain::MetricsSnapshot

Retrieves metrics for a specific light configuration.

Parameters:

Returns:



12
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 12

def get_metrics: (Config) -> Domain::MetricsSnapshot

#get_recovery_metricsDomain::MetricsSnapshot

Retrieves recovery metrics for a specific light configuration.

Parameters:

Returns:



15
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 15

def get_recovery_metrics: (Config) -> Domain::MetricsSnapshot

#get_state_snapshotStateSnapshot

Retrieves State Snapshot for a specific light configuration.

Parameters:

Returns:



18
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 18

def get_state_snapshot: (Config) -> StateSnapshot

#namesObject

Retrieves the names of all lights stored in the data store.

Returns:

  • An array of light names.



9
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 9

def names: -> Array[String]

#record_failurevoid

This method returns an undefined value.

Records a failure for a specific light configuration.

Parameters:

  • (Config)
  • exception (StandardError)


28
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 28

def record_failure: (Config, StandardError exception) -> void

#record_recovery_probe_failurevoid

This method returns an undefined value.

Records a failed recovery probe for a specific light configuration.

Parameters:

  • (Config)
  • exception (StandardError)


34
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 34

def record_recovery_probe_failure: (Config, StandardError exception) -> void

#record_recovery_probe_successvoid

This method returns an undefined value.

Records a successful recovery probe for a specific light configuration.

Parameters:



37
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 37

def record_recovery_probe_success: (Config) -> void

#record_successvoid

This method returns an undefined value.

Records a success for a specific light configuration.

Parameters:



31
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 31

def record_success: (Config) -> void

#release_recovery_lockvoid

This method returns an undefined value.

Releases previously acquired lock.

Parameters:



46
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 46

def release_recovery_lock: (_RecoveryLockToken lock) -> void

#set_statestate

Sets the state of a specific light configuration.

Parameters:

Returns:

  • (state)


40
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 40

def set_state: (Config, state state) -> state

#transition_to_colorBoolean

Note:

In distributed environments with multiple instances, race conditions can occur when instances attempt conflicting transitions simultaneously (e.g., one instance tries to transition from YELLOW to GREEN while another tries YELLOW to RED). The implementation handles this, but be aware that the last operation may determine the final color of the light.

Transitions the Stoplight to the specified color.

This method performs a color transition operation that works across distributed instances of the light. It ensures that in a multi-instance environment, only one instance is considered the "first" to perform the transition (and therefore responsible for triggering notifications).

Parameters:

  • config
  • color

    The target color/state to transition to. Should be one of Stoplight::Color::GREEN, Stoplight::Color::YELLOW, or Stoplight::Color::RED.

  • (Config)

Returns:

  • (Boolean)

    Returns true if this instance was the first to perform this specific transition (and should therefore trigger notifications). Returns false if another instance already initiated this transition.



68
# File 'sig/_private/stoplight/domain/ports/data_store.rbs', line 68

def transition_to_color: (Config, color color) -> bool