Google Cloud Spanner C++ Client  2.1.0
A C++ Client Library for Google Cloud Spanner
partition_options.h
Go to the documentation of this file.
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 
25 namespace google {
26 namespace cloud {
27 namespace spanner {
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/0ed34e9fdf601dfc37eb24c40e17495b86771ff4/google/spanner/v1/spanner.proto#L651
37  */
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 inline bool operator==(PartitionOptions const& a, PartitionOptions const& b) {
62 }
63 
64 inline bool operator!=(PartitionOptions const& a, PartitionOptions const& b) {
65  return !(a == b);
66 }
67 
68 /// Converts `PartitionOptions` to common `Options`.
70 
71 /// Converts common `Options` to `PartitionOptions`.
73 
75 } // namespace spanner
76 
77 // Internal implementation details that callers should not use.
78 namespace spanner_internal {
80 google::spanner::v1::PartitionOptions ToProto(spanner::PartitionOptions const&);
82 } // namespace spanner_internal
83 } // namespace cloud
84 } // namespace google
85 
86 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_PARTITION_OPTIONS_H