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, schema) ⇒ Emitter
constructor
A new instance of Emitter.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(client, table, schema) ⇒ Emitter
Returns a new instance of Emitter.
554 555 556 557 558 |
# File 'lib/fluent/plugin/out_groonga.rb', line 554 def initialize(client, table, schema) @client = client @table = table @schema = schema end |
Instance Method Details
#emit(chunk) ⇒ Object
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/fluent/plugin/out_groonga.rb', line 566 def emit(chunk) records = [] chunk.msgpack_each do || tag, _, record = case tag when /\Agroonga\.command\./ name = $POSTMATCH unless records.empty? store_records(records) records.clear end @client.execute(name, record) when "groonga.command" name = record["name"] arguments = record["arguments"] @client.execute(name, arguments) else records << record end end store_records(records) unless records.empty? end |
#shutdown ⇒ Object
563 564 |
# File 'lib/fluent/plugin/out_groonga.rb', line 563 def shutdown end |
#start ⇒ Object
560 561 |
# File 'lib/fluent/plugin/out_groonga.rb', line 560 def start end |