Module: LaunchDarkly::Interfaces::Overrides::OverrideSource

Defined in:
lib/ldclient-rb/interfaces/overrides.rb

Overview

Supplies flag and segment overrides that take precedence over LaunchDarkly data at evaluation time, on a per-key basis.

An override source is not a data source. It does not take part in the data system's initializer and synchronizer pipeline. The override store it populates has no effect on the client's initialization status, data availability, or data source status.

To configure an override source, use DataSystem::ConfigBuilder#overrides.

Flag overrides are currently experimental and subject to change.

Instance Method Summary collapse

Instance Method Details

#start(sink) ⇒ void

This method returns an undefined value.

Begins supplying overrides to the sink and returns without blocking on long-running work. An implementation performs an initial load synchronously, then pushes a full replacement snapshot to the sink whenever its backing data changes, until stop is called. A failed load leaves the previously supplied store untouched by not calling the sink.

The SDK calls this method at most once, before any call to stop. This method is not intended to fail. A source that cannot load its data logs the failure and keeps retrying, as the SDK's file-based source does. A configuration error belongs in the builder's build, where it is raised when the client is created. If this method does raise, the client still starts: the SDK logs the exception, stops the source, removes any snapshot the source supplied, and the client runs without overrides.

Parameters:

Raises:

  • (NotImplementedError)


73
74
75
# File 'lib/ldclient-rb/interfaces/overrides.rb', line 73

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

#stop ⇒ void

This method returns an undefined value.

Stops the source and releases any resources it holds. An exception raised from it is logged and does not stop the client from shutting down. A snapshot that the source supplies after the SDK begins to stop it is ignored.

Raises:

  • (NotImplementedError)


84
85
86
# File 'lib/ldclient-rb/interfaces/overrides.rb', line 84

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