Class: Karafka::Web::Ui::Models::Status::Checks::Base
- Inherits:
-
Object
- Object
- Karafka::Web::Ui::Models::Status::Checks::Base
- Defined in:
- lib/karafka/web/ui/models/status/checks/base.rb
Overview
Base class for all status checks.
Provides a DSL for declaring check dependencies and characteristics, as well as common functionality for executing checks.
Direct Known Subclasses
CommandsTopicPresence, Connection, ConsumersReports, ConsumersReportsSchemaState, ConsumersSchemas, Enabled, InitialConsumersMetrics, InitialConsumersState, LiveReporting, MaterializingLag, Partitions, ProSubscription, Replication, RoutingTopicsPresence, StateCalculation, Topics
Class Attribute Summary collapse
-
.dependency ⇒ Symbol?
readonly
The dependency check name, or nil if independent.
Class Method Summary collapse
-
.depends_on(check_name) ⇒ Symbol
Declares that this check depends on another check.
-
.halted_details ⇒ Hash, Array
Returns the halted details for this check.
-
.independent! ⇒ Boolean
Marks this check as independent (no dependencies).
-
.independent? ⇒ Boolean
Checks if this is an independent check.
Instance Method Summary collapse
-
#call ⇒ Status::Step
Executes the check and returns a Step result.
-
#initialize(context) ⇒ Base
constructor
Initializes the check with a shared context.
Constructor Details
#initialize(context) ⇒ Base
Initializes the check with a shared context.
91 92 93 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 91 def initialize(context) @context = context end |
Class Attribute Details
.dependency ⇒ Symbol? (readonly)
Returns the dependency check name, or nil if independent.
42 43 44 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 42 def dependency @dependency end |
Class Method Details
.depends_on(check_name) ⇒ Symbol
Declares that this check depends on another check.
When a check has a dependency, it will be halted if the dependency fails.
55 56 57 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 55 def depends_on(check_name) @dependency = check_name end |
.halted_details ⇒ Hash, Array
Returns the halted details for this check.
Override this method in subclasses to provide specific details when the check is halted due to dependency failure.
82 83 84 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 82 def halted_details {} end |
.independent! ⇒ Boolean
Marks this check as independent (no dependencies).
Independent checks don’t depend on any other check and will always execute regardless of other check results.
65 66 67 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 65 def independent! @independent = true end |
.independent? ⇒ Boolean
Checks if this is an independent check.
72 73 74 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 72 def independent? @independent || false end |
Instance Method Details
#call ⇒ Status::Step
Executes the check and returns a Step result.
Subclasses must implement this method to perform the actual check.
101 102 103 |
# File 'lib/karafka/web/ui/models/status/checks/base.rb', line 101 def call raise NotImplementedError, "Subclasses must implement #call" end |