Class: Fluent::Plugin::GroongaInput::BaseInput

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/fluent/plugin/in_groonga.rb

Direct Known Subclasses

GQTPInput, HTTPInput

Constant Summary collapse

DEFAULT_EMIT_COMMANDS =
[
  "clearlock",
  "column_copy",
  "column_create",
  "column_remove",
  "column_rename",
  "config_delete",
  "config_set",
  "delete",
  "load",
  "lock_acquire",
  "lock_clear",
  "lock_release",
  "logical_table_remove",
  "object_remove",
  "plugin_register",
  "plugin_unregister",
  "register",
  "reindex",
  "table_copy",
  "table_create",
  "table_remove",
  "table_rename",
  "truncate",
]

Instance Method Summary collapse

Constructor Details

#initialize(input_plugin) ⇒ BaseInput

Returns a new instance of BaseInput.



147
148
149
# File 'lib/fluent/plugin/in_groonga.rb', line 147

def initialize(input_plugin)
  @input_plugin = input_plugin
end

Instance Method Details

#configure(conf) ⇒ Object



151
152
153
154
155
156
# File 'lib/fluent/plugin/in_groonga.rb', line 151

def configure(conf)
  super

  @port ||= default_port
  @real_port ||= default_port
end

#emit(command, params) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/fluent/plugin/in_groonga.rb', line 158

def emit(command, params)
  normalized_command = command.split(".")[0]
  return unless emit_command?(normalized_command)
  case @input_plugin.command_name_position
  when :tag
    tag = "groonga.command.#{normalized_command}"
    record = params
  else
    tag = "groonga.command"
    record = {
      "name" => normalized_command,
      "arguments" => params
    }
  end
  @input_plugin.router.emit(tag,
                            Engine.now,
                            record)
end

#logObject



177
178
179
# File 'lib/fluent/plugin/in_groonga.rb', line 177

def log
  @input_plugin.log
end