Skip to content

Commit 36d3700

Browse files
committed
more docs
1 parent 69c1ece commit 36d3700

File tree

3 files changed

+64
-12
lines changed

3 files changed

+64
-12
lines changed

libs/common/include/config/detail/events.hpp

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,73 @@
77
#include "attribute_reference.hpp"
88
namespace launchdarkly::config::detail {
99

10+
/**
11+
* Specifies the security regime for event delivery.
12+
*/
1013
enum class TransportSecurity {
14+
// Plaintext event delivery.
1115
None = 0,
16+
// Event delivery secured by Transport Layer Security.
1217
TLS = 1,
1318
};
1419

1520
struct Events {
1621
public:
1722
template <typename SDK>
1823
friend class EventsBuilder;
24+
/**
25+
* Constructs configuration for the event subsystem.
26+
* @param capacity How many events can queue in memory before new events
27+
* are dropped.
28+
* @param flush_interval How often events are automatically flushed to LaunchDarkly.
29+
* @param path The path component of the LaunchDarkly event delivery endpoint.
30+
* @param all_attributes_private Whether all attributes should be treated as private or not.
31+
* @param private_attrs Which attributes should be treated as private, if all_attributes_private is false.
32+
* @param security Whether a plaintext or encrypted client should be used for event delivery.
33+
*/
1934
Events(std::size_t capacity,
2035
std::chrono::milliseconds flush_interval,
2136
std::string path,
2237
bool all_attributes_private,
2338
AttributeReference::SetType private_attrs,
2439
TransportSecurity security);
25-
std::size_t capacity() const;
26-
std::chrono::milliseconds flush_interval() const;
27-
std::string const& path() const;
28-
bool all_attributes_private() const;
29-
AttributeReference::SetType const& private_attributes() const;
30-
TransportSecurity transport_security() const;
40+
41+
/**
42+
* Capacity of the event processor.
43+
*/
44+
[[nodiscard]] std::size_t capacity() const;
45+
46+
/**
47+
* Flush interval of the event processor, in milliseconds.
48+
*/
49+
[[nodiscard]] std::chrono::milliseconds flush_interval() const;
50+
51+
/**
52+
* Path component of the LaunchDarkly event delivery endpoint.
53+
*/
54+
[[nodiscard]] std::string const& path() const;
55+
56+
/**
57+
* Whether all attributes should be considered private or not.
58+
*/
59+
[[nodiscard]] bool all_attributes_private() const;
60+
61+
/**
62+
* Set of individual attributes that should be considered private.
63+
*/
64+
[[nodiscard]] AttributeReference::SetType const& private_attributes() const;
65+
66+
/**
67+
* Requested transport security.
68+
*/
69+
[[nodiscard]] TransportSecurity transport_security() const;
3170

3271
private:
3372
std::size_t capacity_;
3473
std::chrono::milliseconds flush_interval_;
3574
std::string path_;
3675
bool all_attributes_private_;
3776
AttributeReference::SetType private_attributes_;
38-
3977
TransportSecurity transport_security_;
4078
};
4179

libs/common/include/config/detail/events_builder.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class EventsBuilder {
3838
* Sets the capacity of the event processor. When more events are generated
3939
* within the processor's flush interval than this value, events will be
4040
* dropped.
41-
* @param capacity Event capacity.
41+
* @param capacity Event queue capacity.
4242
* @return Reference to this builder.
4343
*/
4444
EventsBuilder& capacity(std::size_t capacity);
@@ -79,15 +79,22 @@ class EventsBuilder {
7979
EventsBuilder& all_attributes_private(bool);
8080

8181
/**
82-
* Specify an AttributePolicy for individual attributes.
83-
* @return
82+
* Specify that a set of attributes are private.
83+
* @return Reference to this builder.
8484
*/
8585
EventsBuilder& private_attributes(
8686
AttributeReference::SetType private_attrs);
8787

8888
/**
89-
* Builds Events configuration, if the configuration is valid. If not,
90-
* returns an error.
89+
* Specify the transport security regime for event delivery. By default,
90+
* events are delivered using TLS.
91+
* @param regime Security regime.
92+
* @return Reference to this builder.
93+
*/
94+
EventsBuilder& transport_security(TransportSecurity regime);
95+
96+
/**
97+
* Builds Events configuration, if the configuration is valid.
9198
* @return Events config, or error.
9299
*/
93100
[[nodiscard]] tl::expected<Events, Error> build();

libs/common/src/config/events_builder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ EventsBuilder<SDK>& EventsBuilder<SDK>::private_attributes(
3333
return *this;
3434
}
3535

36+
template <typename SDK>
37+
EventsBuilder<SDK>& EventsBuilder<SDK>::transport_security(
38+
TransportSecurity regime) {
39+
config_.transport_security_ = regime;
40+
return *this;
41+
}
42+
3643
template <typename SDK>
3744
tl::expected<Events, Error> EventsBuilder<SDK>::build() {
3845
if (config_.capacity() == 0) {

0 commit comments

Comments
 (0)