Class: LogStash::PluginMixins::JdbcStreaming::StatementHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb

Overview

so as to not clash with the class of the same name and function in the jdbc input this is in the ‘module JdbcStreaming` namespace this duplication can be removed in a universal plugin

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin) ⇒ StatementHandler

Returns a new instance of StatementHandler.



17
18
19
20
21
22
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 17

def initialize(plugin)
  @statement = plugin.statement
  klass = plugin.use_cache ? RowCache : NoCache
  @cache = klass.new(plugin.cache_size, plugin.cache_expiration)
  post_init(plugin)
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



15
16
17
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 15

def cache
  @cache
end

#parametersObject (readonly)

Returns the value of attribute parameters.



15
16
17
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 15

def parameters
  @parameters
end

#statementObject (readonly)

Returns the value of attribute statement.



15
16
17
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 15

def statement
  @statement
end

Class Method Details

.build_statement_handler(plugin) ⇒ Object



10
11
12
13
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 10

def self.build_statement_handler(plugin)
  klass = plugin.use_prepared_statements ? PreparedStatementHandler : NormalStatementHandler
  klass.new(plugin)
end

Instance Method Details

#cache_lookup(db, event) ⇒ Object

Get from cache or performs remote lookup and saves to cache

Parameters:

  • db (Sequel::Database)
  • event (LogStash::Event)


28
29
30
# File 'lib/logstash/plugin_mixins/jdbc_streaming/statement_handler.rb', line 28

def cache_lookup(db, event)
  # override in subclass
end