Class: LogStash::ConvergeResult
- Inherits:
-
Object
- Object
- LogStash::ConvergeResult
show all
- Defined in:
- lib/logstash/converge_result.rb
Overview
This class allow us to keep track and uniform all the return values from the action task
Defined Under Namespace
Classes: ActionResult, FailedAction, SuccessfulAction
Instance Method Summary
collapse
Constructor Details
#initialize(expected_actions_count) ⇒ ConvergeResult
Returns a new instance of ConvergeResult.
61
62
63
64
|
# File 'lib/logstash/converge_result.rb', line 61
def initialize(expected_actions_count)
@expected_actions_count = expected_actions_count
@actions = {}
end
|
Instance Method Details
#add(action, action_result) ⇒ Object
66
67
68
|
# File 'lib/logstash/converge_result.rb', line 66
def add(action, action_result)
@actions[action] = ActionResult.create(action, action_result)
end
|
#complete? ⇒ Boolean
78
79
80
|
# File 'lib/logstash/converge_result.rb', line 78
def complete?
total == @expected_actions_count
end
|
#failed_actions ⇒ Object
70
71
72
|
# File 'lib/logstash/converge_result.rb', line 70
def failed_actions
filter_by_successful_state(false)
end
|
#fails_count ⇒ Object
86
87
88
|
# File 'lib/logstash/converge_result.rb', line 86
def fails_count
failed_actions.size
end
|
#success? ⇒ Boolean
82
83
84
|
# File 'lib/logstash/converge_result.rb', line 82
def success?
failed_actions.empty? && complete?
end
|
#success_count ⇒ Object
90
91
92
|
# File 'lib/logstash/converge_result.rb', line 90
def success_count
successful_actions.size
end
|
#successful_actions ⇒ Object
74
75
76
|
# File 'lib/logstash/converge_result.rb', line 74
def successful_actions
filter_by_successful_state(true)
end
|
#total ⇒ Object
94
95
96
|
# File 'lib/logstash/converge_result.rb', line 94
def total
@actions.size
end
|