Class: Fluent::GroongaOutput::Emitter
- Inherits:
-
Object
- Object
- Fluent::GroongaOutput::Emitter
- Defined in:
- lib/fluent/plugin/out_groonga.rb
Instance Method Summary collapse
- #emit(chunk) ⇒ Object
-
#initialize(client, table) ⇒ Emitter
constructor
A new instance of Emitter.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(client, table) ⇒ Emitter
Returns a new instance of Emitter.
276 277 278 279 280 |
# File 'lib/fluent/plugin/out_groonga.rb', line 276 def initialize(client, table) @client = client @table = table @schema = nil end |
Instance Method Details
#emit(chunk) ⇒ Object
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/fluent/plugin/out_groonga.rb', line 289 def emit(chunk) records = [] chunk.msgpack_each do || tag, _, record = if /\Agroonga\.command\./ =~ tag name = $POSTMATCH unless records.empty? store_records(records) records.clear end @client.execute(name, record) else records << record end end store_records(records) unless records.empty? end |
#shutdown ⇒ Object
286 287 |
# File 'lib/fluent/plugin/out_groonga.rb', line 286 def shutdown end |
#start ⇒ Object
282 283 284 |
# File 'lib/fluent/plugin/out_groonga.rb', line 282 def start @schema = Schema.new(@client, @table) end |