Module: LaunchDarkly::Interfaces::DataStore::StatusProvider

Included in:
LaunchDarkly::Impl::DataStore::StatusProvider
Defined in:
lib/ldclient-rb/interfaces.rb

Overview

An interface for querying the status of a persistent data store.

An implementation of this interface is returned by LDClient#data_store_status_provider. Application code should not implement this interface.

Instance Method Summary collapse

Instance Method Details

#add_listener(listener) ⇒ Object

Subscribes for notifications of status changes.

Applications may wish to know if there is an outage in a persistent data store, since that could mean that flag evaluations are unable to get the flag data from the store (unless it is currently cached) and therefore might return default values.

If the SDK receives an exception while trying to query or update the data store, then it notifies listeners that the store appears to be offline (LaunchDarkly::Interfaces::DataStore::Status#available is false) and begins polling the store at intervals until a query succeeds. Once it succeeds, it notifies listeners again with LaunchDarkly::Interfaces::DataStore::Status#available set to true.

This method has no effect if the data store implementation does not support status tracking, such as if you are using the default in-memory store rather than a persistent store.

Parameters:

  • listener (#update)

    the listener to add



320
321
# File 'lib/ldclient-rb/interfaces.rb', line 320

def add_listener(listener)
end

#monitoring_enabled?Boolean

Indicates whether the current data store implementation supports status monitoring.

This is normally true for all persistent data stores, and false for the default in-memory store. A true value means that any listeners added with #add_listener can expect to be notified if there is any error in storing data, and then notified again when the error condition is resolved. A false value means that the status is not meaningful and listeners should not expect to be notified.

Returns:

  • (Boolean)

    true if status monitoring is enabled



300
301
# File 'lib/ldclient-rb/interfaces.rb', line 300

def monitoring_enabled?
end

#remove_listener(listener) ⇒ Object

Unsubscribes from notifications of status changes.

This method has no effect if the data store implementation does not support status tracking, such as if you are using the default in-memory store rather than a persistent store.

Parameters:

  • listener (Object)

    the listener to remove; if no such listener was added, this does nothing



331
332
# File 'lib/ldclient-rb/interfaces.rb', line 331

def remove_listener(listener)
end

#statusStatus

Returns the current status of the store.

This is only meaningful for persistent stores, or any custom data store implementation that makes use of the status reporting mechanism provided by the SDK. For the default in-memory store, the status will always be reported as "available".

Returns:

  • (Status)

    the latest status



287
288
# File 'lib/ldclient-rb/interfaces.rb', line 287

def status
end