Class: LaunchDarkly::Interfaces::DataSource::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/ldclient-rb/interfaces/data_source.rb

Overview

Information about the data source's status and about the last status change.

Constant Summary collapse

INITIALIZING =

The initial state of the data source when the SDK is being initialized.

If it encounters an error while it initializes, it retries, and the state remains at INITIALIZING until it succeeds and becomes VALID. This is also true for an error that needs to be fixed, such as a rejected SDK key. In the FDv2 data system, it can instead become OFF after an error it does not retry.

:initializing
VALID =

Indicates that the data source is currently operational and has not had any problems since the last time it received data.

In streaming mode, this means that there is currently an open stream connection and that at least one initial message has been received on the stream. In polling mode, it means that the last poll request succeeded.

:valid
INTERRUPTED =

Indicates that the data source encountered an error that it will attempt to recover from.

In streaming mode, this means that the stream connection failed, or had to be dropped due to some other error, and will be retried after a backoff delay. In polling mode, it means that the last poll request failed, and a new poll request will be made after the polling interval, or after a longer backoff delay for unexpected error types.

:interrupted
OFF =

Indicates that the data source has been permanently shut down.

This could be because the SDK client was explicitly shut down. In the FDv2 data system, it can also mean the data source stopped after an error it does not retry.

Unless the SDK is configured with Config#data_system_config, no other state follows this one.

:off

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state, state_since, last_error) ⇒ Status

Returns a new instance of Status.



212
213
214
215
216
# File 'lib/ldclient-rb/interfaces/data_source.rb', line 212

def initialize(state, state_since, last_error)
  @state = state
  @state_since = state_since
  @last_error = last_error
end

Instance Attribute Details

#last_error ⇒ ErrorInfo? (readonly)

Returns a description of the last error or nil if no errors have occurred since startup.

Returns:

  • (ErrorInfo, nil) —

    a description of the last error or nil if no errors have occurred since startup



210
211
212
# File 'lib/ldclient-rb/interfaces/data_source.rb', line 210

def last_error
  @last_error
end

#state ⇒ Symbol (readonly)

Returns The basic state.

Returns:

  • (Symbol) —

    The basic state



206
207
208
# File 'lib/ldclient-rb/interfaces/data_source.rb', line 206

def state
  @state
end

#state_since ⇒ Time (readonly)

Returns timestamp of the last state transition.

Returns:

  • (Time) —

    timestamp of the last state transition



208
209
210
# File 'lib/ldclient-rb/interfaces/data_source.rb', line 208

def state_since
  @state_since
end