Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
partition_options.h
1// Copyright 2019 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_PARTITION_OPTIONS_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_PARTITION_OPTIONS_H
17
18#include "google/cloud/spanner/version.h"
19#include "google/cloud/optional.h"
20#include "google/cloud/options.h"
21#include "absl/types/optional.h"
22#include <google/spanner/v1/spanner.pb.h>
23#include <cstdint>
24
25namespace google {
26namespace cloud {
27namespace spanner {
28GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
29
30/**
31 * Options passed to `Client::PartitionRead` or `Client::PartitionQuery`.
32 *
33 * See documentation in [spanner.proto][spanner-proto].
34 *
35 * [spanner-proto]:
36 * https://github.com/googleapis/googleapis/blob/70147caca58ebf4c8cd7b96f5d569a72723e11c1/google/spanner/v1/spanner.proto#L758
37 */
38struct PartitionOptions {
39 /**
40 * The desired data size for each partition generated.
41 *
42 * The default for this option is currently 1 GiB. This is only a hint. The
43 * actual size of each partition may be smaller or larger than this size
44 * request.
45 */
46 absl::optional<std::int64_t> partition_size_bytes;
47
48 /**
49 * The desired maximum number of partitions to return.
50 *
51 * For example, this may be set to the number of workers available. The
52 * default for this option is currently 10,000. The maximum value is
53 * currently 200,000. This is only a hint. The actual number of partitions
54 * returned may be smaller or larger than this maximum count request.
55 */
56 absl::optional<std::int64_t> max_partitions;
57
58 /**
59 * Use "data boost" in the returned partitions.
60 *
61 * If true, the requests from the subsequent partitioned `Client::Read()`
62 * and `Client::ExecuteQuery()` calls will be executed using the independent
63 * compute resources of Cloud Spanner Data Boost.
64 */
65 bool data_boost = false;
66};
67
68inline bool operator==(PartitionOptions const& a, PartitionOptions const& b) {
71}
72
73inline bool operator!=(PartitionOptions const& a, PartitionOptions const& b) {
74 return !(a == b);
75}
76
77/// Converts `PartitionOptions` to common `Options`.
79
80/// Converts common `Options` to `PartitionOptions`.
82
83GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
84} // namespace spanner
85
86// Internal implementation details that callers should not use.
87namespace spanner_internal {
88GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
89google::spanner::v1::PartitionOptions ToProto(spanner::PartitionOptions const&);
90GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
91} // namespace spanner_internal
92} // namespace cloud
93} // namespace google
94
95#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_PARTITION_OPTIONS_H
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23
PartitionOptions ToPartitionOptions(Options const &)
Converts common Options to PartitionOptions.
Options ToOptions(PartitionOptions const &)
Converts PartitionOptions to common Options.
bool operator==(PartitionOptions const &a, PartitionOptions const &b)
Definition: partition_options.h:68
bool operator!=(PartitionOptions const &a, PartitionOptions const &b)
Definition: partition_options.h:73
Options passed to Client::PartitionRead or Client::PartitionQuery.
Definition: partition_options.h:38
absl::optional< std::int64_t > max_partitions
The desired maximum number of partitions to return.
Definition: partition_options.h:56
bool data_boost
Use "data boost" in the returned partitions.
Definition: partition_options.h:65
absl::optional< std::int64_t > partition_size_bytes
The desired data size for each partition generated.
Definition: partition_options.h:46