15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_QUERY_PARTITION_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_QUERY_PARTITION_H
18#include "google/cloud/spanner/connection.h"
19#include "google/cloud/spanner/sql_statement.h"
20#include "google/cloud/spanner/version.h"
21#include "google/cloud/status_or.h"
27namespace spanner_internal {
28GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
29class QueryPartitionTester;
30struct QueryPartitionInternals;
31GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
35GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
77 std::string
const& serialized_query_partition);
80
81
82
83
84
85
86
87
88
92
93
94
106
107
119 friend class spanner_internal::QueryPartitionTester;
120 friend struct spanner_internal::QueryPartitionInternals;
124 std::string
const& serialized_query_partition);
126 QueryPartition(std::string transaction_id,
bool route_to_leader,
127 std::string transaction_tag, std::string session_id,
128 std::string partition_token,
bool data_boost,
132 std::string
const& transaction_id()
const {
return transaction_id_; }
133 bool route_to_leader()
const {
return route_to_leader_; }
134 std::string
const& transaction_tag()
const {
return transaction_tag_; }
135 std::string
const& session_id()
const {
return session_id_; }
136 std::string
const& partition_token()
const {
return partition_token_; }
137 bool data_boost()
const {
return data_boost_; }
139 std::string transaction_id_;
140 bool route_to_leader_;
141 std::string transaction_tag_;
142 std::string session_id_;
143 std::string partition_token_;
148GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
152namespace spanner_internal {
153GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
155struct QueryPartitionInternals {
157 std::string
const& transaction_id,
bool route_to_leader,
158 std::string
const& transaction_tag, std::string
const& session_id,
159 std::string
const& partition_token,
bool data_boost,
162 transaction_tag, session_id, partition_token,
163 data_boost, sql_statement);
169 return {MakeTransactionFromIds(query_partition.session_id(),
170 query_partition.transaction_id(),
171 query_partition.route_to_leader(),
172 query_partition.transaction_tag()),
174 query_partition.partition_token(), query_partition.data_boost()};
179 std::string
const& transaction_id,
bool route_to_leader,
180 std::string
const& transaction_tag, std::string
const& session_id,
181 std::string
const& partition_token,
bool data_boost,
183 return QueryPartitionInternals::MakeQueryPartition(
184 transaction_id, route_to_leader, transaction_tag, session_id,
185 partition_token, data_boost, sql_statement);
191 return QueryPartitionInternals::MakeSqlParams(query_partition, query_options);
194GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
A connection to a Spanner database instance.
Definition: connection.h:59
These QueryOptions allow users to configure features about how their SQL queries executes on the serv...
Definition: query_options.h:37
The QueryPartition class is a regular type that represents a single slice of a parallel SQL read.
Definition: query_partition.h:89
QueryPartition & operator=(QueryPartition const &)=default
friend bool operator!=(QueryPartition const &a, QueryPartition const &b)
Definition: query_partition.h:113
QueryPartition(QueryPartition const &)=default
SqlStatement const & sql_statement() const
Accessor for the SqlStatement associated with this QueryPartition.
Definition: query_partition.h:108
QueryPartition & operator=(QueryPartition &&)=default
QueryPartition(QueryPartition &&)=default
friend bool operator==(QueryPartition const &a, QueryPartition const &b)
QueryPartition()=default
Constructs an instance of QueryPartition that is not associated with any SqlStatement.
Represents a potentially parameterized SQL statement.
Definition: sql_statement.h:51
Contains all the Cloud Spanner C++ client types and functions.
Definition: backoff_policy.h:23
StatusOr< QueryPartition > DeserializeQueryPartition(std::string const &serialized_query_partition)
Deserializes the provided string into a QueryPartition.
StatusOr< std::string > SerializeQueryPartition(QueryPartition const &query_partition)
Serializes an instance of QueryPartition to a string of bytes.
Wrap the arguments to ExecuteQuery(), ExecuteDml(), ProfileQuery(), ProfileDml(), and AnalyzeSql().
Definition: connection.h:92