Class: Fluent::MemoryBuffer

Inherits:
BasicBuffer show all
Defined in:
lib/fluent/plugin/buf_memory.rb

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Method Summary collapse

Methods inherited from BasicBuffer

#clear!, #emit, #enable_parallel, #keys, #pop, #push, #queue_size, #shutdown, #start, #storable?, #total_queued_chunk_size, #write_chunk

Methods inherited from Buffer

#clear!, #emit, #keys, #pop, #push, #shutdown, #start

Methods included from Configurable

#config, included, lookup_type, register_type

Constructor Details

#initializeMemoryBuffer

Returns a new instance of MemoryBuffer.



75
76
77
# File 'lib/fluent/plugin/buf_memory.rb', line 75

def initialize
  super
end

Instance Method Details

#before_shutdown(out) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/fluent/plugin/buf_memory.rb', line 94

def before_shutdown(out)
  if @flush_at_shutdown
    synchronize do
      @map.each_key {|key|
        push(key)
      }
      while pop(out)
      end
    end
  end
end

#configure(conf) ⇒ Object



85
86
87
88
89
90
91
92
# File 'lib/fluent/plugin/buf_memory.rb', line 85

def configure(conf)
  super

  unless @flush_at_shutdown
    $log.warn "When flush_at_shutdown is false, buf_memory discards buffered chunks at shutdown."
    $log.warn "Please confirm 'flush_at_shutdown false' configuration is correct or not."
  end
end

#enqueue(chunk) ⇒ Object



114
115
# File 'lib/fluent/plugin/buf_memory.rb', line 114

def enqueue(chunk)
end

#new_chunk(key) ⇒ Object



106
107
108
# File 'lib/fluent/plugin/buf_memory.rb', line 106

def new_chunk(key)
  MemoryBufferChunk.new(key)
end

#resumeObject



110
111
112
# File 'lib/fluent/plugin/buf_memory.rb', line 110

def resume
  return [], {}
end