39 const std::vector<ServiceInfo> secondary;
40 std::chrono::milliseconds checkInterval{5000};
41 uint32_t failoverThreshold{1};
42 uint32_t switchBackThreshold{1};
44 Config(
ServiceInfo primary, std::vector<ServiceInfo> secondary)
45 : primary(std::move(primary)), secondary(std::move(secondary)) {}
73 Builder(
ServiceInfo primary, std::vector<ServiceInfo> secondary)
74 : config_(std::move(primary), std::move(secondary)) {}
77 Builder& withCheckInterval(std::chrono::milliseconds interval) {
78 config_.checkInterval = interval;
83 Builder& withFailoverThreshold(uint32_t threshold) {
84 config_.failoverThreshold = threshold;
91 Builder& withSwitchBackThreshold(uint32_t threshold) {
92 config_.switchBackThreshold = threshold;
96 AutoClusterFailover build() {
return AutoClusterFailover(std::move(config_)); }