stoplight 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/UPGRADING.md +303 -0
- data/lib/generators/stoplight/install/install_generator.rb +6 -1
- data/lib/stoplight/admin/dependencies.rb +1 -1
- data/lib/stoplight/admin/helpers.rb +20 -4
- data/lib/stoplight/admin/lights_repository/light.rb +22 -6
- data/lib/stoplight/admin/lights_repository.rb +6 -5
- data/lib/stoplight/admin/views/_card.erb +8 -5
- data/lib/stoplight/color.rb +9 -0
- data/lib/stoplight/data_store.rb +28 -0
- data/lib/stoplight/domain/compatibility_result.rb +7 -7
- data/lib/stoplight/domain/config.rb +38 -39
- data/lib/stoplight/domain/error_tracking_policy.rb +27 -0
- data/lib/stoplight/domain/failure.rb +1 -1
- data/lib/stoplight/domain/light/configuration_builder_interface.rb +2 -0
- data/lib/stoplight/domain/light.rb +15 -46
- data/lib/stoplight/domain/light_info.rb +7 -0
- data/lib/stoplight/domain/metrics_snapshot.rb +58 -0
- data/lib/stoplight/domain/state_snapshot.rb +29 -23
- data/lib/stoplight/domain/storage/recovery_lock_token.rb +15 -0
- data/lib/stoplight/domain/strategies/green_run_strategy.rb +18 -26
- data/lib/stoplight/domain/strategies/red_run_strategy.rb +9 -12
- data/lib/stoplight/domain/strategies/yellow_run_strategy.rb +41 -51
- data/lib/stoplight/domain/tracker/recovery_probe.rb +16 -33
- data/lib/stoplight/domain/tracker/request.rb +12 -31
- data/lib/stoplight/domain/traffic_control/consecutive_errors.rb +8 -11
- data/lib/stoplight/domain/traffic_control/error_rate.rb +19 -15
- data/lib/stoplight/domain/traffic_recovery/consecutive_successes.rb +6 -10
- data/lib/stoplight/domain/traffic_recovery.rb +3 -4
- data/lib/stoplight/error.rb +46 -0
- data/lib/stoplight/infrastructure/{data_store/fail_safe.rb → fail_safe/data_store.rb} +39 -51
- data/lib/stoplight/infrastructure/fail_safe/storage/metrics.rb +65 -0
- data/lib/stoplight/infrastructure/fail_safe/storage/recovery_lock.rb +69 -0
- data/lib/stoplight/infrastructure/fail_safe/storage/recovery_lock_token.rb +19 -0
- data/lib/stoplight/infrastructure/fail_safe/storage/state.rb +62 -0
- data/lib/stoplight/infrastructure/{data_store/memory → memory/data_store}/metrics.rb +2 -2
- data/lib/stoplight/infrastructure/{data_store/memory → memory/data_store}/recovery_lock_store.rb +10 -12
- data/lib/stoplight/infrastructure/{data_store/memory → memory/data_store}/recovery_lock_token.rb +3 -6
- data/lib/stoplight/infrastructure/{data_store/memory → memory/data_store}/sliding_window.rb +21 -26
- data/lib/stoplight/infrastructure/{data_store/memory → memory/data_store}/state.rb +3 -3
- data/lib/stoplight/infrastructure/{data_store/memory.rb → memory/data_store.rb} +36 -32
- data/lib/stoplight/infrastructure/memory/storage/recovery_lock.rb +35 -0
- data/lib/stoplight/infrastructure/memory/storage/recovery_metrics.rb +16 -0
- data/lib/stoplight/infrastructure/memory/storage/state.rb +155 -0
- data/lib/stoplight/infrastructure/memory/storage/unbounded_metrics.rb +103 -0
- data/lib/stoplight/infrastructure/memory/storage/window_metrics.rb +101 -0
- data/lib/stoplight/infrastructure/notifier/fail_safe.rb +9 -21
- data/lib/stoplight/infrastructure/notifier/generic.rb +4 -14
- data/lib/stoplight/infrastructure/notifier/io.rb +1 -2
- data/lib/stoplight/infrastructure/notifier/logger.rb +1 -2
- data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/recovery_lock_store.rb +9 -22
- data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/recovery_lock_token.rb +7 -14
- data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/scripting.rb +22 -20
- data/lib/stoplight/infrastructure/{data_store/redis.rb → redis/data_store.rb} +48 -56
- data/lib/stoplight/infrastructure/redis/storage/key_space.rb +51 -0
- data/lib/stoplight/infrastructure/redis/storage/metrics.rb +40 -0
- data/lib/stoplight/infrastructure/redis/storage/recovery_lock/release_lock.lua +6 -0
- data/lib/stoplight/infrastructure/redis/storage/recovery_lock.rb +64 -0
- data/lib/stoplight/infrastructure/redis/storage/recovery_metrics.rb +20 -0
- data/lib/stoplight/infrastructure/redis/storage/scripting.rb +18 -0
- data/lib/stoplight/infrastructure/redis/storage/state/transition_to_green.lua +10 -0
- data/lib/stoplight/infrastructure/redis/storage/state/transition_to_red.lua +10 -0
- data/lib/stoplight/infrastructure/redis/storage/state/transition_to_yellow.lua +9 -0
- data/lib/stoplight/infrastructure/redis/storage/state.rb +141 -0
- data/lib/stoplight/infrastructure/redis/storage/unbounded_metrics/record_failure.lua +28 -0
- data/lib/stoplight/infrastructure/redis/storage/unbounded_metrics/record_success.lua +26 -0
- data/lib/stoplight/infrastructure/redis/storage/unbounded_metrics.rb +123 -0
- data/lib/stoplight/infrastructure/redis/storage/window_metrics/metrics_snapshot.lua +26 -0
- data/lib/stoplight/infrastructure/redis/storage/window_metrics/record_failure.lua +36 -0
- data/lib/stoplight/infrastructure/redis/storage/window_metrics/record_success.lua +35 -0
- data/lib/stoplight/infrastructure/redis/storage/window_metrics.rb +174 -0
- data/lib/stoplight/infrastructure/storage/compatibility_metrics.rb +3 -10
- data/lib/stoplight/infrastructure/storage/compatibility_recovery_lock.rb +8 -11
- data/lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb +6 -14
- data/lib/stoplight/infrastructure/storage/compatibility_state.rb +6 -17
- data/lib/stoplight/infrastructure/system_clock.rb +16 -0
- data/lib/stoplight/notifier.rb +11 -0
- data/lib/stoplight/state.rb +9 -0
- data/lib/stoplight/types.rb +29 -0
- data/lib/stoplight/undefined.rb +16 -0
- data/lib/stoplight/version.rb +1 -1
- data/lib/stoplight/wiring/config_compatibility_validator.rb +54 -0
- data/lib/stoplight/wiring/configuration_dsl.rb +101 -0
- data/lib/stoplight/wiring/data_store_backend.rb +26 -0
- data/lib/stoplight/wiring/default.rb +1 -1
- data/lib/stoplight/wiring/default_config.rb +21 -0
- data/lib/stoplight/wiring/default_configuration.rb +70 -53
- data/lib/stoplight/wiring/light_builder.rb +76 -63
- data/lib/stoplight/wiring/light_factory/traffic_control_dsl.rb +3 -3
- data/lib/stoplight/wiring/light_factory/traffic_recovery_dsl.rb +4 -4
- data/lib/stoplight/wiring/light_factory.rb +78 -52
- data/lib/stoplight/wiring/memory/backend.rb +57 -0
- data/lib/stoplight/wiring/redis/backend.rb +116 -0
- data/lib/stoplight/wiring/storage_set.rb +12 -0
- data/lib/stoplight/wiring/storage_set_builder.rb +51 -0
- data/lib/stoplight/wiring/system/light_builder.rb +47 -0
- data/lib/stoplight/wiring/system/light_factory.rb +64 -0
- data/lib/stoplight/wiring/system.rb +129 -0
- data/lib/stoplight.rb +196 -25
- data/sig/_private/generators/stoplight/install/install_generator.rbs +22 -0
- data/sig/_private/stoplight/common/deprecations.rbs +9 -0
- data/sig/_private/stoplight/data_store.rbs +6 -0
- data/sig/_private/stoplight/domain/compatibility_result.rbs +18 -0
- data/sig/_private/stoplight/domain/config.rbs +65 -0
- data/sig/_private/stoplight/domain/error_tracking_policy.rbs +14 -0
- data/sig/_private/stoplight/domain/failure.rbs +16 -0
- data/sig/_private/stoplight/domain/light.rbs +25 -0
- data/sig/_private/stoplight/domain/light_info.rbs +19 -0
- data/sig/_private/stoplight/domain/metrics_snapshot.rbs +38 -0
- data/sig/_private/stoplight/domain/ports/clock.rbs +18 -0
- data/sig/_private/stoplight/domain/ports/data_store.rbs +76 -0
- data/{lib/stoplight/domain/light_factory.rb → sig/_private/stoplight/domain/ports/light_factory.rbs} +33 -28
- data/sig/_private/stoplight/domain/ports/metrics_store.rbs +29 -0
- data/sig/_private/stoplight/domain/ports/recovery_lock_store.rbs +52 -0
- data/sig/_private/stoplight/domain/ports/recovery_lock_token.rbs +6 -0
- data/sig/_private/stoplight/domain/ports/run_strategy.rbs +14 -0
- data/sig/_private/stoplight/domain/ports/state_store.rbs +79 -0
- data/sig/_private/stoplight/domain/ports/traffic_control.rbs +41 -0
- data/sig/_private/stoplight/domain/ports/traffic_recovery.rbs +47 -0
- data/sig/_private/stoplight/domain/state_snapshot.rbs +32 -0
- data/sig/_private/stoplight/domain/storage/recovery_lock_token.rbs +11 -0
- data/sig/_private/stoplight/domain/strategies/green_run_strategy.rbs +17 -0
- data/sig/_private/stoplight/domain/strategies/red_run_strategy.rbs +17 -0
- data/sig/_private/stoplight/domain/strategies/yellow_run_strategy.rbs +42 -0
- data/{lib/stoplight/domain/tracker/base.rb → sig/_private/stoplight/domain/tracker/base.rbs} +0 -4
- data/sig/_private/stoplight/domain/tracker/recovery_probe.rbs +25 -0
- data/sig/_private/stoplight/domain/tracker/request.rbs +26 -0
- data/sig/_private/stoplight/domain/traffic_control/consecutive_errors.rbs +9 -0
- data/sig/_private/stoplight/domain/traffic_control/error_rate.rbs +13 -0
- data/sig/_private/stoplight/domain/traffic_recovery/consecutive_successes.rbs +9 -0
- data/sig/_private/stoplight/domain/traffic_recovery.rbs +9 -0
- data/sig/_private/stoplight/infrastructure/fail_safe/data_store.rbs +26 -0
- data/sig/_private/stoplight/infrastructure/fail_safe/storage/metrics.rbs +25 -0
- data/sig/_private/stoplight/infrastructure/fail_safe/storage/recovery_lock.rbs +29 -0
- data/sig/_private/stoplight/infrastructure/fail_safe/storage/recovery_lock_token.rbs +19 -0
- data/sig/_private/stoplight/infrastructure/fail_safe/storage/state.rbs +25 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store/metrics.rbs +25 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store/recovery_lock_store.rbs +19 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store/recovery_lock_token.rbs +17 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store/sliding_window.rbs +27 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store/state.rbs +17 -0
- data/sig/_private/stoplight/infrastructure/memory/data_store.rbs +30 -0
- data/sig/_private/stoplight/infrastructure/memory/storage/recovery_lock.rbs +15 -0
- data/sig/_private/stoplight/infrastructure/memory/storage/recovery_metrics.rbs +10 -0
- data/sig/_private/stoplight/infrastructure/memory/storage/state.rbs +28 -0
- data/sig/_private/stoplight/infrastructure/memory/storage/unbounded_metrics.rbs +25 -0
- data/sig/_private/stoplight/infrastructure/memory/storage/window_metrics.rbs +26 -0
- data/sig/_private/stoplight/infrastructure/notifier/fail_safe.rbs +17 -0
- data/sig/_private/stoplight/infrastructure/notifier/generic.rbs +18 -0
- data/sig/_private/stoplight/infrastructure/notifier/io.rbs +14 -0
- data/sig/_private/stoplight/infrastructure/notifier/logger.rbs +14 -0
- data/sig/_private/stoplight/infrastructure/redis/data_store/recovery_lock_store.rbs +24 -0
- data/sig/_private/stoplight/infrastructure/redis/data_store/recovery_lock_token.rbs +21 -0
- data/sig/_private/stoplight/infrastructure/redis/data_store/scripting.rbs +34 -0
- data/sig/_private/stoplight/infrastructure/redis/data_store.rbs +67 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/key_space.rbs +19 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/metrics.rbs +17 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/recovery_lock.rbs +26 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/recovery_metrics.rbs +10 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/scripting.rbs +13 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/state.rbs +32 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/unbounded_metrics.rbs +21 -0
- data/sig/_private/stoplight/infrastructure/redis/storage/window_metrics.rbs +34 -0
- data/sig/_private/stoplight/infrastructure/storage/compatibility_metrics.rbs +17 -0
- data/sig/_private/stoplight/infrastructure/storage/compatibility_recovery_lock.rbs +13 -0
- data/sig/_private/stoplight/infrastructure/storage/compatibility_recovery_metrics.rbs +14 -0
- data/sig/_private/stoplight/infrastructure/storage/compatibility_state.rbs +14 -0
- data/sig/_private/stoplight/infrastructure/system_clock.rbs +7 -0
- data/sig/_private/stoplight/system/light_builder.rbs +23 -0
- data/sig/_private/stoplight/system/light_factory.rbs +17 -0
- data/sig/_private/stoplight/types.rbs +6 -0
- data/sig/_private/stoplight/wiring/config_compatibility_validator.rbs +19 -0
- data/sig/_private/stoplight/wiring/configuration_dsl.rbs +43 -0
- data/sig/_private/stoplight/wiring/data_store_backend.rbs +11 -0
- data/sig/_private/stoplight/wiring/default.rbs +26 -0
- data/{lib/stoplight/wiring/data_store/memory.rb → sig/_private/stoplight/wiring/default_config.rbs} +1 -4
- data/sig/_private/stoplight/wiring/default_configuration.rbs +29 -0
- data/sig/_private/stoplight/wiring/light_builder.rbs +48 -0
- data/sig/_private/stoplight/wiring/light_factory/traffic_control_dsl.rbs +7 -0
- data/sig/_private/stoplight/wiring/light_factory/traffic_recovery_dsl.rbs +7 -0
- data/sig/_private/stoplight/wiring/light_factory.rbs +16 -0
- data/sig/_private/stoplight/wiring/memory/backend.rbs +26 -0
- data/sig/_private/stoplight/wiring/notifier_factory.rbs +10 -0
- data/sig/_private/stoplight/wiring/redis/backend.rbs +38 -0
- data/sig/_private/stoplight/wiring/storage_set.rbs +38 -0
- data/sig/_private/stoplight/wiring/storage_set_builder.rbs +15 -0
- data/sig/_private/stoplight/wiring/system.rbs +15 -0
- data/sig/_private/stoplight.rbs +48 -0
- data/sig/stoplight/color.rbs +7 -0
- data/sig/stoplight/data_store.rbs +19 -0
- data/sig/stoplight/error.rbs +20 -0
- data/sig/stoplight/notifier.rbs +11 -0
- data/sig/stoplight/ports/configuration.rbs +19 -0
- data/sig/stoplight/ports/exception_matcher.rbs +8 -0
- data/sig/stoplight/ports/light.rbs +12 -0
- data/sig/stoplight/ports/light_info.rbs +5 -0
- data/sig/stoplight/ports/state_transition_notifier.rbs +15 -0
- data/sig/stoplight/ports/system.rbs +21 -0
- data/sig/stoplight/state.rbs +7 -0
- data/sig/stoplight/undefined.rbs +9 -0
- data/sig/stoplight/version.rbs +3 -0
- data/sig/stoplight.rbs +66 -0
- metadata +175 -47
- data/lib/stoplight/domain/color.rb +0 -11
- data/lib/stoplight/domain/data_store.rb +0 -146
- data/lib/stoplight/domain/error.rb +0 -42
- data/lib/stoplight/domain/metrics.rb +0 -64
- data/lib/stoplight/domain/recovery_lock_token.rb +0 -15
- data/lib/stoplight/domain/state.rb +0 -11
- data/lib/stoplight/domain/state_transition_notifier.rb +0 -25
- data/lib/stoplight/domain/storage/metrics.rb +0 -42
- data/lib/stoplight/domain/storage/recovery_lock.rb +0 -56
- data/lib/stoplight/domain/storage/state.rb +0 -87
- data/lib/stoplight/domain/strategies/run_strategy.rb +0 -22
- data/lib/stoplight/domain/traffic_control/base.rb +0 -74
- data/lib/stoplight/domain/traffic_recovery/base.rb +0 -79
- data/lib/stoplight/wiring/data_store/base.rb +0 -11
- data/lib/stoplight/wiring/data_store/redis.rb +0 -25
- data/lib/stoplight/wiring/default_factory_builder.rb +0 -25
- data/lib/stoplight/wiring/light/default_config.rb +0 -18
- data/lib/stoplight/wiring/light/system_config.rb +0 -11
- data/lib/stoplight/wiring/light_factory/compatibility_validator.rb +0 -55
- data/lib/stoplight/wiring/light_factory/config_normalizer.rb +0 -71
- data/lib/stoplight/wiring/light_factory/configuration_pipeline.rb +0 -72
- data/lib/stoplight/wiring/public_api.rb +0 -29
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/get_metrics.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/record_failure.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/record_recovery_probe_failure.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/record_recovery_probe_success.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/record_success.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/release_lock.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/transition_to_green.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/transition_to_red.lua +0 -0
- /data/lib/stoplight/infrastructure/{data_store/redis → redis/data_store}/lua_scripts/transition_to_yellow.lua +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Redis
|
|
4
|
+
module Storage
|
|
5
|
+
class UnboundedMetrics < Metrics
|
|
6
|
+
attr_reader redis: redis
|
|
7
|
+
attr_reader scripting: Scripting
|
|
8
|
+
attr_reader metrics_key: String
|
|
9
|
+
attr_reader clock: Domain::_Clock
|
|
10
|
+
|
|
11
|
+
def initialize: (
|
|
12
|
+
redis: redis,
|
|
13
|
+
clock: Domain::_Clock,
|
|
14
|
+
scripting: Scripting,
|
|
15
|
+
key_space: KeySpace,
|
|
16
|
+
) -> void
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Redis
|
|
4
|
+
module Storage
|
|
5
|
+
class WindowMetrics < Metrics
|
|
6
|
+
attr_reader config: Domain::Config
|
|
7
|
+
attr_reader redis: redis
|
|
8
|
+
attr_reader scripting: Scripting
|
|
9
|
+
attr_reader metrics_key: String
|
|
10
|
+
attr_reader clock: Domain::_Clock
|
|
11
|
+
attr_reader key_space: KeySpace
|
|
12
|
+
@window_size: Integer
|
|
13
|
+
|
|
14
|
+
def initialize: (
|
|
15
|
+
redis: redis,
|
|
16
|
+
scripting: Scripting,
|
|
17
|
+
config: Domain::Config,
|
|
18
|
+
clock: Domain::_Clock,
|
|
19
|
+
key_space: KeySpace
|
|
20
|
+
) -> void
|
|
21
|
+
|
|
22
|
+
def bucket_key: (metric: Symbol, time: _ToI) -> String
|
|
23
|
+
def bucket_size: -> Integer
|
|
24
|
+
def bucket_ttl: -> Integer
|
|
25
|
+
def buckets_for_window: (metric: Symbol, window_end: _ToI) -> Array[String]
|
|
26
|
+
def successes_key: (time: _ToI) -> String
|
|
27
|
+
def errors_key: (time: _ToI) -> String
|
|
28
|
+
def failure_bucket_keys: (_ToI window_end) -> Array[String]
|
|
29
|
+
def success_bucket_keys: (_ToI window_end) -> Array[String]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Storage
|
|
4
|
+
class CompatibilityMetrics
|
|
5
|
+
include Domain::_MetricsStore
|
|
6
|
+
|
|
7
|
+
private attr_reader data_store: Domain::_DataStore
|
|
8
|
+
private attr_reader config: Domain::Config
|
|
9
|
+
|
|
10
|
+
def initialize: (
|
|
11
|
+
data_store: Domain::_DataStore,
|
|
12
|
+
config: Domain::Config,
|
|
13
|
+
) -> void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Storage
|
|
4
|
+
class CompatibilityRecoveryLock
|
|
5
|
+
include Domain::_RecoveryLockStore
|
|
6
|
+
private attr_reader data_store: Domain::_DataStore
|
|
7
|
+
private attr_reader config: Domain::Config
|
|
8
|
+
|
|
9
|
+
def initialize: (data_store: Domain::_DataStore, config: Domain::Config) -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Storage
|
|
4
|
+
class CompatibilityRecoveryMetrics
|
|
5
|
+
include Domain::_MetricsStore
|
|
6
|
+
|
|
7
|
+
private attr_reader data_store: Domain::_DataStore
|
|
8
|
+
private attr_reader config: Domain::Config
|
|
9
|
+
|
|
10
|
+
def initialize: (data_store: Domain::_DataStore, config: Domain::Config) -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Infrastructure
|
|
3
|
+
module Storage
|
|
4
|
+
class CompatibilityState
|
|
5
|
+
include Domain::_StateStore
|
|
6
|
+
|
|
7
|
+
private attr_reader data_store: Domain::_DataStore
|
|
8
|
+
private attr_reader config: Domain::Config
|
|
9
|
+
|
|
10
|
+
def initialize: (data_store: Domain::_DataStore, config: Domain::Config) -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class System
|
|
4
|
+
class LightBuilder < Wiring::LightBuilder
|
|
5
|
+
attr_reader system: System
|
|
6
|
+
|
|
7
|
+
@failover_system: _System
|
|
8
|
+
@storage_set: StorageSet
|
|
9
|
+
@key_space: Infrastructure::Redis::Storage::KeySpace
|
|
10
|
+
|
|
11
|
+
def initialize: (config: Domain::Config, factory: Domain::_LightFactory, system: System) -> void
|
|
12
|
+
|
|
13
|
+
def key_space: -> Infrastructure::Redis::Storage::KeySpace
|
|
14
|
+
|
|
15
|
+
private def redis: -> redis
|
|
16
|
+
private def storage_scripting: -> Infrastructure::Redis::Storage::Scripting
|
|
17
|
+
private def failover_system: -> _System
|
|
18
|
+
private def storage_set: -> StorageSet
|
|
19
|
+
private def build_backend: -> DataStoreBackend
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stoplight
|
|
4
|
+
module Wiring
|
|
5
|
+
class System
|
|
6
|
+
class LightFactory < Wiring::LightFactory
|
|
7
|
+
class InternalLightFactory
|
|
8
|
+
include Domain::_LightFactory
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
attr_reader system: System
|
|
12
|
+
|
|
13
|
+
def initialize: (system: System, config: Domain::Config) -> void
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stoplight
|
|
4
|
+
module Wiring
|
|
5
|
+
class ConfigCompatibilityValidator
|
|
6
|
+
attr_reader config: Domain::Config
|
|
7
|
+
|
|
8
|
+
def self.call: (config: Domain::Config) -> Domain::Config
|
|
9
|
+
|
|
10
|
+
def initialize: (config: Domain::Config) -> void
|
|
11
|
+
def call: -> Domain::Config
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def validate_traffic_control!: -> void
|
|
16
|
+
def validate_traffic_recovery!: -> void
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class ConfigurationDsl
|
|
4
|
+
@tracked_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher]
|
|
5
|
+
@skipped_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher]
|
|
6
|
+
@traffic_control: optional[traffic_control]
|
|
7
|
+
@traffic_recovery: optional[traffic_recovery]
|
|
8
|
+
|
|
9
|
+
def initialize: (
|
|
10
|
+
?name: optional[String],
|
|
11
|
+
?cool_off_time: optional[duration],
|
|
12
|
+
?threshold: optional[percentage | Integer],
|
|
13
|
+
?recovery_threshold: optional[Integer],
|
|
14
|
+
?window_size: optional[duration?],
|
|
15
|
+
?tracked_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher],
|
|
16
|
+
?skipped_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher],
|
|
17
|
+
?data_store: optional[data_store],
|
|
18
|
+
?error_notifier: optional[error_notifier],
|
|
19
|
+
?notifiers: optional[Array[state_transition_notifier]],
|
|
20
|
+
?traffic_control: optional[traffic_control],
|
|
21
|
+
?traffic_recovery: optional[traffic_recovery],
|
|
22
|
+
) -> void
|
|
23
|
+
|
|
24
|
+
def configure!: (Domain::Config default_config) -> Domain::Config
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
attr_reader name: optional[String]
|
|
29
|
+
attr_reader cool_off_time: optional[duration]
|
|
30
|
+
attr_reader threshold: optional[percentage | Integer]
|
|
31
|
+
attr_reader recovery_threshold: optional[Integer]
|
|
32
|
+
attr_reader window_size: optional[duration?]
|
|
33
|
+
attr_reader data_store: optional[data_store]
|
|
34
|
+
attr_reader error_notifier: optional[error_notifier]
|
|
35
|
+
attr_reader notifiers: optional[Array[state_transition_notifier]]
|
|
36
|
+
|
|
37
|
+
def tracked_errors: -> optional[Array[_ExceptionMatcher]]
|
|
38
|
+
def skipped_errors: -> optional[Array[_ExceptionMatcher]]
|
|
39
|
+
def traffic_control: -> optional[Domain::_TrafficControl]
|
|
40
|
+
def traffic_recovery: -> optional[Domain::_TrafficRecovery]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class DataStoreBackend
|
|
4
|
+
def windowed_metrics_store: -> Domain::_MetricsStore
|
|
5
|
+
def unbounded_metrics_store: -> Domain::_MetricsStore
|
|
6
|
+
def recovery_metrics_store: -> Domain::_MetricsStore
|
|
7
|
+
def state_store: -> Domain::_StateStore
|
|
8
|
+
def recovery_lock_store: -> Domain::_RecoveryLockStore
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
module Default
|
|
4
|
+
COOL_OFF_TIME: duration
|
|
5
|
+
|
|
6
|
+
DATA_STORE: data_store
|
|
7
|
+
|
|
8
|
+
ERROR_NOTIFIER: error_notifier
|
|
9
|
+
|
|
10
|
+
FORMATTER: notification_formatter
|
|
11
|
+
|
|
12
|
+
NOTIFIERS: Array[state_transition_notifier]
|
|
13
|
+
|
|
14
|
+
THRESHOLD: percentage | Integer
|
|
15
|
+
RECOVERY_THRESHOLD: Integer
|
|
16
|
+
|
|
17
|
+
WINDOW_SIZE: duration?
|
|
18
|
+
|
|
19
|
+
TRACKED_ERRORS: Array[_ExceptionMatcher]
|
|
20
|
+
SKIPPED_ERRORS: Array[_ExceptionMatcher]
|
|
21
|
+
|
|
22
|
+
TRAFFIC_CONTROL: Domain::_TrafficControl
|
|
23
|
+
TRAFFIC_RECOVERY: Domain::_TrafficRecovery
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class DefaultConfiguration
|
|
4
|
+
include _Configuration
|
|
5
|
+
|
|
6
|
+
@config: Domain::Config
|
|
7
|
+
@cool_off_time: optional[duration]
|
|
8
|
+
@threshold: optional[percentage | Integer]
|
|
9
|
+
@recovery_threshold: optional[Integer]
|
|
10
|
+
@window_size: optional[duration?]
|
|
11
|
+
@tracked_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher]
|
|
12
|
+
@skipped_errors: optional[Array[_ExceptionMatcher] | _ExceptionMatcher]
|
|
13
|
+
@traffic_control: optional[traffic_control]
|
|
14
|
+
@traffic_recovery: optional[traffic_recovery]
|
|
15
|
+
@error_notifier: optional[error_notifier]
|
|
16
|
+
@data_store: optional[data_store]
|
|
17
|
+
@notifiers: optional[Array[state_transition_notifier]]
|
|
18
|
+
|
|
19
|
+
def to_config!: -> Domain::Config
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
def tracked_errors: -> optional[Array[_ExceptionMatcher]]
|
|
24
|
+
def skipped_errors: -> optional[Array[_ExceptionMatcher]]
|
|
25
|
+
def traffic_control: -> optional[Domain::_TrafficControl]
|
|
26
|
+
def traffic_recovery: -> optional[Domain::_TrafficRecovery]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class LightBuilder
|
|
4
|
+
FAILOVER_DATA_STORE_CONFIG: Stoplight::DataStore::Memory
|
|
5
|
+
MEMORY_REGISTRY: Concurrent::Map[Integer, Infrastructure::Memory::DataStore]
|
|
6
|
+
|
|
7
|
+
attr_reader data_store_config: data_store
|
|
8
|
+
attr_reader error_notifier: error_notifier
|
|
9
|
+
attr_reader factory: Domain::_LightFactory
|
|
10
|
+
attr_reader clock: Domain::_Clock
|
|
11
|
+
|
|
12
|
+
attr_reader traffic_recovery: Domain::_TrafficRecovery
|
|
13
|
+
attr_reader traffic_control: Domain::_TrafficControl
|
|
14
|
+
attr_reader config: Domain::Config
|
|
15
|
+
|
|
16
|
+
@notifiers: Array[state_transition_notifier]
|
|
17
|
+
@name: String
|
|
18
|
+
@cool_off_time: duration
|
|
19
|
+
@error_tracking_policy: Domain::ErrorTrackingPolicy
|
|
20
|
+
|
|
21
|
+
def initialize: (config: Domain::Config, factory: Domain::_LightFactory) -> void
|
|
22
|
+
|
|
23
|
+
def build: -> Domain::Light
|
|
24
|
+
|
|
25
|
+
def state_store: -> Domain::_StateStore
|
|
26
|
+
def notifiers: -> Array[state_transition_notifier]
|
|
27
|
+
def redis_recovery_lock_store: -> Infrastructure::Redis::DataStore::RecoveryLockStore
|
|
28
|
+
def scripting: -> Infrastructure::Redis::DataStore::Scripting
|
|
29
|
+
|
|
30
|
+
def memory_recovery_lock_store: -> Infrastructure::Memory::DataStore::RecoveryLockStore
|
|
31
|
+
def failover_data_store: -> Domain::_DataStore
|
|
32
|
+
def data_store: -> Domain::_DataStore
|
|
33
|
+
|
|
34
|
+
def metrics_store: -> Domain::_MetricsStore
|
|
35
|
+
def recovery_lock_store: -> Domain::_RecoveryLockStore
|
|
36
|
+
def request_tracker: -> Domain::Tracker::Request
|
|
37
|
+
def recovery_probe_tracker: -> Domain::Tracker::RecoveryProbe
|
|
38
|
+
def recovery_metrics_store: -> Domain::_MetricsStore
|
|
39
|
+
|
|
40
|
+
def green_run_strategy: -> Domain::Strategies::GreenRunStrategy
|
|
41
|
+
def yellow_run_strategy: -> Domain::Strategies::YellowRunStrategy
|
|
42
|
+
def red_run_strategy: -> Domain::Strategies::RedRunStrategy
|
|
43
|
+
def create_data_store: (data_store) -> Domain::_DataStore
|
|
44
|
+
def memory_registry: -> Concurrent::Map[Integer, Infrastructure::Memory::DataStore]
|
|
45
|
+
def redis: -> redis
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class LightFactory
|
|
4
|
+
include Domain::_LightFactory
|
|
5
|
+
attr_reader config: Domain::Config
|
|
6
|
+
|
|
7
|
+
def initialize: (config: Domain::Config) -> void
|
|
8
|
+
|
|
9
|
+
def eql: (untyped other) -> bool
|
|
10
|
+
def hash: -> Integer
|
|
11
|
+
|
|
12
|
+
def light_builder: (config: Domain::Config) -> LightBuilder
|
|
13
|
+
def light_factory: -> Domain::_LightFactory
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
module Memory
|
|
4
|
+
class Backend < DataStoreBackend
|
|
5
|
+
@clock: Domain::_Clock
|
|
6
|
+
@config: Domain::Config
|
|
7
|
+
@state_store: Infrastructure::Memory::Storage::State
|
|
8
|
+
@recovery_lock_store: Infrastructure::Memory::Storage::RecoveryLock
|
|
9
|
+
@recovery_metrics_store: Infrastructure::Memory::Storage::RecoveryMetrics
|
|
10
|
+
@windowed_metrics_store: Infrastructure::Memory::Storage::WindowMetrics
|
|
11
|
+
@unbounded_metrics_store: Infrastructure::Memory::Storage::UnboundedMetrics
|
|
12
|
+
|
|
13
|
+
def initialize: (
|
|
14
|
+
clock: Domain::_Clock,
|
|
15
|
+
config: Domain::Config
|
|
16
|
+
) -> void
|
|
17
|
+
|
|
18
|
+
def state_stare: -> Infrastructure::Memory::Storage::State
|
|
19
|
+
def recovery_lock_store: -> Infrastructure::Memory::Storage::RecoveryLock
|
|
20
|
+
def recovery_metrics_store: -> Infrastructure::Memory::Storage::RecoveryMetrics
|
|
21
|
+
def windowed_metrics_store: -> Infrastructure::Memory::Storage::WindowMetrics
|
|
22
|
+
def unbounded_metrics_store: -> Infrastructure::Memory::Storage::UnboundedMetrics
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
module Redis
|
|
4
|
+
class Backend < DataStoreBackend
|
|
5
|
+
@redis: redis
|
|
6
|
+
@scripting: Infrastructure::Redis::Storage::Scripting
|
|
7
|
+
@key_space: Infrastructure::Redis::Storage::KeySpace
|
|
8
|
+
@config: Domain::Config
|
|
9
|
+
@error_notifier: error_notifier
|
|
10
|
+
@failover_light: Domain::Light
|
|
11
|
+
@clock: Domain::_Clock
|
|
12
|
+
|
|
13
|
+
@memory_fallback: Memory::Backend
|
|
14
|
+
@state_store: Infrastructure::FailSafe::Storage::State
|
|
15
|
+
@recovery_lock_store: Infrastructure::FailSafe::Storage::RecoveryLock
|
|
16
|
+
@recovery_metrics_store: Infrastructure::FailSafe::Storage::Metrics
|
|
17
|
+
@windowed_metrics_store: Infrastructure::FailSafe::Storage::Metrics
|
|
18
|
+
@unbounded_metrics_store: Infrastructure::FailSafe::Storage::Metrics
|
|
19
|
+
|
|
20
|
+
def initialize: (
|
|
21
|
+
redis: redis,
|
|
22
|
+
scripting: Infrastructure::Redis::Storage::Scripting,
|
|
23
|
+
key_space: Infrastructure::Redis::Storage::KeySpace,
|
|
24
|
+
config: Domain::Config,
|
|
25
|
+
error_notifier: error_notifier,
|
|
26
|
+
failover_light: Domain::Light,
|
|
27
|
+
clock: Domain::_Clock,
|
|
28
|
+
) -> void
|
|
29
|
+
|
|
30
|
+
def state_stare: -> Infrastructure::FailSafe::Storage::State
|
|
31
|
+
def recovery_lock_store: -> Infrastructure::FailSafe::Storage::RecoveryLock
|
|
32
|
+
def recovery_metrics_store: -> Infrastructure::FailSafe::Storage::Metrics
|
|
33
|
+
def windowed_metrics_store: -> Infrastructure::FailSafe::Storage::Metrics
|
|
34
|
+
def unbounded_metrics_store: -> Infrastructure::FailSafe::Storage::Metrics
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
# Immutable container for all storage components required by a Light.
|
|
4
|
+
#
|
|
5
|
+
# StorageSet groups the four storage interfaces that a circuit breaker needs:
|
|
6
|
+
# metrics tracking, recovery metrics, state persistence, and recovery locking.
|
|
7
|
+
# This allows the storage layer to be constructed once and passed as a unit,
|
|
8
|
+
# making dependencies explicit and simplifying Light construction.
|
|
9
|
+
#
|
|
10
|
+
# @example
|
|
11
|
+
# storage_set = StorageSetBuilder.new(backend:, windowed: true).build
|
|
12
|
+
# storage_set.metrics_store #=> WindowMetrics instance
|
|
13
|
+
# storage_set.state_store #=> State instance
|
|
14
|
+
#
|
|
15
|
+
# @see StorageSetBuilder
|
|
16
|
+
# @api private
|
|
17
|
+
class StorageSet < Data
|
|
18
|
+
attr_reader metrics_store: Domain::_MetricsStore
|
|
19
|
+
attr_reader recovery_metrics_store: Domain::_MetricsStore
|
|
20
|
+
attr_reader state_store: Domain::_StateStore
|
|
21
|
+
attr_reader recovery_lock_store: Domain::_RecoveryLockStore
|
|
22
|
+
|
|
23
|
+
def self.new: (
|
|
24
|
+
metrics_store: Domain::_MetricsStore,
|
|
25
|
+
recovery_metrics_store: Domain::_MetricsStore,
|
|
26
|
+
state_store: Domain::_StateStore,
|
|
27
|
+
recovery_lock_store: Domain::_RecoveryLockStore
|
|
28
|
+
) -> instance
|
|
29
|
+
|
|
30
|
+
def initialize: (
|
|
31
|
+
metrics_store: Domain::_MetricsStore,
|
|
32
|
+
recovery_metrics_store: Domain::_MetricsStore,
|
|
33
|
+
state_store: Domain::_StateStore,
|
|
34
|
+
recovery_lock_store: Domain::_RecoveryLockStore
|
|
35
|
+
) -> void
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Stoplight
|
|
4
|
+
module Wiring
|
|
5
|
+
class StorageSetBuilder
|
|
6
|
+
attr_reader backend: DataStoreBackend
|
|
7
|
+
attr_reader windowed: bool
|
|
8
|
+
|
|
9
|
+
def initialize: (backend: DataStoreBackend, windowed: bool) -> void
|
|
10
|
+
|
|
11
|
+
def build: -> StorageSet
|
|
12
|
+
def metrics_store: -> Domain::_MetricsStore
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Wiring
|
|
3
|
+
class System
|
|
4
|
+
include _System
|
|
5
|
+
|
|
6
|
+
@name: String
|
|
7
|
+
|
|
8
|
+
attr_reader light_factory: Domain::_LightFactory
|
|
9
|
+
attr_reader lights: Concurrent::Map[String, [_Light, Domain::Config]]
|
|
10
|
+
attr_reader system_config: Domain::Config
|
|
11
|
+
|
|
12
|
+
def initialize: (config: Domain::Config) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
T: singleton(Types)
|
|
3
|
+
CONFIG_MUTEX: Mutex
|
|
4
|
+
|
|
5
|
+
self.@configured: bool?
|
|
6
|
+
self.@default_config: Domain::Config?
|
|
7
|
+
self.@systems: Concurrent::Map[String, _System]
|
|
8
|
+
self.@default_light_factory: Wiring::LightFactory?
|
|
9
|
+
|
|
10
|
+
def self.warn_if_reconfiguring: (bool) { () -> void } -> void
|
|
11
|
+
def self.configured?: -> bool
|
|
12
|
+
def self.__stoplight__reset!: -> void
|
|
13
|
+
|
|
14
|
+
def self.system_light: (
|
|
15
|
+
String name,
|
|
16
|
+
?cool_off_time: optional[duration],
|
|
17
|
+
?threshold: optional[percentage | Integer],
|
|
18
|
+
?recovery_threshold: optional[Integer],
|
|
19
|
+
?window_size: optional[duration?],
|
|
20
|
+
?tracked_errors: optional[Array[_ExceptionMatcher]],
|
|
21
|
+
?skipped_errors: optional[Array[_ExceptionMatcher]],
|
|
22
|
+
?data_store: optional[data_store],
|
|
23
|
+
?error_notifier: optional[error_notifier],
|
|
24
|
+
?notifiers: optional[Array[state_transition_notifier]],
|
|
25
|
+
?traffic_control: optional[traffic_control],
|
|
26
|
+
?traffic_recovery: optional[traffic_recovery],
|
|
27
|
+
) -> Domain::Light
|
|
28
|
+
|
|
29
|
+
def self.systems: -> Concurrent::Map[String, _System]
|
|
30
|
+
def self.default_config: -> Domain::Config
|
|
31
|
+
def self.ensure_configured: -> void
|
|
32
|
+
def self.__stoplight__system: (
|
|
33
|
+
_ToS name,
|
|
34
|
+
?cool_off_time: optional[duration],
|
|
35
|
+
?threshold: optional[percentage | Integer],
|
|
36
|
+
?recovery_threshold: optional[Integer],
|
|
37
|
+
?window_size: optional[duration?],
|
|
38
|
+
?tracked_errors: optional[Array[_ExceptionMatcher]],
|
|
39
|
+
?skipped_errors: optional[Array[_ExceptionMatcher]],
|
|
40
|
+
?data_store: optional[data_store],
|
|
41
|
+
?error_notifier: optional[error_notifier],
|
|
42
|
+
?notifiers: optional[Array[state_transition_notifier]],
|
|
43
|
+
?traffic_control: optional[traffic_control],
|
|
44
|
+
?traffic_recovery: optional[traffic_recovery],
|
|
45
|
+
) -> _System
|
|
46
|
+
def self.__stoplight__default_configuration: -> Domain::Config
|
|
47
|
+
def self.__stoplight__default_light_factory: -> Wiring::LightFactory
|
|
48
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module DataStore
|
|
3
|
+
# Configuration for Redis-backed Stoplight storage.
|
|
4
|
+
#
|
|
5
|
+
# @note This is a configuration object, not the storage implementation itself.
|
|
6
|
+
class Redis < Base
|
|
7
|
+
attr_reader redis: redis
|
|
8
|
+
attr_reader warn_on_clock_skew: bool
|
|
9
|
+
|
|
10
|
+
def initialize: (redis, ?warn_on_clock_skew: bool) -> void
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Configuration for Memory-backed Stoplight storage.
|
|
14
|
+
#
|
|
15
|
+
# @note This is a configuration object, not the storage implementation itself.
|
|
16
|
+
class Memory < Base
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Stoplight
|
|
2
|
+
module Error
|
|
3
|
+
class Base < StandardError
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
class ConfigurationError < Base
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class IncorrectColor < Base
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class RedLight < Base
|
|
13
|
+
attr_reader light_name: String
|
|
14
|
+
attr_reader cool_off_time: Numeric
|
|
15
|
+
attr_reader retry_after: Time?
|
|
16
|
+
|
|
17
|
+
def initialize: (String light_name, cool_off_time: Numeric, retry_after: Time?) -> void
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|