Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
wait_until_ready_options.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2026-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
21#include <couchbase/error.hxx>
23
24#include <functional>
25#include <set>
26#include <utility>
27
28namespace couchbase
29{
50 {
51 desired_state_ = desired_state;
52 return *this;
53 }
54
65 auto service_types(std::set<service_type> service_types) -> wait_until_ready_options&
66 {
67 service_types_ = std::move(service_types);
68 return *this;
69 }
70
77 struct built {
79 std::set<service_type> service_types;
80 };
81
93 [[nodiscard]] auto build() const -> built
94 {
95 return { desired_state_, service_types_ };
96 }
97
98private:
99 cluster_state desired_state_{ cluster_state::online };
100 std::set<service_type> service_types_{};
101};
102
110using wait_until_ready_handler = std::function<void(error)>;
111} // namespace couchbase
Definition error.hxx:31
Represents a single item from the result of scan().
Definition allow_querying_search_index_options.hxx:28
cluster_state
Describes the readiness of the cluster (or a bucket) from the SDK's point of view.
Definition cluster_state.hxx:29
@ online
Every reachable endpoint of every requested service is responsive.
Definition cluster_state.hxx:31
std::function< void(error)> wait_until_ready_handler
The signature for the handler of the cluster::wait_until_ready() and bucket::wait_until_ready() opera...
Definition wait_until_ready_options.hxx:110
Immutable value object representing consistent options.
Definition wait_until_ready_options.hxx:77
cluster_state desired_state
Definition wait_until_ready_options.hxx:78
std::set< service_type > service_types
Definition wait_until_ready_options.hxx:79
Options for wait_until_ready() and wait_until_ready().
Definition wait_until_ready_options.hxx:36
auto build() const -> built
Validates the options and returns them as an immutable value.
Definition wait_until_ready_options.hxx:93
auto desired_state(cluster_state desired_state) -> wait_until_ready_options &
Sets the state the cluster (or bucket) has to reach before the wait completes.
Definition wait_until_ready_options.hxx:49
auto service_types(std::set< service_type > service_types) -> wait_until_ready_options &
Customizes the set of services to consider.
Definition wait_until_ready_options.hxx:65