Class: LaunchDarkly::FileDataSourceImpl
- Inherits:
-
Object
- Object
- LaunchDarkly::FileDataSourceImpl
show all
- Defined in:
- lib/ldclient-rb/file_data_source.rb
Defined Under Namespace
Classes: FileDataSourcePoller
Instance Method Summary
collapse
Constructor Details
#initialize(feature_store, logger, options = {}) ⇒ FileDataSourceImpl
Returns a new instance of FileDataSourceImpl.
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/ldclient-rb/file_data_source.rb', line 127
def initialize(feature_store, logger, options={})
@feature_store = feature_store
@logger = logger
@paths = options[:paths] || []
if @paths.is_a? String
@paths = [ @paths ]
end
@auto_update = options[:auto_update]
if @auto_update && LaunchDarkly.have_listen? && !options[:force_polling] if defined?(JRUBY_VERSION) && JRUBY_VERSION.start_with?("9.1.")
@use_listen = false
else
@use_listen = true
end
end
@poll_interval = options[:poll_interval] || 1
@initialized = Concurrent::AtomicBoolean.new(false)
@ready = Concurrent::Event.new
end
|
Instance Method Details
#initialized? ⇒ Boolean
149
150
151
|
# File 'lib/ldclient-rb/file_data_source.rb', line 149
def initialized?
@initialized.value
end
|
#start ⇒ Object
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# File 'lib/ldclient-rb/file_data_source.rb', line 153
def start
ready = Concurrent::Event.new
ready.set
load_all
if @auto_update
@listener = start_listener
end
ready
end
|
#stop ⇒ Object
171
172
173
|
# File 'lib/ldclient-rb/file_data_source.rb', line 171
def stop
@listener.stop if !@listener.nil?
end
|