Class: Flydata::Helper::ActionOwnership
- Inherits:
-
Object
- Object
- Flydata::Helper::ActionOwnership
- Defined in:
- lib/flydata/helper/action_ownership.rb
Instance Attribute Summary collapse
-
#action_class ⇒ Object
action_class has a actual logic.
-
#action_name ⇒ Object
Returns the value of attribute action_name.
-
#last_processed_time ⇒ Object
last processeed time should be updated when worker return action ownership to channel.
-
#owner ⇒ Object
Owner should be nil(channel) or worker.
-
#resource_change ⇒ Object
Resource change flag true -> action must be taken exclusively.
-
#retry_count ⇒ Object
Returns the value of attribute retry_count.
Class Method Summary collapse
Instance Method Summary collapse
- #increment_retry_count ⇒ Object
-
#initialize(action_name, resource_change = false, action_class = nil) ⇒ ActionOwnership
constructor
A new instance of ActionOwnership.
- #processing? ⇒ Boolean
- #reset_retry_count ⇒ Object
Constructor Details
#initialize(action_name, resource_change = false, action_class = nil) ⇒ ActionOwnership
Returns a new instance of ActionOwnership.
22 23 24 25 26 27 28 29 |
# File 'lib/flydata/helper/action_ownership.rb', line 22 def initialize(action_name, resource_change = false, action_class = nil) @action_name = action_name @resource_change = resource_change @action_class = action_class @owner = nil @last_processed_time = -1 @retry_count = 0 end |
Instance Attribute Details
#action_class ⇒ Object
action_class has a actual logic
11 12 13 |
# File 'lib/flydata/helper/action_ownership.rb', line 11 def action_class @action_class end |
#action_name ⇒ Object
Returns the value of attribute action_name.
4 5 6 |
# File 'lib/flydata/helper/action_ownership.rb', line 4 def action_name @action_name end |
#last_processed_time ⇒ Object
last processeed time should be updated when worker return action ownership to channel
18 19 20 |
# File 'lib/flydata/helper/action_ownership.rb', line 18 def last_processed_time @last_processed_time end |
#owner ⇒ Object
Owner should be nil(channel) or worker
14 15 16 |
# File 'lib/flydata/helper/action_ownership.rb', line 14 def owner @owner end |
#resource_change ⇒ Object
Resource change flag true -> action must be taken exclusively
8 9 10 |
# File 'lib/flydata/helper/action_ownership.rb', line 8 def resource_change @resource_change end |
#retry_count ⇒ Object
Returns the value of attribute retry_count.
20 21 22 |
# File 'lib/flydata/helper/action_ownership.rb', line 20 def retry_count @retry_count end |
Class Method Details
.action_ownership_map ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/flydata/helper/action_ownership.rb', line 43 def self.action_ownership_map [ self.new(:check_remote_actions, false, Action::CheckRemoteActions), self.new(:check_abnormal_shutdown, false, Action::CheckAbnormalShutdown), self.new(:send_logs, false, Action::SendLogs), self.new(:stop_agent, true, Action::StopAgent), self.new(:restart_agent, true, Action::RestartAgent), self.new(:update_helper_config, false, Action::UpdateHelperConfig), self.new(:repair, true, Action::Repair), self.new(:resync, true, Action::Resync), self.new(:clear, true, Action::Clear), self.new(:stop_helper, true, Action::StopHelper), self.new(:reset, true, Action::Reset), self.new(:flush, true, Action::Flush), ].inject({}) do |h, action| h[action.action_name] = action h end end |
Instance Method Details
#increment_retry_count ⇒ Object
39 40 41 |
# File 'lib/flydata/helper/action_ownership.rb', line 39 def increment_retry_count @retry_count += 1 end |
#processing? ⇒ Boolean
31 32 33 |
# File 'lib/flydata/helper/action_ownership.rb', line 31 def processing? !@owner.nil? end |
#reset_retry_count ⇒ Object
35 36 37 |
# File 'lib/flydata/helper/action_ownership.rb', line 35 def reset_retry_count @retry_count = 0 end |