Class: Fluent::GroongaOutput::Emitter

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_groonga.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, table, schema) ⇒ Emitter

Returns a new instance of Emitter.



508
509
510
511
512
# File 'lib/fluent/plugin/out_groonga.rb', line 508

def initialize(client, table, schema)
  @client = client
  @table = table
  @schema = schema
end

Instance Method Details

#emit(chunk) ⇒ Object



520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/fluent/plugin/out_groonga.rb', line 520

def emit(chunk)
  records = []
  chunk.msgpack_each do |message|
    tag, _, record = message
    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

#shutdownObject



517
518
# File 'lib/fluent/plugin/out_groonga.rb', line 517

def shutdown
end

#startObject



514
515
# File 'lib/fluent/plugin/out_groonga.rb', line 514

def start
end