Google Cloud Spanner C++ Client  1.33.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 // http://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 "absl/types/optional.h"
21 #include <google/spanner/v1/spanner.pb.h>
22 
23 namespace google {
24 namespace cloud {
25 namespace spanner {
27 
28 /**
29  * Options passed to `Client::PartitionRead` or `Client::PartitionQuery`.
30  *
31  * See documentation in [spanner.proto][spanner-proto].
32  *
33  * [spanner-proto]:
34  * https://github.com/googleapis/googleapis/blob/0ed34e9fdf601dfc37eb24c40e17495b86771ff4/google/spanner/v1/spanner.proto#L651
35  */
37  /**
38  * The desired data size for each partition generated.
39  *
40  * The default for this option is currently 1 GiB. This is only a hint. The
41  * actual size of each partition may be smaller or larger than this size
42  * request.
43  */
44  absl::optional<std::int64_t> partition_size_bytes;
45 
46  /**
47  * The desired maximum number of partitions to return.
48  *
49  * For example, this may be set to the number of workers available. The
50  * default for this option is currently 10,000. The maximum value is
51  * currently 200,000. This is only a hint. The actual number of partitions
52  * returned may be smaller or larger than this maximum count request.
53  */
54  absl::optional<std::int64_t> max_partitions;
55 };
56 
57 inline bool operator==(PartitionOptions const& a, PartitionOptions const& b) {
60 }
61 
62 inline bool operator!=(PartitionOptions const& a, PartitionOptions const& b) {
63  return !(a == b);
64 }
65 
67 } // namespace spanner
68 
69 // Internal implementation details that callers should not use.
70 namespace spanner_internal {
72 google::spanner::v1::PartitionOptions ToProto(spanner::PartitionOptions const&);
74 } // namespace spanner_internal
75 } // namespace cloud
76 } // namespace google
77 
78 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_PARTITION_OPTIONS_H