Sha256: 5a7a703217eda57e2f38cb5485efcfd5771fb0e45da773f87529df1c76be7ba5
Contents?: true
Size: 1.61 KB
Versions: 4
Compression:
Stored size: 1.61 KB
Contents
module Flydata module Helper class ActionOwnership attr_accessor :action_name # Resource change flag # true -> action must be taken exclusively attr_accessor :resource_change # action_class has a actual logic attr_accessor :action_class # Owner should be nil(channel) or worker attr_accessor :owner # last processeed time should be updated when worker return # action ownership to channel attr_accessor :last_processed_time attr_accessor :retry_count 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 def processing? !@owner.nil? end def reset_retry_count @retry_count = 0 end def increment_retry_count @retry_count += 1 end 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), ].inject({}) do |h, action| h[action.action_name] = action h end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems