Class: Fluent::Plugin::Base

Inherits:
Object
  • Object
show all
Includes:
Configurable, SystemConfig::Mixin
Defined in:
lib/fluent/plugin/base.rb

Defined Under Namespace

Classes: State

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Method Summary collapse

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, included, lookup_type, register_type

Constructor Details

#initializeBase

Returns a new instance of Base.



29
30
31
32
# File 'lib/fluent/plugin/base.rb', line 29

def initialize
  super
  @_state = State.new(false, false, false, false, false, false, false, false, false)
end

Instance Method Details

#after_shutdownObject



70
71
72
73
# File 'lib/fluent/plugin/base.rb', line 70

def after_shutdown
  @_state.after_shutdown = true
  self
end

#after_shutdown?Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/fluent/plugin/base.rb', line 109

def after_shutdown?
  @_state.after_shutdown
end

#after_startObject



50
51
52
53
# File 'lib/fluent/plugin/base.rb', line 50

def after_start
  @_state.after_start = true
  self
end

#after_started?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/fluent/plugin/base.rb', line 93

def after_started?
  @_state.after_start
end

#before_shutdownObject



60
61
62
63
# File 'lib/fluent/plugin/base.rb', line 60

def before_shutdown
  @_state.before_shutdown = true
  self
end

#before_shutdown?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/fluent/plugin/base.rb', line 101

def before_shutdown?
  @_state.before_shutdown
end

#closeObject



75
76
77
78
# File 'lib/fluent/plugin/base.rb', line 75

def close
  @_state.close = true
  self
end

#closed?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/fluent/plugin/base.rb', line 113

def closed?
  @_state.close
end

#configure(conf) ⇒ Object



38
39
40
41
42
43
# File 'lib/fluent/plugin/base.rb', line 38

def configure(conf)
  super
  @_state ||= State.new(false, false, false, false, false, false, false, false, false)
  @_state.configure = true
  self
end

#configured?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/fluent/plugin/base.rb', line 85

def configured?
  @_state.configure
end

#has_router?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/fluent/plugin/base.rb', line 34

def has_router?
  false
end

#inspectObject



121
122
123
124
125
126
127
# File 'lib/fluent/plugin/base.rb', line 121

def inspect
  # Plugin instances are sometimes too big to dump because it may have too many thins (buffer,storage, ...)
  # Original commit comment says that:
  #   To emulate normal inspect behavior `ruby -e'o=Object.new;p o;p (o.__id__<<1).to_s(16)'`.
  #   https://github.com/ruby/ruby/blob/trunk/gc.c#L788
  "#<%s:%014x>" % [self.class.name, '0x%014x' % (__id__ << 1)]
end

#shutdownObject



65
66
67
68
# File 'lib/fluent/plugin/base.rb', line 65

def shutdown
  @_state.shutdown = true
  self
end

#shutdown?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/fluent/plugin/base.rb', line 105

def shutdown?
  @_state.shutdown
end

#startObject



45
46
47
48
# File 'lib/fluent/plugin/base.rb', line 45

def start
  @_state.start = true
  self
end

#started?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/fluent/plugin/base.rb', line 89

def started?
  @_state.start
end

#stopObject



55
56
57
58
# File 'lib/fluent/plugin/base.rb', line 55

def stop
  @_state.stop = true
  self
end

#stopped?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/fluent/plugin/base.rb', line 97

def stopped?
  @_state.stop
end

#terminateObject



80
81
82
83
# File 'lib/fluent/plugin/base.rb', line 80

def terminate
  @_state.terminate = true
  self
end

#terminated?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/fluent/plugin/base.rb', line 117

def terminated?
  @_state.terminate
end