Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 179a0d5

Browse files
LaunchDarklyReleaseBothroederldbwoskow-ldeli-darklyLaunchDarklyCI
authored
prepare 2.6.0 release (#49)
* remove assert on client in internal variation as null client is handled as an error condition * rename object to clause in maybeNegate * update add event to not allocate * ensure events are not leaked after being added * ensure array holding events is not leaked (event objects themselves were never leaked) * assign event to null after ownership transfer to ensure not freed * rename to ldserverapidynamic * update circle config for new library names * forgot to save for last commit * assert on client and remove client null eval error case * reduce memory allocation and convert getIndexForVariationOrRollout to return const * replace hasId with NULL string * remove extra check of iterator * rename kind to reason * free rule id on detail clear if rule type * ensure sub events correctly skip reasons * check events capacity with >= instead of > * operatorInFn simplification, add LD_SDK_VERSION #define * remove duplicate line * add mutex support (unused) * partial convert to use reference counting * update streaming tests * fix memoryInit (currently unsafe handling of error state) * add uthash dep * convert rest of tests to new api * replace segment free with segment rc decrement * convert allFlags store api to use reference counting * ensure prequisiteKey gets freed in details cleanup, simplify evaluation test store creation * fix reference count decrement * ensure subevents always get freed * cleanup leaks in error conditions and generally reduce allocations * remove allocation from parse path * use new detach function instead of duplicate * rename FeatureCollection to FeatureCollectionItem * convert ldstore interface to use static strings instead of enum * update streaming to rename flags to features * replace two instance of free with LDFree * replace two unrelated instances of malloc with LDAlloc * rename flags to features in polling update * DRY up with featureKindToString * more logically organize ldstore * update doxygen header for RC related functions * correctly return NULL when RC lock construction fails * add sanity check assertion that current reference count is > 0 when decrementing * make some routines static and some parameters const * replace free with LDFree in store destroy * add const to ptr for addHidden * rename and make jsonrc destruction static * makeFeatureCollection -> makeFeatureCollectionItem, replacementcollection -> replacementcollectionitem * 1.0.0 beta.1 (#8) prepare 1.0.0-beta.1 release * update readme to refer to better distinguish between server-side and client-side * Add jitter to networking backoff (#9) * Add jitter to network retry backoff * Add prng * Remove GMP dep (#12) * Add support for debugEventsUntilDate (#11) * Windows C++ compatibility (#13) * Window specific time parsing (#14) * Windows CI (#15) * Dynamic library symbol hygiene (#16) * Prepare 1.0.0 beta.2 (#17) * bump version variable * update changelog * add back ifdef cplusplus (#18) * Extra build documentation (#19) * add much more detailed build instructions * update PCRE url text * remove GMP from linux CI * reorganize headers (#21) * Fix doxygen and add docgen infra (#22) * cmake cleanup (#24) * add pedantic flag back * add back wall and wextra * make more idiomatic * Complete doxygen coverage (#23) * applying markdown templates (#25) * bump version and update changelog (#26) * free subevents as append does not transfer ownership (#27) * bump version and add memory leak info to changelog (#28) * Update to handle index events (#29) * switch to using milliseconds everywhere internally (#30) * adding a circleci badge to the readme (#31) * adding a circleci badge to the readme * fix casing * switch from checking for header end within size (usually one) to total (#32) * bump version constant, document changes, remove beta warning (#33) * add /usr/local/include for osx (#34) * bump version, append changelog (#35) * memset time struct (#36) * bump version, document changes (#37) * update type comparison to work with object OR array detection (#38) * Experimention track metric (#40) * prepare 1.1.0 * bump changelog date before release * Fix rule match explanation encoding (#42) * fix json serialization for rule match case * add this fix to the changelog (have not actually released yet) * Double to int variation tests, and document behavior. (#43) * [ch49806] redis store (#44) * [ch58854] Update cJSON to 1.7.12 * [ch57214] Store API v2 (#46) * [ch55939] add Releaser scripts, CircleCI Windows build, use custom Docker image (#45) * [ch59994] add code coverage flag * [ch43307] put user in last bucket for a bucketing fallthrough * [ch60038] dont assert on polling put failure * [ch54986] old osx clock gettime (#51) * [ch60053] fix redis race detection * [ch61092] Event payload ID. (#54) * [ch60589] Cache external store values (#53) * [ch61935] Releaser for redis (#55) * [ch69694] reconnect consistency (#57) * [ch69694] streaming status codes (#58) * [ch71379] create more ideal concurrency h (#59) * [ch72167] api level assert (#61) * [ch72078] remove higher stack assertions for system ops (#60) * [ch72307] optional asserts compilation (#62) * [ch72310] cmake cleanup (#63) * [ch72310] cleanup redis cmake * [ch72763] correct find package (#65) * [ch72838] detangle headers (#66) * [ch73235] enable mock concurrency (#68) * [ch72863] event processing cleanup and optimization (#67) * [ch73704] dedup test utils (#69) * [ch73828] null user key ban (#70) * [ch73828] null user key fix (#71) * [ch73236] detach sse (#72) * [ch73698] mock backend server and polling test (#73) * [ch74213] release bundle (#75) * [ch73853] start of defensive mode (#74) * [ch75034] enable and fix more warnings (#76) * [ch73853] add logging to existing defensive checks (#77) * [ch75137] double for large milliseconds (#85) * [ch75136] c89 fix for loop initialization * [ch75131] add time.h on posix * [ch75126] Fix event generation for NULL fallback * [ch73853] remove extra error channels * [ch73853] Defensive JSON (#78) * [ch73853] enable defensive api by default (#81) * [ch75201] custom bool type for public api (#86) * [ch74995] null fallback tests (#87) * [ch74995] basic stream mock (#88) * undelete docs directory (#91) * [ch76282] wrapper metadata config (#92) * [ch78853] Add 32 bit linux CI (#93) * [ch80280] usleep error (#94) * [ch80280] skip sleep on EINTR * [ch80617] c sdk common (#96) * [ch80617] add common headers to doxygen * [ch81023] accept header (#98) * [ch81049] add common/include to public header export * [ch81355] fix experimentation events (#100) * [ch94759] bump xcode to next circleci supported version * [ch94757] cleanup staticGetValue after use in test #101 * [ch94758] run valgrind memcheck in linux ci (#103) * [ch94776] fix helgrind warning #104 * [ch94759] releaser upgrade xcode version #105 * [ch95201] Update to use LDBasicLoggerThreadSafe in tests (#106) * [ch97247] more coverage and bug fixes (#107) * [ch97472] use Findhiredis (#108) * [ch99403] Add Alias method (#110) * [ch99260] Add O3 build and cleanup warnings (#109) * Update c-sdk-common (#111) * Removed the guides link * [ch100420] Hook in c-sdk-common LDUser (#112) * run clang format (#113) * Forgotten clang-format and C standard audit. (#114) * [ch109467] fix bucketBy (#115) * [ch111014] remove stdbool.h references (#117) * [ch111014] Ensure modern clang passes (#118) * [ch111482] fix OSX CI (#119) * [ch111482] fix osx releaser (#120) * merge experimentation allocation changes * [ch114396] improve flag / segment validation (#121) * ch121458 Ensure that LDAllFlags returns all valid flags in the case where some flags are malformed. * ch121458 Handle the case where there are not any flags in the store. * ch121458 Remove unused eval status. * ch121458 Run test before shutting down logger. * ch121458 Address style feedback. Space after if. * ch121458 Check that result is empty in malformed fallthrough case. * ch121458 Allow for the rollout kind to be empty. * ch121458 Summarize events with EVAL_SCHEMA errors. * ch121458 Re-enable tests. Fix formatting. * ch121458 Remove comment about updating test. * Remove duplicate line. * ch123139 Allow the c-server-sdk to build from any directory on windows. * Rlamb/ch122102/add unit testing framework (#123) * ch122102 Implement google test framework and start implementing tests. * ch122102 Migrate tests for eval, config, and the event-processor. * ch122102 Add events tests and update other tests with better assertions. * ch122102 Add tests for json, lru, and misc. * ch122101 Add offline and mock tests. * ch122102 Add operators, store backend, and segments tests. * ch122102 Add tests for streaming and variations. * ch122102 Implement stores tests for redis and memory. Rename files all back to start with test-. * ch122102 Allow CTest to discover google tests. * ch122102 Add missing include(GoogleTest) * ch122102 Re-order dependencies to ensure google-test present when needed. * ch122102 Resolve testing issue. * ch122102 Make it clear which stores the tests are running on. * ch122102 Add git dependency. * ch122102 Simplify conditional to please windows. * ch122102 Add missing alogrithm header from test-operators. * ch122102 Change clang C++ compiler * ch122102 Make google test use the same CRT * ch122102 Teardown threads after tearing down other resources. * ch122102 Revert change cause by over aggressive refactor command. * ch122102 Revert collateral files impacted by bad refactor. * ch122102 Remove more refactoring colateral * ch122102 Intermediate step in getting things to appear as moves. * ch122102 Test files are now renames. * ch122102 Reformat all test code. * ch122102 Additional comment cleanup. * ch122102 Rename stores test file. * ch122102 Resolve test memory leak. * ch122102 Pack testing struct to prevent valgrind issue with parameterized tests in google test. * Update fixture comment to make more sense. * ch122102 Add blank lines to end of files. Re-enable tests. * ch122102 Make all CMakeLists.txt have the same minimum required version. * ch122102 Start addressing review feedback. * ch122102 Use the wrapper header thread. It will assert if the conditions are not met. * ch122102 Use the correct define to enable the additional redis tests. * ch123169 Add unit test reporting for circleci. (#125) * ch123169 Add unit test reporting for circleci. * ch123169 End files with blank line. * ch123169 Switch to absolute GTEST_OUTPUT directory. * ch123169 Update to use pwd * Updates docs URLs * ch124211 Make google test makefile not relative. (#127) * update Releaser config and scripts to v2 model (#128) * update Releaser config and scripts to v2 format * fix config syntax * use newer version of ld-c-sdk-ubuntu image that includes git * move copying of artifacts to build step * go back to using CircleCI for the Linux build because otherwise the linux-specific build-docs script doesn't get run * fix script to not do Releaser-dependent things unless it's being called in that context * rm unused * sc-126967 Build for windows in release. (#129) * SC-130264: Update PCRE download URL [Windows] (#131) * Update PCRE download URL to Sourceforge to fix Windows build The original FTP server hosted by pcre.org is defunct. This commit updates the build to download the PCRE package from Sourceforge instead. Additionally, a basic SHA256 check has been added to ensure the remote package does not silently change out from under us. * Remove unused headers from various source files (#130) * Fix batch of spelling issues (#133) * Add dedicated valgrind & helgrind analysis jobs (#136) * Add dedicated valgrind & helgrind analysis jobs * Minor updates to language (#140) * Fix language 'API Interface' -> 'API' (#141) * SC-121933: Add additional JSON helpers (#142) * Add additional JSON helpers for directly setting strings, bools, numbers * Add JSON helper for setting a non-owned object reference * Add JSON helper for setting & creating a child object * SC-131685: Add LDVersion API (#145) * Add LDVersion() API * SC-121933: Add LDAllFlagsState API (#143) * Adds missing LDAllFlagsState functionality. * Use CircleCI macOS Gen2 resource class. (#148) * SC-138968: SDK Test Harness contract implementation (#146) * Implement contract test server * Add initial test failure suppression file * Adds singleton info (#153) * Allow LDJSONVariation to accept any type (#149) LDJSONVariation should not have an expectation on type, which was previously "array or object". It should function with any representable type, including NULL. This commit updates the method to always pass the type check. * Do not return variation index when user requests wrong flag type (#152) The SDK correctly reported an error when user requested the wrong type for a flag, but it also returned a variation index of 0. This is incorrect. Now, it returns no variation (hasVariation = false), which aligns with our docs on the subject. * Don't emit warnings when optional flag data is missing (#150) SDK would emit a warning such as "LDGetNumber value is not a number" when trying to parse optional flag data, like debugEventsUntilDate. Fixed to only parse such values if they are present. If null, they remain at their default values assigned by the parser. * Remove trailing slash from streaming URI (#151) * Remove trailing slash from streaming, base, and events URI * Add additional tests for trailing slashes * SC-134551: Fix LDStoreInitialized double-free & add concurrency test helper (#139) * Switch to drd from helgrind (which had false positives in curl) & add relevant suppressions for drd * Add concurrency helper test fixture * Add concurrency test for LDClientFlush * Add test for double-free in LDStoreInitialized * Fix double-free in LDStoreInitialized with complete refactorization * Add documentation of $initChecked * Remove embedded nlohmann/json and replace with FetchContent (#157) * Add new suppressions to handle v1.3 of SDK test harness (#158) * FileData source (#155) * Add initial work to get FileData data source support * Init store with FileData; support flags, segments, and flagValues * Add datafiles; file data tests and missing h file * Flip object merge order to give precedence to earlier flags. Add more file tests * fix memory leaks * Fix 32 bit operating systems. Only support 4gb files. * convert ssize_t file_count to int fileCount in hopes of making MSVC happy * Add FileData documentation to integrations/file_data.h * Fixes to style per PR; Fix tests to use LDSetDataSource; Add lots of defensive checks to JSON allocation; Added blocks to file loading function to narrow the scope of temporary variables * Extract readFile helper function to cleanup loadFile; rename loadFile to loadJSONFile to better reflect its return type; Cleanup tests by extracting memory management and client initialization into helper classes * Add error checks to JSON functions that were missed in original. Remember to free context and dataSource in failure case * Add CommonFixture SetUp and TearDown calls to FileDataFixture SetUp and TearDown * Convert FileDataInit from a variadic function to accepting an array as a second argument * Remove the references to a new version number; Remove assertion about filecount, just initialize with empty flags; Add test to ensure that empty file array doesnt explode; * Remove @SInCE from file_data.h Co-authored-by: Casey Waldren <cwaldren@launchdarkly.com> * Fix AllFlagsState behavior when flag evaluation fails (#159) * Fix AllFlagsState behavior when flag fails to evaluate Do not add invalid flags to the AllFlagsState object. Instead, skip them, like the AllFlags function. This commit also ports over the AllFlags unit tests to AllFlagsState. * Re-generate test harness suppressions file. * Update testharness-suppressions to handle latest additions to upstream contract tests * Merge TestData source (#160) * Implement TestData data source integration Co-authored-by: Ben Levy <benjaminlevy007@gmail.com> * Implement service-endpoints capability for contract tests (#161) * Implement service-endpoints capability for contract tests * Add events/disabling/* to testharness-suppressions These are expected to fail, since the SDK in fact does not implement this feature. * Increase EventProcessor's encapsulation and add some documentation (#164) * Refactored EventProcessor's APIs for better clarity; made it an opaque struct; added documentation * Implement config option to disable analytic events (#165) * Implement disabling analytic events * Call floor() on computed milliseconds values (#167) LaunchDarkly services expect milliseconds in JSON to be representable by an integer. Right now that's not the case, since calls to timespec divide the nanosecond value by 1e6. Update the getUnixMilliseconds API to return whole numbers. Co-authored-by: Harpo Roeder <hroeder@launchdarkly.com> Co-authored-by: Ben Woskow <bwoskow@launchdarkly.com> Co-authored-by: Ben Woskow <48036130+bwoskow-ld@users.noreply.github.com> Co-authored-by: Eli Bishop <eli@launchdarkly.com> Co-authored-by: LaunchDarklyCI <dev@launchdarkly.com> Co-authored-by: LaunchDarklyReleaseBot <launchdarklyreleasebot@launchdarkly.com> Co-authored-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Co-authored-by: Ember Stevens <ember.stevens@launchdarkly.com> Co-authored-by: ember-stevens <79482775+ember-stevens@users.noreply.github.com> Co-authored-by: Casey Waldren <cwaldren@launchdarkly.com> Co-authored-by: Gavin Whelan <gwhelan@launchdarkly.com> Co-authored-by: Ben Levy <benjaminlevy007@gmail.com>
1 parent 08c05ce commit 179a0d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3659
-511
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if (REDIS_STORE)
5959
add_subdirectory(stores/redis)
6060
endif (REDIS_STORE)
6161

62-
file(GLOB SOURCES "src/*" "third-party/src/*" "c-sdk-common/src/*")
62+
file(GLOB SOURCES "src/*" "src/integrations/*" "third-party/src/*" "c-sdk-common/src/*")
6363

6464
if(NOT DEFINED MSVC)
6565
list(REMOVE_ITEM SOURCES

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ start-contract-test-service-bg:
1111
@make start-contract-test-service >$(TEMP_TEST_OUTPUT) 2>&1 &
1212

1313
run-contract-tests:
14-
@curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/master/downloader/run.sh \
14+
@curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/main/downloader/run.sh \
1515
| VERSION=v1 PARAMS="-url http://localhost:8000 -debug -stop-service-at-end $(TEST_HARNESS_PARAMS)" sh
1616

1717
contract-tests: build-contract-tests start-contract-test-service-bg run-contract-tests

c-sdk-common/src/utility.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define _CRT_RAND_S
66
#endif
77
#include <stdlib.h>
8+
#include <math.h>
89

910
#include <launchdarkly/json.h>
1011
#include <launchdarkly/memory.h>
@@ -107,7 +108,7 @@ LDi_sleepMilliseconds(const unsigned long milliseconds)
107108
static double
108109
LDi_timeSpecToMilliseconds(const struct timespec ts)
109110
{
110-
return ((double)ts.tv_sec * 1000.0) + ((double)ts.tv_nsec / 1000000.0);
111+
return floor(((double)ts.tv_sec * 1000.0) + ((double)ts.tv_nsec / 1000000.0));
111112
}
112113

113114
LDBoolean
@@ -168,7 +169,7 @@ LDBoolean
168169
LDi_getUnixMilliseconds(double *const resultMilliseconds)
169170
{
170171
#ifdef _WIN32
171-
*resultMilliseconds = (double)time(NULL) * 1000.0;
172+
*resultMilliseconds = floor((double)time(NULL) * 1000.0);
172173

173174
return LDBooleanTrue;
174175
#else

c-sdk-common/src/utility.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@
2222

2323
LDBoolean
2424
LDi_sleepMilliseconds(const unsigned long milliseconds);
25+
2526
LDBoolean
2627
LDi_getMonotonicMilliseconds(double *const resultMilliseconds);
28+
2729
LDBoolean
2830
LDi_getUnixMilliseconds(double *const resultMilliseconds);
31+
2932
LDBoolean
3033
LDi_randomHex(char *const buffer, const size_t bufferSize);
34+
3135
#define LD_UUID_SIZE 36
3236
LDBoolean
3337
LDi_UUIDv4(char *const buffer);

contract-tests/lib/internal/include/definitions/definitions.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,24 @@ struct SDKConfigEventParams {
5555
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(SDKConfigEventParams, baseUri, capacity, enableDiagnostics,
5656
allAttributesPrivate, globalPrivateAttributes, flushIntervalMs,
5757
inlineUsers);
58+
struct SDKConfigServiceEndpointsParams {
59+
std::optional<std::string> streaming;
60+
std::optional<std::string> polling;
61+
std::optional<std::string> events;
62+
};
63+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(SDKConfigServiceEndpointsParams, streaming, polling, events);
64+
5865

5966
struct SDKConfigParams {
6067
std::string credential;
6168
std::optional<uint32_t> startWaitTimeMs;
6269
std::optional<bool> initCanFail;
6370
std::optional<SDKConfigStreamingParams> streaming;
6471
std::optional<SDKConfigEventParams> events;
72+
std::optional<SDKConfigServiceEndpointsParams> serviceEndpoints;
6573
};
6674
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(SDKConfigParams, credential, startWaitTimeMs, initCanFail,
67-
streaming, events);
75+
streaming, events, serviceEndpoints);
6876

6977
struct CreateInstanceParams {
7078
SDKConfigParams configuration;

contract-tests/lib/internal/src/client_entity.cpp

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,29 +206,37 @@ bool ClientEntity::customEvent(const CustomEventParams &params) {
206206
return false;
207207
}
208208

209-
struct LDJSON* json = params.data ?
209+
struct LDJSON* data = params.data ?
210210
LDJSONDeserialize(params.data->dump().c_str()) :
211211
LDNewNull();
212212

213-
if (params.metricValue) {
214-
return static_cast<bool>(LDClientTrackMetric(
213+
214+
if (params.omitNullData.value_or(false) && !params.metricValue && !params.data) {
215+
return static_cast<bool>(LDClientTrack(
215216
m_client,
216217
params.eventKey.c_str(),
217218
user.get(),
218-
json,
219-
*params.metricValue
219+
data
220220
));
221221
}
222-
if (params.data) {
222+
223+
if (!params.metricValue) {
223224
return static_cast<bool>(LDClientTrack(
224225
m_client,
225226
params.eventKey.c_str(),
226227
user.get(),
227-
json
228+
data
228229
));
229230
}
230231

231-
return false;
232+
233+
return static_cast<bool>(LDClientTrackMetric(
234+
m_client,
235+
params.eventKey.c_str(),
236+
user.get(),
237+
data,
238+
*params.metricValue
239+
));
232240
}
233241

234242
bool ClientEntity::aliasEvent(const AliasEventParams &params) {
@@ -317,6 +325,18 @@ struct LDConfig * make_config(const SDKConfigParams &in) {
317325
return nullptr;
318326
}
319327

328+
if (in.serviceEndpoints) {
329+
if (in.serviceEndpoints->streaming) {
330+
LDConfigSetStreamURI(out, in.serviceEndpoints->streaming->c_str());
331+
}
332+
if (in.serviceEndpoints->polling) {
333+
LDConfigSetBaseURI(out, in.serviceEndpoints->polling->c_str());
334+
}
335+
if (in.serviceEndpoints->events) {
336+
LDConfigSetEventsURI(out, in.serviceEndpoints->events->c_str());
337+
}
338+
}
339+
320340
if (in.streaming && in.streaming->baseUri) {
321341
LDConfigSetStreamURI(out, in.streaming->baseUri->c_str());
322342
}

contract-tests/lib/internal/src/service.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ void TestService::get_status(const httplib::Request &req, httplib::Response &res
2727
"strongly-typed",
2828
"all-flags-with-reasons",
2929
"all-flags-client-side-only",
30-
"all-flags-details-only-for-tracked-flags"
30+
"all-flags-details-only-for-tracked-flags",
31+
"service-endpoints"
3132
};
3233
res.set_content(rsp.dump(), "application/json");
3334
}

include/launchdarkly/client.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ LD_EXPORT(LDBoolean) LDClientIsInitialized(struct LDClient *const client);
5757
* @param[in] user The user to generate the event for. Ownership is not
5858
* transferred. May not be `NULL`.
5959
* @param[in] data The JSON to attach to the event. Ownership of `data` is
60-
* transferred. May be `NULL`.
61-
* @return True if the event was queued, False on error.
60+
* transferred only if True is returned. May be `NULL`.
61+
* @return True if the event was queued successfully, or if analytics events are disabled. False on error.
6262
*/
6363
LD_EXPORT(LDBoolean)
6464
LDClientTrack(
@@ -77,7 +77,7 @@ LDClientTrack(
7777
* @param[in] data The JSON to attach to the event. Ownership of `data` is
7878
* transferred. May be `NULL`.
7979
* @param[in] metric A metric to be associated with the event.
80-
* @return True if the event was queued, False on error.
80+
* @return True if the event was queued successfully, or if analytics events are disabled. False on error.
8181
*/
8282
LD_EXPORT(LDBoolean)
8383
LDClientTrackMetric(
@@ -94,7 +94,7 @@ LDClientTrackMetric(
9494
* transferred. May not be `NULL`.
9595
* @param[in] previousUser The previous version of a user. Ownership is not
9696
* transferred. May not be `NULL`.
97-
* @return True if the event was queued, False on error.
97+
* @return True if the event was queued successfully, or if analytics events are disabled. False on error.
9898
*/
9999
LD_EXPORT(LDBoolean)
100100
LDClientAlias(
@@ -107,7 +107,7 @@ LDClientAlias(
107107
* @param[in] client The client to use. May not be `NULL`.
108108
* @param[in] user The user to generate the event for. Ownership is not
109109
* transferred. May not be `NULL`.
110-
* @return True if the event was queued, False on error.
110+
* @return True if the event was queued successfully, or if analytics events are disabled. False on error.
111111
*/
112112
LD_EXPORT(LDBoolean)
113113
LDClientIdentify(

include/launchdarkly/config.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <launchdarkly/boolean.h>
99
#include <launchdarkly/export.h>
1010
#include <launchdarkly/store.h>
11+
#include <launchdarkly/data_source.h>
1112

1213
/**
1314
* @struct LDConfig
@@ -223,6 +224,16 @@ LD_EXPORT(void)
223224
LDConfigSetFeatureStoreBackend(
224225
struct LDConfig *const config, struct LDStoreInterface *const backend);
225226

227+
/**
228+
* @brief Sets the implementation of the data source
229+
* @param[in] config The configuration to modify. May not be `NULL`.
230+
* @param[in] dataSource May be `NULL`. Ownership of `dataSource` is transferred.
231+
* @return Void.
232+
*/
233+
LD_EXPORT(void)
234+
LDConfigSetDataSource(
235+
struct LDConfig *const config, struct LDDataSource *const dataSource);
236+
226237
/**
227238
* @brief When a feature store backend is provided, configure how long items
228239
* will be cached in memory. Set the value to zero to always hit the external

include/launchdarkly/data_source.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*!
2+
* @file data_source.h
3+
* @brief Public API for data source implementation
4+
*/
5+
#pragma once
6+
7+
/**
8+
* @struct LDDataSource
9+
* @brief An opaque data source object.
10+
*/
11+
struct LDDataSource;

0 commit comments

Comments
 (0)