C++ Server-Side SDK
LaunchDarkly SDK
events.hpp
1 #pragma once
2 
3 #include <launchdarkly/attribute_reference.hpp>
4 
5 #include <chrono>
6 #include <cstddef>
7 #include <optional>
8 #include <string>
9 #include <unordered_map>
10 
11 namespace launchdarkly::config::shared::builders {
12 template <typename T>
13 class EventsBuilder;
14 }
15 
16 namespace launchdarkly::config::shared::built {
17 
18 class Events final {
19  public:
20  template <typename SDK>
21  friend class builders::EventsBuilder;
44  Events(bool enabled,
45  std::size_t capacity,
46  std::chrono::milliseconds flush_interval,
47  std::string path,
48  bool all_attributes_private,
49  AttributeReference::SetType private_attrs,
50  std::chrono::milliseconds delivery_retry_delay,
51  std::size_t flush_workers,
52  std::optional<std::size_t> context_keys_cache_capacity);
53 
57  [[nodiscard]] bool Enabled() const;
58 
62  [[nodiscard]] std::size_t Capacity() const;
63 
67  [[nodiscard]] std::chrono::milliseconds FlushInterval() const;
68 
69  /*
70  * If an event payload fails to be delivered and can be retried, how long
71  * to wait before retrying.
72  */
73  [[nodiscard]] std::chrono::milliseconds DeliveryRetryDelay() const;
74 
78  [[nodiscard]] std::string const& Path() const;
79 
83  [[nodiscard]] bool AllAttributesPrivate() const;
84 
88  [[nodiscard]] AttributeReference::SetType const& PrivateAttributes() const;
89 
93  [[nodiscard]] std::size_t FlushWorkers() const;
94 
100  [[nodiscard]] std::optional<std::size_t> ContextKeysCacheCapacity() const;
101 
102  private:
103  bool enabled_;
104  std::size_t capacity_;
105  std::chrono::milliseconds flush_interval_;
106  std::string path_;
107  bool all_attributes_private_;
108  AttributeReference::SetType private_attributes_;
109  std::chrono::milliseconds delivery_retry_delay_;
110  std::size_t flush_workers_;
111  std::optional<std::size_t> context_keys_cache_capacity_;
112 };
113 
114 bool operator==(Events const& lhs, Events const& rhs);
115 
116 } // namespace launchdarkly::config::shared::built
AttributeReference::SetType const & PrivateAttributes() const
Definition: events.cpp:48
std::optional< std::size_t > ContextKeysCacheCapacity() const
Definition: events.cpp:56
Events(bool enabled, std::size_t capacity, std::chrono::milliseconds flush_interval, std::string path, bool all_attributes_private, AttributeReference::SetType private_attrs, std::chrono::milliseconds delivery_retry_delay, std::size_t flush_workers, std::optional< std::size_t > context_keys_cache_capacity)
Definition: events.cpp:5
std::string const & Path() const
Definition: events.cpp:40
std::size_t FlushWorkers() const
Definition: events.cpp:52
std::size_t Capacity() const
Definition: events.cpp:28
bool Enabled() const
Definition: events.cpp:24
std::chrono::milliseconds FlushInterval() const
Definition: events.cpp:32
bool AllAttributesPrivate() const
Definition: events.cpp:44