3 #include "data_components/big_segments/big_segment_store_status_provider.hpp"
4 #include "data_components/big_segments/big_segment_store_wrapper.hpp"
5 #include "data_components/status_notifications/data_source_status_manager.hpp"
6 #include "data_interfaces/system/idata_system.hpp"
7 #include "evaluation/evaluator.hpp"
8 #include "events/event_scope.hpp"
9 #include "hooks/hook_executor.hpp"
11 #include <launchdarkly/config/client.hpp>
12 #include <launchdarkly/context.hpp>
13 #include <launchdarkly/data/evaluation_detail.hpp>
14 #include <launchdarkly/error.hpp>
15 #include <launchdarkly/events/event_processor_interface.hpp>
16 #include <launchdarkly/logging/logger.hpp>
17 #include <launchdarkly/server_side/client.hpp>
18 #include <launchdarkly/value.hpp>
20 #include <boost/asio/executor_work_guard.hpp>
21 #include <boost/asio/io_context.hpp>
23 #include <tl/expected.hpp>
25 #include <condition_variable>
29 #include <shared_mutex>
33 namespace launchdarkly::server_side {
53 std::string event_name,
55 double metric_value)
override;
58 std::string event_name,
66 std::string event_name,
70 void Track(
Context const& ctx, std::string event_name)
override;
73 std::string event_name,
82 bool default_value)
override;
91 bool default_value)
override;
101 std::string default_value)
override;
106 std::string default_value,
112 std::string default_value)
override;
117 std::string default_value,
122 double default_value)
override;
126 double default_value,
132 double default_value)
override;
137 double default_value,
142 int default_value)
override;
151 int default_value)
override;
161 Value default_value)
override;
170 Value default_value)
override;
190 Value const& default_value,
193 std::string
const& method_name);
195 template <
typename T>
198 enum Value::Type value_type,
200 Value const& default_value,
202 std::string
const& method_name) {
204 VariationInternal(ctx, key, default_value, events_with_reasons_,
205 hook_context, method_name);
206 if (result.Value().Type() == value_type) {
215 enum Value::Type value_type,
216 std::string
const& key,
217 Value const& default_value,
219 std::string
const& method_name);
222 std::string
const& key,
224 Value const& default_value,
228 std::optional<data_model::Flag>
const& flag);
230 [[nodiscard]] std::optional<enum EvaluationReason::ErrorKind>
231 PreEvaluationChecks(
Context const& context)
const;
233 void TrackInternal(
Context const& ctx,
234 std::string event_name,
235 std::optional<Value> data,
236 std::optional<double> metric_value,
239 std::future<bool> StartAsyncInternal(
240 std::function<
bool(DataSourceStatus::DataSourceState)> predicate);
242 void LogVariationCall(std::string
const& key,
bool flag_present)
const;
249 boost::asio::io_context ioc_;
250 boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
258 std::unique_ptr<data_interfaces::IDataSystem> data_system_;
260 std::unique_ptr<events::IEventProcessor> event_processor_;
265 std::shared_ptr<data_components::BigSegmentStoreWrapper> big_segment_store_;
268 mutable std::mutex init_mutex_;
269 std::condition_variable init_waiter_;
276 std::thread run_thread_;
Definition: context.hpp:29
Definition: evaluation_detail.hpp:18
T const & Value() const
Definition: evaluation_detail.cpp:29
ErrorKind
Definition: evaluation_reason.hpp:39
Definition: http_properties.hpp:70
Definition: all_flags_state.hpp:27
Options
Definition: all_flags_state.hpp:29
Definition: client_impl.hpp:35
EvaluationDetail< std::string > StringVariationDetail(Context const &ctx, FlagKey const &key, std::string default_value) override
Definition: client_impl.cpp:639
EvaluationDetail< int > IntVariationDetail(Context const &ctx, FlagKey const &key, int default_value) override
Definition: client_impl.cpp:712
void Track(Context const &ctx, std::string event_name, Value data, double metric_value) override
Definition: client_impl.cpp:392
Value JsonVariation(Context const &ctx, FlagKey const &key, Value default_value) override
Definition: client_impl.cpp:764
double DoubleVariation(Context const &ctx, FlagKey const &key, double default_value) override
Definition: client_impl.cpp:696
EvaluationDetail< bool > BoolVariationDetail(Context const &ctx, FlagKey const &key, bool default_value) override
Definition: client_impl.cpp:604
void Identify(Context context) override
Definition: client_impl.cpp:283
int IntVariation(Context const &ctx, FlagKey const &key, int default_value) override
Definition: client_impl.cpp:730
EvaluationDetail< double > DoubleVariationDetail(Context const &ctx, FlagKey const &key, double default_value) override
Definition: client_impl.cpp:676
void FlushAsync() override
Definition: client_impl.cpp:437
IBigSegmentStoreStatusProvider & BigSegmentStoreStatus() override
Definition: client_impl.cpp:784
EvaluationDetail< Value > JsonVariationDetail(Context const &ctx, FlagKey const &key, Value default_value) override
Definition: client_impl.cpp:746
std::future< bool > StartAsync() override
Definition: client_impl.cpp:289
std::string StringVariation(Context const &ctx, FlagKey const &key, std::string default_value) override
Definition: client_impl.cpp:659
IDataSourceStatusProvider & DataSourceStatus() override
Definition: client_impl.cpp:780
bool BoolVariation(Context const &ctx, FlagKey const &key, bool default_value) override
Definition: client_impl.cpp:623
bool Initialized() const override
Definition: client_impl.cpp:307
Definition: event_scope.hpp:14
Definition: big_segment_store_status.hpp:43
Definition: client.hpp:23
std::string FlagKey
Definition: client.hpp:28
Definition: data_source_status.hpp:69
Adapts a BigSegmentStoreWrapper to the public IBigSegmentStoreStatusProvider, converting the internal...
Definition: big_segment_store_status_provider.hpp:27
Definition: data_source_status_manager.hpp:16
Definition: evaluator.hpp:17
Definition: config.hpp:14