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.
Defined Under Namespace
Modules: DiagnosticAccumulator, DiagnosticSource, Initializer, Synchronizer Classes: DataAvailability, FDv1, Update
Instance Method Summary collapse
-
#data_availability ⇒ Symbol
Indicates what form of data is currently available.
-
#data_source_status_provider ⇒ LaunchDarkly::Interfaces::DataSource::StatusProvider
Returns an interface for tracking the status of the data source.
-
#data_store_status_provider ⇒ LaunchDarkly::Interfaces::DataStore::StatusProvider
Returns an interface for tracking the status of a persistent data store.
-
#flag_change_broadcaster ⇒ LaunchDarkly::Impl::Broadcaster
Returns the broadcaster for flag change notifications.
-
#set_diagnostic_accumulator(diagnostic_accumulator) ⇒ void
Sets the diagnostic accumulator for streaming initialization metrics.
-
#start ⇒ Concurrent::Event
Starts the data system.
-
#stop ⇒ void
Halts the data system.
-
#store ⇒ Object
Returns the data store used by the data system.
-
#target_availability ⇒ Symbol
Indicates the ideal form of data attainable given the current configuration.
Instance Method Details
#data_availability ⇒ Symbol
Indicates what form of data is currently available.
This is calculated dynamically based on current system state.
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_provider ⇒ LaunchDarkly::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.
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_provider ⇒ LaunchDarkly::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.
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_broadcaster ⇒ LaunchDarkly::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.
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.
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 |
#start ⇒ Concurrent::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.
29 30 31 |
# File 'lib/ldclient-rb/impl/data_system.rb', line 29 def start raise NotImplementedError, "#{self.class} must implement #start" end |
#stop ⇒ void
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.
39 40 41 |
# File 'lib/ldclient-rb/impl/data_system.rb', line 39 def stop raise NotImplementedError, "#{self.class} must implement #stop" end |
#store ⇒ Object
Returns the data store used by the data system.
107 108 109 |
# File 'lib/ldclient-rb/impl/data_system.rb', line 107 def store raise NotImplementedError, "#{self.class} must implement #store" end |
#target_availability ⇒ Symbol
Indicates the ideal form of data attainable given the current configuration.
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 |