C++ Server-Side SDK
LaunchDarkly SDK
Public Types | Public Member Functions | List of all members
launchdarkly::common::data_sources::DataSourceStatusBase< TDataSourceState > Class Template Reference

Public Types

using ErrorKind = DataSourceStatusErrorKind
 
using ErrorInfo = DataSourceStatusErrorInfo
 
using DateTime = std::chrono::time_point< std::chrono::system_clock >
 
using DataSourceState = TDataSourceState
 

Public Member Functions

DataSourceState State () const
 
DateTime StateSince () const
 
std::optional< ErrorInfoLastError () const
 
 DataSourceStatusBase (DataSourceState state, DateTime state_since, std::optional< ErrorInfo > last_error)
 
 DataSourceStatusBase (DataSourceStatusBase const &item)=default
 
 DataSourceStatusBase (DataSourceStatusBase &&item) noexcept=default
 
DataSourceStatusBaseoperator= (DataSourceStatusBase const &)=delete
 
DataSourceStatusBaseoperator= (DataSourceStatusBase &&)=delete
 

Member Function Documentation

◆ LastError()

template<typename TDataSourceState >
std::optional<ErrorInfo> launchdarkly::common::data_sources::DataSourceStatusBase< TDataSourceState >::LastError ( ) const
inline

Information about the last error that the data source encountered, if any.

This property should be updated whenever the data source encounters a problem, even if it does not cause the state to change. For instance, if a stream connection fails and the state changes to DataSourceState::kInterrupted, and then subsequent attempts to restart the connection also fail, the state will remain DataSourceState::kInterrupted but the error information will be updated each time– and the last error will still be reported in this property even if the state later becomes DataSourceState::kValid.

◆ State()

template<typename TDataSourceState >
DataSourceState launchdarkly::common::data_sources::DataSourceStatusBase< TDataSourceState >::State ( ) const
inline

An enumerated value representing the overall current state of the data source.

◆ StateSince()

template<typename TDataSourceState >
DateTime launchdarkly::common::data_sources::DataSourceStatusBase< TDataSourceState >::StateSince ( ) const
inline

The date/time that the value of State most recently changed.

The meaning of this depends on the current state:

  • For DataSourceState::kInitializing, it is the time that the SDK started initializing.
  • For DataSourceState::kValid, it is the time that the data source most recently entered a valid state, after previously having been DataSourceState::kInitializing or an invalid state such as DataSourceState::kInterrupted.
  • For DataSourceState::kInterrupted, it is the time that the data source most recently entered an error state, after previously having been DataSourceState::kValid.
  • For DataSourceState::kShutdown (client-side) or DataSourceState::kOff (server-side), it is the time that the data source encountered an unrecoverable error or that the SDK was explicitly shut down.

The documentation for this class was generated from the following file: