@@ -937,6 +937,110 @@ LDServerSDK_DataSourceStatus_Status(LDServerSDK sdk);
937937LD_EXPORT (void )
938938LDServerDataSourceStatus_Free (LDServerDataSourceStatus status );
939939
940+ typedef struct _LDServerBigSegmentStoreStatus * LDServerBigSegmentStoreStatus ;
941+
942+ /**
943+ * True if the most recent Big Segment store query or metadata poll succeeded.
944+ * If false, Big Segment membership cannot currently be evaluated reliably.
945+ *
946+ * @param status The Big Segment store status. Must not be NULL.
947+ */
948+ LD_EXPORT (bool )
949+ LDServerBigSegmentStoreStatus_Available (LDServerBigSegmentStoreStatus status );
950+
951+ /**
952+ * True if the Big Segment store's data has not been updated within the
953+ * configured stale-after threshold. The data may still be queried; it is
954+ * just older than desired.
955+ *
956+ * @param status The Big Segment store status. Must not be NULL.
957+ */
958+ LD_EXPORT (bool )
959+ LDServerBigSegmentStoreStatus_Stale (LDServerBigSegmentStoreStatus status );
960+
961+ /**
962+ * Frees the Big Segment store status.
963+ * @param status The Big Segment store status to free.
964+ */
965+ LD_EXPORT (void )
966+ LDServerBigSegmentStoreStatus_Free (LDServerBigSegmentStoreStatus status );
967+
968+ typedef void (* ServerBigSegmentStoreStatusCallbackFn )(
969+ LDServerBigSegmentStoreStatus status ,
970+ void * user_data );
971+
972+ /**
973+ * Defines a Big Segment store status listener which may be used to listen
974+ * for changes to the Big Segment store status.
975+ * The struct should be initialized using
976+ * LDServerBigSegmentStoreStatusListener_Init before use.
977+ */
978+ struct LDServerBigSegmentStoreStatusListener {
979+ /**
980+ * Callback function which is invoked for Big Segment store status
981+ * changes.
982+ *
983+ * The provided pointers are only valid for the duration of the function
984+ * call (excluding UserData, whose lifetime is controlled by the caller).
985+ *
986+ * @param status The updated Big Segment store status.
987+ */
988+ ServerBigSegmentStoreStatusCallbackFn StatusChanged ;
989+
990+ /**
991+ * UserData is forwarded into callback functions.
992+ */
993+ void * UserData ;
994+ };
995+
996+ /**
997+ * Initializes a Big Segment store status change listener. Must be called
998+ * before passing the listener to
999+ * LDServerSDK_BigSegmentStoreStatus_OnStatusChange.
1000+ *
1001+ * If the StatusChanged member of the listener struct is not set (NULL),
1002+ * then the function will not register a listener. In that case the return
1003+ * value will be NULL.
1004+ *
1005+ * Create the struct, initialize the struct, set the StatusChanged handler
1006+ * and optionally UserData, and then pass the struct to
1007+ * LDServerSDK_BigSegmentStoreStatus_OnStatusChange.
1008+ *
1009+ * @param listener Listener to initialize.
1010+ */
1011+ LD_EXPORT (void )
1012+ LDServerBigSegmentStoreStatusListener_Init (
1013+ struct LDServerBigSegmentStoreStatusListener * listener );
1014+
1015+ /**
1016+ * Listen for changes to the Big Segment store status.
1017+ *
1018+ * @param sdk SDK. Must not be NULL.
1019+ * @param listener The listener, whose StatusChanged callback will be
1020+ * invoked when the Big Segment store status changes.
1021+ *
1022+ * @return A LDListenerConnection. The connection can be freed using
1023+ * LDListenerConnection_Free and the listener can be disconnected using
1024+ * LDListenerConnection_Disconnect. NULL is returned if the listener's
1025+ * StatusChanged member is NULL.
1026+ */
1027+ LD_EXPORT (LDListenerConnection )
1028+ LDServerSDK_BigSegmentStoreStatus_OnStatusChange (
1029+ LDServerSDK sdk ,
1030+ struct LDServerBigSegmentStoreStatusListener listener );
1031+
1032+ /**
1033+ * The current status of the Big Segment store.
1034+ *
1035+ * If no store is configured, the returned status reports unavailable and
1036+ * not stale.
1037+ *
1038+ * The caller must free the returned value using
1039+ * LDServerBigSegmentStoreStatus_Free.
1040+ */
1041+ LD_EXPORT (LDServerBigSegmentStoreStatus )
1042+ LDServerSDK_BigSegmentStoreStatus_Status (LDServerSDK sdk );
1043+
9401044#ifdef __cplusplus
9411045}
9421046#endif
0 commit comments