C++ Server-Side SDK
LaunchDarkly SDK
Public Member Functions | List of all members
launchdarkly::server_side::evaluation::EvaluationStack Class Reference

#include <evaluation_stack.hpp>

Public Member Functions

 EvaluationStack (data_components::BigSegmentStoreWrapper *big_segment_store=nullptr)
 
std::optional< GuardNoticePrerequisite (std::string prerequisite_key)
 
std::optional< GuardNoticeSegment (std::string segment_key)
 
data_components::BigSegmentStoreWrapperBigSegmentStore () const
 
void RecordBigSegmentsStatus (enum EvaluationReason::BigSegmentsStatus status)
 
enum EvaluationReason::BigSegmentsStatus BigSegmentsStatus () const
 
integrations::Membership const * FindMembership (std::string const &context_key) const
 
void StoreMembership (std::string context_key, integrations::Membership membership)
 
void RecordStoreError (std::string context_key)
 
bool DidStoreError (std::string const &context_key) const
 

Detailed Description

EvaluationStack holds the per-evaluation state for a single top-level flag evaluation: the prerequisite/segment chains used for circular-reference detection, plus the Big Segments status and membership cache that a Big Segment lookup populates.

Not thread-safe: a fresh instance is created per top-level evaluation and is never shared across threads.

Constructor & Destructor Documentation

◆ EvaluationStack()

launchdarkly::server_side::evaluation::EvaluationStack::EvaluationStack ( data_components::BigSegmentStoreWrapper big_segment_store = nullptr)
explicit
Parameters
big_segment_storeNon-owning pointer to the Big Segment store wrapper, or nullptr if no store is configured. Must outlive the stack.

Member Function Documentation

◆ BigSegmentsStatus()

enum EvaluationReason::BigSegmentsStatus launchdarkly::server_side::evaluation::EvaluationStack::BigSegmentsStatus ( ) const
Returns
The aggregated Big Segments status, or kNone if no Big Segment was queried during this evaluation.

◆ BigSegmentStore()

data_components::BigSegmentStoreWrapper * launchdarkly::server_side::evaluation::EvaluationStack::BigSegmentStore ( ) const
Returns
The Big Segment store wrapper, or nullptr if none is configured.

◆ DidStoreError()

bool launchdarkly::server_side::evaluation::EvaluationStack::DidStoreError ( std::string const &  context_key) const
Returns
True if a Big Segment store lookup for the given context key has already errored during this evaluation.

◆ FindMembership()

integrations::Membership const * launchdarkly::server_side::evaluation::EvaluationStack::FindMembership ( std::string const &  context_key) const

Returns the cached membership for a context key looked up earlier in this evaluation, or nullptr if that key has not been queried yet.

◆ NoticePrerequisite()

std::optional< Guard > launchdarkly::server_side::evaluation::EvaluationStack::NoticePrerequisite ( std::string  prerequisite_key)

If the given prerequisite key has not been seen, marks it as seen and returns a Guard object. Otherwise, returns std::nullopt.

Parameters
prerequisite_keyKey of the prerequisite.
Returns
Guard object if not seen before, otherwise std::nullopt.

◆ NoticeSegment()

std::optional< Guard > launchdarkly::server_side::evaluation::EvaluationStack::NoticeSegment ( std::string  segment_key)

If the given segment key has not been seen, marks it as seen and returns a Guard object. Otherwise, returns std::nullopt.

Parameters
prerequisite_keyKey of the segment.
Returns
Guard object if not seen before, otherwise std::nullopt.

◆ RecordBigSegmentsStatus()

void launchdarkly::server_side::evaluation::EvaluationStack::RecordBigSegmentsStatus ( enum EvaluationReason::BigSegmentsStatus  status)

Records the status of a Big Segment lookup. If multiple lookups occur in one evaluation, the least-trustworthy status wins (NOT_CONFIGURED > STORE_ERROR > STALE > HEALTHY).

◆ RecordStoreError()

void launchdarkly::server_side::evaluation::EvaluationStack::RecordStoreError ( std::string  context_key)

Records that the Big Segment store returned an error for the given context key during this evaluation. Subsequent Big Segment lookups for the same key must be treated as non-matches without re-querying.

◆ StoreMembership()

void launchdarkly::server_side::evaluation::EvaluationStack::StoreMembership ( std::string  context_key,
integrations::Membership  membership 
)

Caches a context key's membership so later Big Segment lookups for the same key in this evaluation reuse it instead of re-querying the store.


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