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

Membership describes which Big Segments a single context belongs to, as reported by an IBigSegmentStore lookup. More...

#include <big_segment_store_types.hpp>

Public Member Functions

std::optional< bool > CheckMembership (std::string const &segment_ref) const
 Returns the membership state for a single segment ref. More...
 

Static Public Member Functions

static Membership FromSegmentRefs (std::vector< std::string > const &included_segment_refs, std::vector< std::string > const &excluded_segment_refs)
 Constructs a Membership from the lists of segment refs the context is included in / excluded from. More...
 

Detailed Description

Membership describes which Big Segments a single context belongs to, as reported by an IBigSegmentStore lookup.

Implementations of IBigSegmentStore should construct a Membership using Membership::FromSegmentRefs and return it from IBigSegmentStore::GetMembership. The returned Membership is an immutable snapshot — once constructed it does not observe any later changes to the underlying store.

A "segment ref" is the string <segmentKey>.g<generation>; the SDK constructs that string when evaluating a flag and passes it to CheckMembership.

Implemented inline because integration libraries link against the server-sdk shared library, which only exports the C API — out-of-line symbols defined here would not be visible to consumers.

Member Function Documentation

◆ CheckMembership()

std::optional<bool> launchdarkly::server_side::integrations::Membership::CheckMembership ( std::string const &  segment_ref) const
inline

Returns the membership state for a single segment ref.

Parameters
segment_refThe <segmentKey>.g<generation> ref to look up.
Returns
true if the context is included, false if excluded, and std::nullopt if the segment ref has no entry in this membership.

◆ FromSegmentRefs()

static Membership launchdarkly::server_side::integrations::Membership::FromSegmentRefs ( std::vector< std::string > const &  included_segment_refs,
std::vector< std::string > const &  excluded_segment_refs 
)
inlinestatic

Constructs a Membership from the lists of segment refs the context is included in / excluded from.

If the same segment ref appears in both lists, inclusion wins, matching the LaunchDarkly Big Segments spec.

Parameters
included_segment_refsSegment refs the context is explicitly included in.
excluded_segment_refsSegment refs the context is explicitly excluded from.

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