C++ Server-Side SDK
LaunchDarkly SDK
defaults.hpp
1 #pragma once
2 #include <launchdarkly/server_side/config/built/data_system/background_sync_config.hpp>
3 #include <launchdarkly/server_side/config/built/data_system/data_destination_config.hpp>
4 #include <launchdarkly/server_side/config/built/data_system/data_system_config.hpp>
5 #include <launchdarkly/server_side/config/built/data_system/lazy_load_config.hpp>
6 
7 namespace launchdarkly::server_side::config {
8 
9 struct Defaults {
10  // No bootstrap phase yet in server-sdk; instead full
11  // sync is done when polling/streaming source initializes.
12  static auto BootstrapConfig() -> std::optional<built::BootstrapConfig> {
13  return std::nullopt;
14  }
15 
16  // Data isn't mirrored anywhere by default.
17  static auto DataDestinationConfig()
18  -> std::optional<built::DataDestinationConfig> {
19  return std::nullopt;
20  }
21 
22  static auto SynchronizerConfig()
23  -> built::BackgroundSyncConfig::StreamingConfig {
24  return {std::chrono::seconds(1), "/all"};
25  }
26 
27  static auto BackgroundSyncConfig() -> built::BackgroundSyncConfig {
28  return {BootstrapConfig(), SynchronizerConfig(),
29  DataDestinationConfig()};
30  }
31 
32  static auto LazyLoadConfig() -> built::LazyLoadConfig {
33  return {built::LazyLoadConfig::EvictionPolicy::Disabled,
34  std::chrono::minutes{5}, nullptr};
35  }
36 
37  static auto DataSystemConfig() -> built::DataSystemConfig {
38  return {false, BackgroundSyncConfig()};
39  }
40 };
41 } // namespace launchdarkly::server_side::config