Class: Fluent::Plugin::Base
Defined Under Namespace
Classes: State
Constant Summary
Configurable::CONFIG_TYPE_REGISTRY
Instance Attribute Summary collapse
Instance Method Summary
collapse
#system_config, #system_config_override
#config, #configure_proxy_generate, #configured_section_create, included, lookup_type, register_type
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
31
32
33
34
35
36
37
|
# File 'lib/fluent/plugin/base.rb', line 31
def initialize
super
@_state = State.new(false, false, false, false, false, false, false, false, false)
@_context_router = nil
@_fluentd_worker_id = nil
@under_plugin_development = false
end
|
Instance Attribute Details
#under_plugin_development ⇒ Object
Returns the value of attribute under_plugin_development.
29
30
31
|
# File 'lib/fluent/plugin/base.rb', line 29
def under_plugin_development
@under_plugin_development
end
|
Instance Method Details
#after_shutdown ⇒ Object
108
109
110
111
|
# File 'lib/fluent/plugin/base.rb', line 108
def after_shutdown
@_state.after_shutdown = true
self
end
|
#after_shutdown? ⇒ Boolean
147
148
149
|
# File 'lib/fluent/plugin/base.rb', line 147
def after_shutdown?
@_state.after_shutdown
end
|
#after_start ⇒ Object
88
89
90
91
|
# File 'lib/fluent/plugin/base.rb', line 88
def after_start
@_state.after_start = true
self
end
|
#after_started? ⇒ Boolean
131
132
133
|
# File 'lib/fluent/plugin/base.rb', line 131
def after_started?
@_state.after_start
end
|
#before_shutdown ⇒ Object
98
99
100
101
|
# File 'lib/fluent/plugin/base.rb', line 98
def before_shutdown
@_state.before_shutdown = true
self
end
|
#before_shutdown? ⇒ Boolean
139
140
141
|
# File 'lib/fluent/plugin/base.rb', line 139
def before_shutdown?
@_state.before_shutdown
end
|
#close ⇒ Object
113
114
115
116
|
# File 'lib/fluent/plugin/base.rb', line 113
def close
@_state.close = true
self
end
|
#closed? ⇒ Boolean
151
152
153
|
# File 'lib/fluent/plugin/base.rb', line 151
def closed?
@_state.close
end
|
53
54
55
56
57
58
59
60
61
|
# File 'lib/fluent/plugin/base.rb', line 53
def configure(conf)
if conf.respond_to?(:for_this_worker?) && conf.for_this_worker?
system_config_override(workers: 1)
end
super
@_state ||= State.new(false, false, false, false, false, false, false, false, false)
@_state.configure = true
self
end
|
123
124
125
|
# File 'lib/fluent/plugin/base.rb', line 123
def configured?
@_state.configure
end
|
#context_router ⇒ Object
79
80
81
|
# File 'lib/fluent/plugin/base.rb', line 79
def context_router
@_context_router
end
|
#context_router=(router) ⇒ Object
75
76
77
|
# File 'lib/fluent/plugin/base.rb', line 75
def context_router=(router)
@_context_router = router
end
|
#fluentd_worker_id ⇒ Object
47
48
49
50
51
|
# File 'lib/fluent/plugin/base.rb', line 47
def fluentd_worker_id
return @_fluentd_worker_id if @_fluentd_worker_id
@_fluentd_worker_id = (ENV['SERVERENGINE_WORKER_ID'] || 0).to_i
@_fluentd_worker_id
end
|
#has_router? ⇒ Boolean
39
40
41
|
# File 'lib/fluent/plugin/base.rb', line 39
def has_router?
false
end
|
#inspect ⇒ Object
159
160
161
162
163
164
165
|
# File 'lib/fluent/plugin/base.rb', line 159
def inspect
"#<%s:%014x>" % [self.class.name, '0x%014x' % (__id__ << 1)]
end
|
#multi_workers_ready? ⇒ Boolean
63
64
65
|
# File 'lib/fluent/plugin/base.rb', line 63
def multi_workers_ready?
true
end
|
#plugin_root_dir ⇒ Object
43
44
45
|
# File 'lib/fluent/plugin/base.rb', line 43
def plugin_root_dir
nil end
|
#shutdown ⇒ Object
103
104
105
106
|
# File 'lib/fluent/plugin/base.rb', line 103
def shutdown
@_state.shutdown = true
self
end
|
#shutdown? ⇒ Boolean
143
144
145
|
# File 'lib/fluent/plugin/base.rb', line 143
def shutdown?
@_state.shutdown
end
|
#start ⇒ Object
83
84
85
86
|
# File 'lib/fluent/plugin/base.rb', line 83
def start
@_state.start = true
self
end
|
#started? ⇒ Boolean
127
128
129
|
# File 'lib/fluent/plugin/base.rb', line 127
def started?
@_state.start
end
|
#stop ⇒ Object
93
94
95
96
|
# File 'lib/fluent/plugin/base.rb', line 93
def stop
@_state.stop = true
self
end
|
#stopped? ⇒ Boolean
135
136
137
|
# File 'lib/fluent/plugin/base.rb', line 135
def stopped?
@_state.stop
end
|
#string_safe_encoding(str) {|str| ... } ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/fluent/plugin/base.rb', line 67
def string_safe_encoding(str)
unless str.valid_encoding?
log.info "invalid byte sequence is replaced in `#{str}`" if self.respond_to?(:log)
str = str.scrub('?')
end
yield str
end
|
#terminate ⇒ Object
118
119
120
121
|
# File 'lib/fluent/plugin/base.rb', line 118
def terminate
@_state.terminate = true
self
end
|
#terminated? ⇒ Boolean
155
156
157
|
# File 'lib/fluent/plugin/base.rb', line 155
def terminated?
@_state.terminate
end
|