C++ Server-Side SDK
LaunchDarkly SDK
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
launchdarkly::EvaluationReason Class Reference

#include <evaluation_reason.hpp>

Public Types

enum class  Kind {
  kOff = 0 , kFallthrough = 1 , kTargetMatch = 2 , kRuleMatch = 3 ,
  kPrerequisiteFailed = 4 , kError = 5
}
 
enum class  ErrorKind {
  kClientNotReady = 0 , kUserNotSpecified = 1 , kFlagNotFound = 2 , kWrongType = 3 ,
  kMalformedFlag = 4 , kException = 5
}
 

Public Member Functions

enum Kind const & Kind () const
 
std::optional< ErrorKindErrorKind () const
 
std::optional< std::size_t > RuleIndex () const
 
std::optional< std::string > RuleId () const
 
std::optional< std::string > PrerequisiteKey () const
 
bool InExperiment () const
 
std::optional< std::string > BigSegmentStatus () const
 
 EvaluationReason (enum Kind kind, std::optional< enum ErrorKind > error_kind, std::optional< std::size_t > rule_index, std::optional< std::string > rule_id, std::optional< std::string > prerequisite_key, bool in_experiment, std::optional< std::string > big_segment_status)
 
 EvaluationReason (enum ErrorKind error_kind)
 

Static Public Member Functions

static EvaluationReason Off ()
 
static EvaluationReason PrerequisiteFailed (std::string prerequisite_key)
 
static EvaluationReason TargetMatch ()
 
static EvaluationReason Fallthrough (bool in_experiment)
 
static EvaluationReason RuleMatch (std::size_t rule_index, std::optional< std::string > rule_id, bool in_experiment)
 
static EvaluationReason MalformedFlag ()
 

Friends

std::ostream & operator<< (std::ostream &out, Kind const &kind)
 
std::ostream & operator<< (std::ostream &out, ErrorKind const &kind)
 
std::ostream & operator<< (std::ostream &out, EvaluationReason const &reason)
 

Detailed Description

Describes the reason that a flag evaluation produced a particular value.

Member Enumeration Documentation

◆ ErrorKind

Do not change these values. They must remain stable for the C API.

◆ Kind

Do not change these values. They must remain stable for the C API.

Member Function Documentation

◆ BigSegmentStatus()

std::optional< std::string > launchdarkly::EvaluationReason::BigSegmentStatus ( ) const

Describes the validity of Big Segment information, if and only if the flag evaluation required querying at least one Big Segment.

  • "HEALTHY": The Big Segment query involved in the flag evaluation was successful, and the segment state is considered up to date.
  • "STALE": The Big Segment query involved in the flag evaluation was successful, but the segment state may not be up to date
  • "NOT_CONFIGURED": Big Segments could not be queried for the flag evaluation because the SDK configuration did not include a Big Segment store.
  • "STORE_ERROR": The Big Segment query involved in the flag evaluation failed, for instance due to a database error.

◆ ErrorKind()

A further description of the error condition, if the Kind was Kind::kError.

◆ Fallthrough()

EvaluationReason launchdarkly::EvaluationReason::Fallthrough ( bool  in_experiment)
static

The flag evaluated to its fallthrough value.

Parameters
in_experimentWhether the flag is part of an experiment.

◆ InExperiment()

bool launchdarkly::EvaluationReason::InExperiment ( ) const

Whether the evaluation was part of an experiment.

This is true if the evaluation resulted in an experiment rollout and served one of the variations in the experiment. Otherwise it is false or undefined.

◆ Kind()

Returns
The general category of the reason.

◆ MalformedFlag()

EvaluationReason launchdarkly::EvaluationReason::MalformedFlag ( )
static

The flag data was malformed.

◆ Off()

EvaluationReason launchdarkly::EvaluationReason::Off ( )
static

The flag was off.

◆ PrerequisiteFailed()

EvaluationReason launchdarkly::EvaluationReason::PrerequisiteFailed ( std::string  prerequisite_key)
static

The flag didn't return a variation due to a prerequisite failing.

◆ PrerequisiteKey()

std::optional< std::string > launchdarkly::EvaluationReason::PrerequisiteKey ( ) const

The key of the failed prerequisite flag, if the kind was "PREREQUISITE_FAILED".

◆ RuleId()

std::optional< std::string > launchdarkly::EvaluationReason::RuleId ( ) const

The unique identifier of the matched rule, if the kind was "RULE_MATCH".

◆ RuleIndex()

std::optional< std::size_t > launchdarkly::EvaluationReason::RuleIndex ( ) const

The index of the matched rule (0 for the first), if the kind was "RULE_MATCH".

◆ RuleMatch()

EvaluationReason launchdarkly::EvaluationReason::RuleMatch ( std::size_t  rule_index,
std::optional< std::string >  rule_id,
bool  in_experiment 
)
static

The flag evaluated to a particular variation because it matched a rule.

Parameters
rule_indexIndex of the rule.
rule_idID of the rule.
in_experimentWhether the flag is part of an experiment.

◆ TargetMatch()

EvaluationReason launchdarkly::EvaluationReason::TargetMatch ( )
static

The flag evaluated to a particular variation due to a target match.


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