C++ Server-Side SDK
LaunchDarkly SDK
Public Types | Public Member Functions | List of all members
launchdarkly::server_side::integrations::IBigSegmentStore Class Referenceabstract

Interface for a Big Segments persistent store. More...

#include <ibig_segment_store.hpp>

Public Types

using GetMembershipResult = tl::expected< Membership, std::string >
 
using GetMetadataResult = tl::expected< std::optional< StoreMetadata >, std::string >
 

Public Member Functions

 IBigSegmentStore (IBigSegmentStore const &)=delete
 
 IBigSegmentStore (IBigSegmentStore &&)=delete
 
IBigSegmentStoreoperator= (IBigSegmentStore const &)=delete
 
IBigSegmentStoreoperator= (IBigSegmentStore &&)=delete
 
virtual GetMembershipResult GetMembership (std::string const &context_hash) const noexcept=0
 Looks up the Big Segments membership for a single context. More...
 
virtual GetMetadataResult GetMetadata () const noexcept=0
 Returns store-level metadata used by the SDK to detect staleness. More...
 

Detailed Description

Interface for a Big Segments persistent store.

A Big Segment is a segment whose membership list lives outside the LaunchDarkly flag payload, in an external shared store populated by the LaunchDarkly Relay Proxy. At evaluation time the SDK does a point lookup against the store rather than carrying the full membership list in memory.

Implementations of this interface live in dedicated integration libraries (e.g. server-sdk-redis-source, server-sdk-dynamodb-source) and are passed to the SDK via the Big Segments config builder. The SDK wraps every implementation in an internal caching / staleness-tracking layer, so implementations should NOT cache results themselves — perform every lookup the SDK asks for.

The SDK hashes the context key (SHA-256 then base64-encoded) before calling GetMembership, so an implementation only ever sees opaque hashes; raw context keys are never sent to the store.

Implementations must be thread-safe.

Member Function Documentation

◆ GetMembership()

virtual GetMembershipResult launchdarkly::server_side::integrations::IBigSegmentStore::GetMembership ( std::string const &  context_hash) const
pure virtualnoexcept

Looks up the Big Segments membership for a single context.

Parameters
context_hashBase64-encoded SHA-256 of the context key. Implementations should treat this as an opaque identifier.
Returns
A Membership snapshot. Most contexts are in no Big Segments, in which case the returned Membership has no entries (every Membership::CheckMembership call against it returns std::nullopt). Returns an error if the lookup itself failed.

◆ GetMetadata()

virtual GetMetadataResult launchdarkly::server_side::integrations::IBigSegmentStore::GetMetadata ( ) const
pure virtualnoexcept

Returns store-level metadata used by the SDK to detect staleness.

Returns
StoreMetadata if the store has a metadata record, std::nullopt if no metadata has ever been written (the store was never populated), or an error if the lookup itself failed.

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