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.



544
545
546
547
548
# File 'lib/fluent/plugin/out_groonga.rb', line 544

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

Instance Method Details

#emit(chunk) ⇒ Object



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/fluent/plugin/out_groonga.rb', line 556

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



553
554
# File 'lib/fluent/plugin/out_groonga.rb', line 553

def shutdown
end

#startObject



550
551
# File 'lib/fluent/plugin/out_groonga.rb', line 550

def start
end