Class: LogStash::Outputs::Application_insights::Storage_recovery

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/outputs/application_insights/storage_recovery.rb

Constant Summary collapse

@@instance =
Storage_recovery.new

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStorage_recovery

Returns a new instance of Storage_recovery.



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/logstash/outputs/application_insights/storage_recovery.rb', line 26

def initialize
  configuration = Config.current
  @logger = configuration[:logger]
  @storage_account_name_key = configuration[:storage_account_name_key]

  @queues = { :commit => {}, :notify => {}, :state_table_update => {} }
  init_queues( @storage_account_name_key, @queues )

  @closing = nil
  @threads = []
end

Class Method Details

.instanceObject



118
119
120
# File 'lib/logstash/outputs/application_insights/storage_recovery.rb', line 118

def self.instance
  @@instance
end

Instance Method Details

#closeObject



60
61
62
63
64
65
# File 'lib/logstash/outputs/application_insights/storage_recovery.rb', line 60

def close
  @closing = true
  # @threads.each do |thread|
  #   thread.join
  # end
end

#recover_later(tuple, action, storage_account_name) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/logstash/outputs/application_insights/storage_recovery.rb', line 47

def recover_later ( tuple, action ,  )
  if stopped?
    if :commit == action
      @state ||= State.instance
      @state.dec_pending_commits
      @shutdown ||= Shutdown.instance
      @shutdown.display_msg("!!! commit won't recover in this session due to shutdown")
    end
  else
    @queues[action][] << tuple
  end
end

#startObject



38
39
40
41
42
43
44
45
# File 'lib/logstash/outputs/application_insights/storage_recovery.rb', line 38

def start
  @storage_account_name_key.each do |, |
    # a threads, per storage  account name
    @queues.each_key do |action|
      @threads << recovery_thread( , action )
    end
  end
end