Class: Fluent::Plugin::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.



571
572
573
574
575
# File 'lib/fluent/plugin/out_groonga.rb', line 571

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

Instance Method Details

#emit(chunk) ⇒ Object



583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
# File 'lib/fluent/plugin/out_groonga.rb', line 583

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



580
581
# File 'lib/fluent/plugin/out_groonga.rb', line 580

def shutdown
end

#startObject



577
578
# File 'lib/fluent/plugin/out_groonga.rb', line 577

def start
end