Class: LaunchDarkly::Impl::DataSource::StatusProvider

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
LaunchDarkly::Interfaces::DataSource::StatusProvider
Defined in:
lib/ldclient-rb/impl/data_source.rb

Overview

Since:

  • 5.5.0

Instance Method Summary collapse

Constructor Details

#initialize(status_broadcaster, update_sink) ⇒ StatusProvider

Returns a new instance of StatusProvider.

Since:

  • 5.5.0



16
17
18
19
20
21
# File 'lib/ldclient-rb/impl/data_source.rb', line 16

def initialize(status_broadcaster, update_sink)
  # @type [Broadcaster]
  @status_broadcaster = status_broadcaster
  # @type [UpdateSink]
  @data_source_update_sink = update_sink
end

Instance Method Details

#add_listener(listener) ⇒ Object Originally defined in module LaunchDarkly::Interfaces::DataSource::StatusProvider

Subscribes for notifications of status changes.

The listener will be notified whenever any property of the status has changed. See LaunchDarkly::Interfaces::DataSource::Status for an explanation of the meaning of each property and what could cause it to change.

Notifications will be dispatched on a worker thread. It is the listener's responsibility to return as soon as possible so as not to block subsequent notifications.

Parameters:

  • the (#update)

    listener to add

#remove_listener(listener) ⇒ Object Originally defined in module LaunchDarkly::Interfaces::DataSource::StatusProvider

Unsubscribes from notifications of status changes.

#statusObject

Since:

  • 5.5.0



23
24
25
# File 'lib/ldclient-rb/impl/data_source.rb', line 23

def status
  @data_source_update_sink.current_status
end