C++ Client-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
streaming_data_source.hpp
1#pragma once
2
3#include <boost/asio/any_io_executor.hpp>
4
5#include "data_source.hpp"
6#include "data_source_event_handler.hpp"
7#include "data_source_status_manager.hpp"
8#include "data_source_update_sink.hpp"
9#include "launchdarkly/config/shared/sdks.hpp"
10
11#include <launchdarkly/config/shared/built/data_source_config.hpp>
12#include <launchdarkly/config/shared/built/http_properties.hpp>
13#include <launchdarkly/config/shared/built/service_endpoints.hpp>
14#include <launchdarkly/context.hpp>
15#include <launchdarkly/data/evaluation_result.hpp>
16#include <launchdarkly/logging/logger.hpp>
17#include <launchdarkly/sse/client.hpp>
18
19#include <chrono>
20
21namespace launchdarkly::client_side::data_sources {
22
24 : public IDataSource,
25 public std::enable_shared_from_this<StreamingDataSource> {
26 public:
30 config::shared::ClientSDK> const& data_source_config,
31 config::shared::built::HttpProperties const& http_properties,
32 boost::asio::any_io_executor ioc,
33 Context context,
34 IDataSourceUpdateSink& handler,
35 DataSourceStatusManager& status_manager,
36 Logger const& logger);
37
38 void Start() override;
39 void ShutdownAsync(std::function<void()>) override;
40
41 private:
42 void HandleErrorStateChange(sse::Error error, std::string error_string);
43
44 Context context_;
45 boost::asio::any_io_executor exec_;
46 DataSourceStatusManager& status_manager_;
47 DataSourceEventHandler data_source_handler_;
48 std::string streaming_endpoint_;
49 std::string string_context_;
50
52 data_source_config_;
53
55
56 Logger const& logger_;
57 std::shared_ptr<launchdarkly::sse::Client> client_;
58};
59} // namespace launchdarkly::client_side::data_sources
Definition context.hpp:29
Definition data_source_update_sink.hpp:21
Definition data_source_event_handler.hpp:22
Definition data_source_status_manager.hpp:17
Definition data_source_config.hpp:55