Module: LaunchDarkly::Impl::DataSystem

Included in:
FDv1
Defined in:
lib/ldclient-rb/impl/data_system.rb,
lib/ldclient-rb/impl/data_system/fdv1.rb

Overview

Mixin that defines the required methods of a data system implementation. The data system is responsible for managing the SDK’s data model, including storage, retrieval, and change detection for feature flag configurations.

This module also contains supporting classes and additional mixins for data system implementations, such as DataAvailability, Update, and protocol-specific mixins.

For operations that can fail, use Result from util.rb.

Application code should not need to implement this directly; it is used internally by the SDK’s data system implementations.

Since:

  • 5.5.0

Defined Under Namespace

Modules: DiagnosticAccumulator, DiagnosticSource, Initializer, Synchronizer Classes: DataAvailability, FDv1, Update

Instance Method Summary collapse

Instance Method Details

#data_availabilitySymbol

Indicates what form of data is currently available.

This is calculated dynamically based on current system state.

Returns:

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



89
90
91
# File 'lib/ldclient-rb/impl/data_system.rb', line 89

def data_availability
  raise NotImplementedError, "#{self.class} must implement #data_availability"
end

#data_source_status_providerLaunchDarkly::Interfaces::DataSource::StatusProvider

Returns an interface for tracking the status of the data source.

The data source is the mechanism that the SDK uses to get feature flag configurations, such as a streaming connection (the default) or poll requests.

Returns:

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



51
52
53
# File 'lib/ldclient-rb/impl/data_system.rb', line 51

def data_source_status_provider
  raise NotImplementedError, "#{self.class} must implement #data_source_status_provider"
end

#data_store_status_providerLaunchDarkly::Interfaces::DataStore::StatusProvider

Returns an interface for tracking the status of a persistent data store.

The provider has methods for checking whether the data store is (as far as the SDK knows) currently operational, tracking changes in this status, and getting cache statistics. These are only relevant for a persistent data store; if you are using an in-memory data store, then this method will return a stub object that provides no information.

Returns:

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



66
67
68
# File 'lib/ldclient-rb/impl/data_system.rb', line 66

def data_store_status_provider
  raise NotImplementedError, "#{self.class} must implement #data_store_status_provider"
end

#flag_change_broadcasterLaunchDarkly::Impl::Broadcaster

Returns the broadcaster for flag change notifications.

Consumers can use this broadcaster to build their own flag tracker or listen for flag changes directly.

Returns:

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



78
79
80
# File 'lib/ldclient-rb/impl/data_system.rb', line 78

def flag_change_broadcaster
  raise NotImplementedError, "#{self.class} must implement #flag_change_broadcaster"
end

#set_diagnostic_accumulator(diagnostic_accumulator) ⇒ void

This method returns an undefined value.

Sets the diagnostic accumulator for streaming initialization metrics. This should be called before start() to ensure metrics are collected.

Parameters:

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



118
119
120
# File 'lib/ldclient-rb/impl/data_system.rb', line 118

def set_diagnostic_accumulator(diagnostic_accumulator)
  raise NotImplementedError, "#{self.class} must implement #set_diagnostic_accumulator"
end

#startConcurrent::Event

Starts the data system.

This method will return immediately. The returned event will be set when the system has reached an initial state (either permanently failed, e.g. due to bad auth, or succeeded).

If called multiple times, returns the same event as the first call.

Returns:

  • (Concurrent::Event)

    Event that will be set when initialization is complete

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



29
30
31
# File 'lib/ldclient-rb/impl/data_system.rb', line 29

def start
  raise NotImplementedError, "#{self.class} must implement #start"
end

#stopvoid

This method returns an undefined value.

Halts the data system. Should be called when the client is closed to stop any long running operations. Makes the data system no longer usable.

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



39
40
41
# File 'lib/ldclient-rb/impl/data_system.rb', line 39

def stop
  raise NotImplementedError, "#{self.class} must implement #stop"
end

#storeObject

Returns the data store used by the data system.

Returns:

  • (Object)

    The read-only store

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



107
108
109
# File 'lib/ldclient-rb/impl/data_system.rb', line 107

def store
  raise NotImplementedError, "#{self.class} must implement #store"
end

#target_availabilitySymbol

Indicates the ideal form of data attainable given the current configuration.

Returns:

  • (Symbol)

    one of the #DataAvailability constants

Raises:

  • (NotImplementedError)

Since:

  • 5.5.0



98
99
100
# File 'lib/ldclient-rb/impl/data_system.rb', line 98

def target_availability
  raise NotImplementedError, "#{self.class} must implement #target_availability"
end