Class: Fluent::GroongaOutput::Emitter
- Inherits:
-
Object
- Object
- Fluent::GroongaOutput::Emitter
- Defined in:
- lib/fluent/plugin/out_groonga.rb,
lib/fluent/plugin/out_groonga.rb
Instance Method Summary (collapse)
- - (Object) emit(chunk)
-
- (Emitter) initialize(client, table, schema)
constructor
A new instance of Emitter.
- - (Object) shutdown
- - (Object) start
Constructor Details
- (Emitter) initialize(client, table, schema)
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
- (Object) emit(chunk)
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 |
- (Object) shutdown
286 287 |
# File 'lib/fluent/plugin/out_groonga.rb', line 286 def shutdown end |
- (Object) start
282 283 284 |
# File 'lib/fluent/plugin/out_groonga.rb', line 282 def start @schema = Schema.new(@client, @table) end |