@google-cloud/spanner-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -0
- package/build/protos/google/spanner/admin/database/v1/backup.proto +773 -0
- package/build/protos/google/spanner/admin/database/v1/backup_schedule.proto +230 -0
- package/build/protos/google/spanner/admin/database/v1/common.proto +132 -0
- package/build/protos/google/spanner/admin/database/v1/spanner_database_admin.proto +1314 -0
- package/build/protos/google/spanner/admin/instance/v1/common.proto +64 -0
- package/build/protos/google/spanner/admin/instance/v1/spanner_instance_admin.proto +2184 -0
- package/build/protos/google/spanner/executor/v1/cloud_executor.proto +1610 -0
- package/build/protos/google/spanner/v1/change_stream.proto +451 -0
- package/build/protos/google/spanner/v1/commit_response.proto +80 -0
- package/build/protos/google/spanner/v1/keys.proto +163 -0
- package/build/protos/google/spanner/v1/location.proto +388 -0
- package/build/protos/google/spanner/v1/mutation.proto +156 -0
- package/build/protos/google/spanner/v1/query_plan.proto +156 -0
- package/build/protos/google/spanner/v1/result_set.proto +260 -0
- package/build/protos/google/spanner/v1/spanner.proto +1472 -0
- package/build/protos/google/spanner/v1/transaction.proto +329 -0
- package/build/protos/google/spanner/v1/type.proto +214 -0
- package/build/protos/protos.d.ts +42547 -0
- package/build/protos/protos.js +1 -0
- package/build/protos/protos.json +1 -0
- package/build/src/index.d.ts +20 -0
- package/build/src/index.js +34 -0
- package/build/src/index.js.map +1 -0
- package/build/src/v1/database_admin_client.d.ts +2433 -0
- package/build/src/v1/database_admin_client.js +2938 -0
- package/build/src/v1/database_admin_client.js.map +1 -0
- package/build/src/v1/database_admin_client_config.json +169 -0
- package/build/src/v1/database_admin_proto_list.json +6 -0
- package/build/src/v1/gapic_metadata.json +253 -0
- package/build/src/v1/index.d.ts +4 -0
- package/build/src/v1/index.js +29 -0
- package/build/src/v1/index.js.map +1 -0
- package/build/src/v1/instance_admin_client.d.ts +2162 -0
- package/build/src/v1/instance_admin_client.js +2411 -0
- package/build/src/v1/instance_admin_client.js.map +1 -0
- package/build/src/v1/instance_admin_client_config.json +129 -0
- package/build/src/v1/instance_admin_proto_list.json +4 -0
- package/build/src/v1/spanner_client.d.ts +1353 -0
- package/build/src/v1/spanner_client.js +1456 -0
- package/build/src/v1/spanner_client.js.map +1 -0
- package/build/src/v1/spanner_client_config.json +123 -0
- package/build/src/v1/spanner_executor_proxy_client.d.ts +419 -0
- package/build/src/v1/spanner_executor_proxy_client.js +730 -0
- package/build/src/v1/spanner_executor_proxy_client.js.map +1 -0
- package/build/src/v1/spanner_executor_proxy_client_config.json +30 -0
- package/build/src/v1/spanner_executor_proxy_proto_list.json +15 -0
- package/build/src/v1/spanner_proto_list.json +12 -0
- package/package.json +65 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Copyright 2026 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
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/protobuf/struct.proto";
|
|
20
|
+
|
|
21
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
22
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_outer_classname = "KeysProto";
|
|
25
|
+
option java_package = "com.google.spanner.v1";
|
|
26
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
27
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
28
|
+
|
|
29
|
+
// KeyRange represents a range of rows in a table or index.
|
|
30
|
+
//
|
|
31
|
+
// A range has a start key and an end key. These keys can be open or
|
|
32
|
+
// closed, indicating if the range includes rows with that key.
|
|
33
|
+
//
|
|
34
|
+
// Keys are represented by lists, where the ith value in the list
|
|
35
|
+
// corresponds to the ith component of the table or index primary key.
|
|
36
|
+
// Individual values are encoded as described
|
|
37
|
+
// [here][google.spanner.v1.TypeCode].
|
|
38
|
+
//
|
|
39
|
+
// For example, consider the following table definition:
|
|
40
|
+
//
|
|
41
|
+
// CREATE TABLE UserEvents (
|
|
42
|
+
// UserName STRING(MAX),
|
|
43
|
+
// EventDate STRING(10)
|
|
44
|
+
// ) PRIMARY KEY(UserName, EventDate);
|
|
45
|
+
//
|
|
46
|
+
// The following keys name rows in this table:
|
|
47
|
+
//
|
|
48
|
+
// ["Bob", "2014-09-23"]
|
|
49
|
+
// ["Alfred", "2015-06-12"]
|
|
50
|
+
//
|
|
51
|
+
// Since the `UserEvents` table's `PRIMARY KEY` clause names two
|
|
52
|
+
// columns, each `UserEvents` key has two elements; the first is the
|
|
53
|
+
// `UserName`, and the second is the `EventDate`.
|
|
54
|
+
//
|
|
55
|
+
// Key ranges with multiple components are interpreted
|
|
56
|
+
// lexicographically by component using the table or index key's declared
|
|
57
|
+
// sort order. For example, the following range returns all events for
|
|
58
|
+
// user `"Bob"` that occurred in the year 2015:
|
|
59
|
+
//
|
|
60
|
+
// "start_closed": ["Bob", "2015-01-01"]
|
|
61
|
+
// "end_closed": ["Bob", "2015-12-31"]
|
|
62
|
+
//
|
|
63
|
+
// Start and end keys can omit trailing key components. This affects the
|
|
64
|
+
// inclusion and exclusion of rows that exactly match the provided key
|
|
65
|
+
// components: if the key is closed, then rows that exactly match the
|
|
66
|
+
// provided components are included; if the key is open, then rows
|
|
67
|
+
// that exactly match are not included.
|
|
68
|
+
//
|
|
69
|
+
// For example, the following range includes all events for `"Bob"` that
|
|
70
|
+
// occurred during and after the year 2000:
|
|
71
|
+
//
|
|
72
|
+
// "start_closed": ["Bob", "2000-01-01"]
|
|
73
|
+
// "end_closed": ["Bob"]
|
|
74
|
+
//
|
|
75
|
+
// The next example retrieves all events for `"Bob"`:
|
|
76
|
+
//
|
|
77
|
+
// "start_closed": ["Bob"]
|
|
78
|
+
// "end_closed": ["Bob"]
|
|
79
|
+
//
|
|
80
|
+
// To retrieve events before the year 2000:
|
|
81
|
+
//
|
|
82
|
+
// "start_closed": ["Bob"]
|
|
83
|
+
// "end_open": ["Bob", "2000-01-01"]
|
|
84
|
+
//
|
|
85
|
+
// The following range includes all rows in the table:
|
|
86
|
+
//
|
|
87
|
+
// "start_closed": []
|
|
88
|
+
// "end_closed": []
|
|
89
|
+
//
|
|
90
|
+
// This range returns all users whose `UserName` begins with any
|
|
91
|
+
// character from A to C:
|
|
92
|
+
//
|
|
93
|
+
// "start_closed": ["A"]
|
|
94
|
+
// "end_open": ["D"]
|
|
95
|
+
//
|
|
96
|
+
// This range returns all users whose `UserName` begins with B:
|
|
97
|
+
//
|
|
98
|
+
// "start_closed": ["B"]
|
|
99
|
+
// "end_open": ["C"]
|
|
100
|
+
//
|
|
101
|
+
// Key ranges honor column sort order. For example, suppose a table is
|
|
102
|
+
// defined as follows:
|
|
103
|
+
//
|
|
104
|
+
// CREATE TABLE DescendingSortedTable {
|
|
105
|
+
// Key INT64,
|
|
106
|
+
// ...
|
|
107
|
+
// ) PRIMARY KEY(Key DESC);
|
|
108
|
+
//
|
|
109
|
+
// The following range retrieves all rows with key values between 1
|
|
110
|
+
// and 100 inclusive:
|
|
111
|
+
//
|
|
112
|
+
// "start_closed": ["100"]
|
|
113
|
+
// "end_closed": ["1"]
|
|
114
|
+
//
|
|
115
|
+
// Note that 100 is passed as the start, and 1 is passed as the end,
|
|
116
|
+
// because `Key` is a descending column in the schema.
|
|
117
|
+
message KeyRange {
|
|
118
|
+
// The start key must be provided. It can be either closed or open.
|
|
119
|
+
oneof start_key_type {
|
|
120
|
+
// If the start is closed, then the range includes all rows whose
|
|
121
|
+
// first `len(start_closed)` key columns exactly match `start_closed`.
|
|
122
|
+
google.protobuf.ListValue start_closed = 1;
|
|
123
|
+
|
|
124
|
+
// If the start is open, then the range excludes rows whose first
|
|
125
|
+
// `len(start_open)` key columns exactly match `start_open`.
|
|
126
|
+
google.protobuf.ListValue start_open = 2;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// The end key must be provided. It can be either closed or open.
|
|
130
|
+
oneof end_key_type {
|
|
131
|
+
// If the end is closed, then the range includes all rows whose
|
|
132
|
+
// first `len(end_closed)` key columns exactly match `end_closed`.
|
|
133
|
+
google.protobuf.ListValue end_closed = 3;
|
|
134
|
+
|
|
135
|
+
// If the end is open, then the range excludes rows whose first
|
|
136
|
+
// `len(end_open)` key columns exactly match `end_open`.
|
|
137
|
+
google.protobuf.ListValue end_open = 4;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// `KeySet` defines a collection of Cloud Spanner keys and/or key ranges. All
|
|
142
|
+
// the keys are expected to be in the same table or index. The keys need
|
|
143
|
+
// not be sorted in any particular way.
|
|
144
|
+
//
|
|
145
|
+
// If the same key is specified multiple times in the set (for example
|
|
146
|
+
// if two ranges, two keys, or a key and a range overlap), Cloud Spanner
|
|
147
|
+
// behaves as if the key were only specified once.
|
|
148
|
+
message KeySet {
|
|
149
|
+
// A list of specific keys. Entries in `keys` should have exactly as
|
|
150
|
+
// many elements as there are columns in the primary or index key
|
|
151
|
+
// with which this `KeySet` is used. Individual key values are
|
|
152
|
+
// encoded as described [here][google.spanner.v1.TypeCode].
|
|
153
|
+
repeated google.protobuf.ListValue keys = 1;
|
|
154
|
+
|
|
155
|
+
// A list of key ranges. See [KeyRange][google.spanner.v1.KeyRange] for more
|
|
156
|
+
// information about key range specifications.
|
|
157
|
+
repeated KeyRange ranges = 2;
|
|
158
|
+
|
|
159
|
+
// For convenience `all` can be set to `true` to indicate that this
|
|
160
|
+
// `KeySet` matches all keys in the table or index. Note that any keys
|
|
161
|
+
// specified in `keys` or `ranges` are only yielded once.
|
|
162
|
+
bool all = 3;
|
|
163
|
+
}
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
// Copyright 2026 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
|
+
syntax = "proto3";
|
|
16
|
+
|
|
17
|
+
package google.spanner.v1;
|
|
18
|
+
|
|
19
|
+
import "google/protobuf/struct.proto";
|
|
20
|
+
import "google/spanner/v1/type.proto";
|
|
21
|
+
|
|
22
|
+
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
23
|
+
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
24
|
+
option java_multiple_files = true;
|
|
25
|
+
option java_outer_classname = "LocationProto";
|
|
26
|
+
option java_package = "com.google.spanner.v1";
|
|
27
|
+
option php_namespace = "Google\\Cloud\\Spanner\\V1";
|
|
28
|
+
option ruby_package = "Google::Cloud::Spanner::V1";
|
|
29
|
+
|
|
30
|
+
// A `Range` represents a range of keys in a database. The keys themselves
|
|
31
|
+
// are encoded in "sortable string format", also known as ssformat. Consult
|
|
32
|
+
// Spanner's open source client libraries for details on the encoding.
|
|
33
|
+
//
|
|
34
|
+
// Each range represents a contiguous range of rows, possibly from multiple
|
|
35
|
+
// tables/indexes. Each range is associated with a single paxos group (known as
|
|
36
|
+
// a "group" throughout this API), a split (which names the exact range within
|
|
37
|
+
// the group), and a generation that can be used to determine whether a given
|
|
38
|
+
// `Range` represents a newer or older location for the key range.
|
|
39
|
+
message Range {
|
|
40
|
+
// The start key of the range, inclusive. Encoded in "sortable string format"
|
|
41
|
+
// (ssformat).
|
|
42
|
+
bytes start_key = 1;
|
|
43
|
+
|
|
44
|
+
// The limit key of the range, exclusive. Encoded in "sortable string format"
|
|
45
|
+
// (ssformat).
|
|
46
|
+
bytes limit_key = 2;
|
|
47
|
+
|
|
48
|
+
// The UID of the paxos group where this range is stored. UIDs are unique
|
|
49
|
+
// within the database. References `Group.group_uid`.
|
|
50
|
+
uint64 group_uid = 3;
|
|
51
|
+
|
|
52
|
+
// A group can store multiple ranges of keys. Each key range is named by an
|
|
53
|
+
// ID (the split ID). Within a group, split IDs are unique. The `split_id`
|
|
54
|
+
// names the exact split in `group_uid` where this range is stored.
|
|
55
|
+
uint64 split_id = 4;
|
|
56
|
+
|
|
57
|
+
// `generation` indicates the freshness of the range information contained
|
|
58
|
+
// in this proto. Generations can be compared lexicographically; if generation
|
|
59
|
+
// A is greater than generation B, then the `Range` corresponding to A is
|
|
60
|
+
// newer than the `Range` corresponding to B, and should be used
|
|
61
|
+
// preferentially.
|
|
62
|
+
bytes generation = 5;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// A `Tablet` represents a single replica of a `Group`. A tablet is served by a
|
|
66
|
+
// single server at a time, and can move between servers due to server death or
|
|
67
|
+
// simply load balancing.
|
|
68
|
+
message Tablet {
|
|
69
|
+
// Indicates the role of the tablet.
|
|
70
|
+
enum Role {
|
|
71
|
+
// Not specified.
|
|
72
|
+
ROLE_UNSPECIFIED = 0;
|
|
73
|
+
|
|
74
|
+
// The tablet can perform reads and (if elected leader) writes.
|
|
75
|
+
READ_WRITE = 1;
|
|
76
|
+
|
|
77
|
+
// The tablet can only perform reads.
|
|
78
|
+
READ_ONLY = 2;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The UID of the tablet, unique within the database. Matches the
|
|
82
|
+
// `tablet_uids` and `leader_tablet_uid` fields in `Group`.
|
|
83
|
+
uint64 tablet_uid = 1;
|
|
84
|
+
|
|
85
|
+
// The address of the server that is serving this tablet -- either an IP
|
|
86
|
+
// address or DNS hostname and a port number.
|
|
87
|
+
string server_address = 2;
|
|
88
|
+
|
|
89
|
+
// Where this tablet is located. This is the name of a Google Cloud region,
|
|
90
|
+
// such as "us-central1".
|
|
91
|
+
string location = 3;
|
|
92
|
+
|
|
93
|
+
// The role of the tablet.
|
|
94
|
+
Role role = 4;
|
|
95
|
+
|
|
96
|
+
// `incarnation` indicates the freshness of the tablet information contained
|
|
97
|
+
// in this proto. Incarnations can be compared lexicographically; if
|
|
98
|
+
// incarnation A is greater than incarnation B, then the `Tablet`
|
|
99
|
+
// corresponding to A is newer than the `Tablet` corresponding to B, and
|
|
100
|
+
// should be used preferentially.
|
|
101
|
+
bytes incarnation = 5;
|
|
102
|
+
|
|
103
|
+
// Distances help the client pick the closest tablet out of the list of
|
|
104
|
+
// tablets for a given request. Tablets with lower distances should generally
|
|
105
|
+
// be preferred. Tablets with the same distance are approximately equally
|
|
106
|
+
// close; the client can choose arbitrarily.
|
|
107
|
+
//
|
|
108
|
+
// Distances do not correspond precisely to expected latency, geographical
|
|
109
|
+
// distance, or anything else. Distances should be compared only between
|
|
110
|
+
// tablets of the same group; they are not meaningful between different
|
|
111
|
+
// groups.
|
|
112
|
+
//
|
|
113
|
+
// A value of zero indicates that the tablet may be in the same zone as
|
|
114
|
+
// the client, and have minimum network latency. A value less than or equal to
|
|
115
|
+
// five indicates that the tablet is thought to be in the same region as the
|
|
116
|
+
// client, and may have a few milliseconds of network latency. Values greater
|
|
117
|
+
// than five are most likely in a different region, with non-trivial network
|
|
118
|
+
// latency.
|
|
119
|
+
//
|
|
120
|
+
// Clients should use the following algorithm:
|
|
121
|
+
// * If the request is using a directed read, eliminate any tablets that
|
|
122
|
+
// do not match the directed read's target zone and/or replica type.
|
|
123
|
+
// * (Read-write transactions only) Choose leader tablet if it has an
|
|
124
|
+
// distance <=5.
|
|
125
|
+
// * Group and sort tablets by distance. Choose a random
|
|
126
|
+
// tablet with the lowest distance. If the request
|
|
127
|
+
// is not a directed read, only consider replicas with distances <=5.
|
|
128
|
+
// * Send the request to the fallback endpoint.
|
|
129
|
+
//
|
|
130
|
+
// The tablet picked by this algorithm may be skipped, either because it is
|
|
131
|
+
// marked as `skip` by the server or because the corresponding server is
|
|
132
|
+
// unreachable, flow controlled, etc. Skipped tablets should be added to the
|
|
133
|
+
// `skipped_tablet_uid` field in `RoutingHint`; the algorithm above should
|
|
134
|
+
// then be re-run without including the skipped tablet(s) to pick the next
|
|
135
|
+
// best tablet.
|
|
136
|
+
uint32 distance = 6;
|
|
137
|
+
|
|
138
|
+
// If true, the tablet should not be chosen by the client. Typically, this
|
|
139
|
+
// signals that the tablet is unhealthy in some way. Tablets with `skip`
|
|
140
|
+
// set to true should be reported back to the server in
|
|
141
|
+
// `RoutingHint.skipped_tablet_uid`; this cues the server to send updated
|
|
142
|
+
// information for this tablet should it become usable again.
|
|
143
|
+
bool skip = 7;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// A `Group` represents a paxos group in a database. A group is a set of
|
|
147
|
+
// tablets that are replicated across multiple servers. Groups may have a leader
|
|
148
|
+
// tablet. Groups store one (or sometimes more) ranges of keys.
|
|
149
|
+
message Group {
|
|
150
|
+
// The UID of the paxos group, unique within the database. Matches the
|
|
151
|
+
// `group_uid` field in `Range`.
|
|
152
|
+
uint64 group_uid = 1;
|
|
153
|
+
|
|
154
|
+
// A list of tablets that are part of the group. Note that this list may not
|
|
155
|
+
// be exhaustive; it will only include tablets the server considers useful
|
|
156
|
+
// to the client. The returned list is ordered ascending by distance.
|
|
157
|
+
//
|
|
158
|
+
// Tablet UIDs reference `Tablet.tablet_uid`.
|
|
159
|
+
repeated Tablet tablets = 2;
|
|
160
|
+
|
|
161
|
+
// The last known leader tablet of the group as an index into `tablets`. May
|
|
162
|
+
// be negative if the group has no known leader.
|
|
163
|
+
int32 leader_index = 3;
|
|
164
|
+
|
|
165
|
+
// `generation` indicates the freshness of the group information (including
|
|
166
|
+
// leader information) contained in this proto. Generations can be compared
|
|
167
|
+
// lexicographically; if generation A is greater than generation B, then the
|
|
168
|
+
// `Group` corresponding to A is newer than the `Group` corresponding to B,
|
|
169
|
+
// and should be used preferentially.
|
|
170
|
+
bytes generation = 4;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// A `KeyRecipe` provides the metadata required to translate reads, mutations,
|
|
174
|
+
// and queries into a byte array in "sortable string format" (ssformat)that can
|
|
175
|
+
// be used with `Range`s to route requests. Note that the client *must* tolerate
|
|
176
|
+
// `KeyRecipe`s that appear to be invalid, since the `KeyRecipe` format may
|
|
177
|
+
// change over time. Requests with invalid `KeyRecipe`s should be routed to a
|
|
178
|
+
// default server.
|
|
179
|
+
message KeyRecipe {
|
|
180
|
+
// An ssformat key is composed of a sequence of tag numbers and key column
|
|
181
|
+
// values. `Part` represents a single tag or key column value.
|
|
182
|
+
message Part {
|
|
183
|
+
// The remaining fields encode column values.
|
|
184
|
+
enum Order {
|
|
185
|
+
// Default value, equivalent to `ASCENDING`.
|
|
186
|
+
ORDER_UNSPECIFIED = 0;
|
|
187
|
+
|
|
188
|
+
// The key is ascending - corresponds to `ASC` in the schema definition.
|
|
189
|
+
ASCENDING = 1;
|
|
190
|
+
|
|
191
|
+
// The key is descending - corresponds to `DESC` in the schema definition.
|
|
192
|
+
DESCENDING = 2;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// The null order of the key column. This dictates where NULL values sort
|
|
196
|
+
// in the sorted order. Note that columns which are `NOT NULL` can have a
|
|
197
|
+
// special encoding.
|
|
198
|
+
enum NullOrder {
|
|
199
|
+
// Default value. This value is unused.
|
|
200
|
+
NULL_ORDER_UNSPECIFIED = 0;
|
|
201
|
+
|
|
202
|
+
// NULL values sort before any non-NULL values.
|
|
203
|
+
NULLS_FIRST = 1;
|
|
204
|
+
|
|
205
|
+
// NULL values sort after any non-NULL values.
|
|
206
|
+
NULLS_LAST = 2;
|
|
207
|
+
|
|
208
|
+
// The column does not support NULL values.
|
|
209
|
+
NOT_NULL = 3;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// If non-zero, `tag` is the only field present in this `Part`. The part
|
|
213
|
+
// is encoded by appending `tag` to the ssformat key.
|
|
214
|
+
uint32 tag = 1;
|
|
215
|
+
|
|
216
|
+
// Whether the key column is sorted ascending or descending. Only present
|
|
217
|
+
// if `tag` is zero.
|
|
218
|
+
Order order = 2;
|
|
219
|
+
|
|
220
|
+
// How NULLs are represented in the encoded key part. Only present if `tag`
|
|
221
|
+
// is zero.
|
|
222
|
+
NullOrder null_order = 3;
|
|
223
|
+
|
|
224
|
+
// The type of the key part. Only present if `tag` is zero.
|
|
225
|
+
Type type = 4;
|
|
226
|
+
|
|
227
|
+
// Only present if `tag` is zero.
|
|
228
|
+
oneof value_type {
|
|
229
|
+
// `identifier` is the name of the column or query parameter.
|
|
230
|
+
string identifier = 5;
|
|
231
|
+
|
|
232
|
+
// The constant value of the key part.
|
|
233
|
+
// It is present when query uses a constant as a part of the key.
|
|
234
|
+
google.protobuf.Value value = 6;
|
|
235
|
+
|
|
236
|
+
// If true, the client is responsible to fill in the value randomly.
|
|
237
|
+
// It's relevant only for the INT64 type.
|
|
238
|
+
bool random = 8;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// It is a repeated field to support fetching key columns from nested
|
|
242
|
+
// structs, such as `STRUCT` query parameters.
|
|
243
|
+
repeated int32 struct_identifiers = 7;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// A recipe can be associated with a table, index, or query. Tables recipes
|
|
247
|
+
// are used to encode read and write keys; index recipes are used for index
|
|
248
|
+
// reads, and query recipes are used only for SQL queries.
|
|
249
|
+
oneof target {
|
|
250
|
+
// A table name, matching the name from the database schema.
|
|
251
|
+
string table_name = 1;
|
|
252
|
+
|
|
253
|
+
// An index name, matching the name from the database schema.
|
|
254
|
+
string index_name = 2;
|
|
255
|
+
|
|
256
|
+
// The UID of a query, matching the UID from `RoutingHint`.
|
|
257
|
+
uint64 operation_uid = 3;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Parts are in the order they should appear in the encoded key.
|
|
261
|
+
repeated Part part = 4;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// A `RecipeList` contains a list of `KeyRecipe`s, which share the same
|
|
265
|
+
// schema generation.
|
|
266
|
+
message RecipeList {
|
|
267
|
+
// The schema generation of the recipes. To be sent to the server in
|
|
268
|
+
// `RoutingHint.schema_generation` whenever one of the recipes is used.
|
|
269
|
+
// `schema_generation` values are comparable with each other; if generation A
|
|
270
|
+
// compares greater than generation B, then A is a more recent schema than B.
|
|
271
|
+
// Clients should in general aim to cache only the latest schema generation,
|
|
272
|
+
// and discard more stale recipes.
|
|
273
|
+
bytes schema_generation = 1;
|
|
274
|
+
|
|
275
|
+
// A list of recipes to be cached.
|
|
276
|
+
repeated KeyRecipe recipe = 3;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// A `CacheUpdate` expresses a set of changes the client should incorporate into
|
|
280
|
+
// its location cache. These changes may or may not be newer than what the
|
|
281
|
+
// client has in its cache, and should be discarded if necessary. `CacheUpdate`s
|
|
282
|
+
// can be obtained in response to requests that included a `RoutingHint`
|
|
283
|
+
// field, but may also be obtained by explicit location-fetching RPCs which may
|
|
284
|
+
// be added in the future.
|
|
285
|
+
message CacheUpdate {
|
|
286
|
+
// An internal ID for the database. Database names can be reused if a database
|
|
287
|
+
// is deleted and re-created. Each time the database is re-created, it will
|
|
288
|
+
// get a new database ID, which will never be re-used for any other database.
|
|
289
|
+
uint64 database_id = 1;
|
|
290
|
+
|
|
291
|
+
// A list of ranges to be cached.
|
|
292
|
+
repeated Range range = 2;
|
|
293
|
+
|
|
294
|
+
// A list of groups to be cached.
|
|
295
|
+
repeated Group group = 3;
|
|
296
|
+
|
|
297
|
+
// A list of recipes to be cached.
|
|
298
|
+
RecipeList key_recipes = 5;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// `RoutingHint` can be optionally added to location-aware Spanner
|
|
302
|
+
// requests. It gives the server hints that can be used to route the request to
|
|
303
|
+
// an appropriate server, potentially significantly decreasing latency and
|
|
304
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
305
|
+
// filled in with accurate values.
|
|
306
|
+
//
|
|
307
|
+
// The presence of a valid `RoutingHint` tells the server that the client
|
|
308
|
+
// is location-aware.
|
|
309
|
+
//
|
|
310
|
+
// `RoutingHint` does not change the semantics of the request; it is
|
|
311
|
+
// purely a performance hint; the request will perform the same actions on the
|
|
312
|
+
// database's data as if `RoutingHint` were not present. However, if
|
|
313
|
+
// the `RoutingHint` is incomplete or incorrect, the response may include
|
|
314
|
+
// a `CacheUpdate` the client can use to correct its location cache.
|
|
315
|
+
message RoutingHint {
|
|
316
|
+
// A tablet that was skipped by the client. See `Tablet.tablet_uid` and
|
|
317
|
+
// `Tablet.incarnation`.
|
|
318
|
+
message SkippedTablet {
|
|
319
|
+
// The tablet UID of the tablet that was skipped. See `Tablet.tablet_uid`.
|
|
320
|
+
uint64 tablet_uid = 1;
|
|
321
|
+
|
|
322
|
+
// The incarnation of the tablet that was skipped. See `Tablet.incarnation`.
|
|
323
|
+
bytes incarnation = 2;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// A session-scoped unique ID for the operation, computed client-side.
|
|
327
|
+
// Requests with the same `operation_uid` should have a shared 'shape',
|
|
328
|
+
// meaning that some fields are expected to be the same, such as the SQL
|
|
329
|
+
// query, the target table/columns (for reads) etc. Requests with the same
|
|
330
|
+
// `operation_uid` are meant to differ only in fields like keys/key
|
|
331
|
+
// ranges/query parameters, transaction IDs, etc.
|
|
332
|
+
//
|
|
333
|
+
// `operation_uid` must be non-zero for `RoutingHint` to be valid.
|
|
334
|
+
uint64 operation_uid = 1;
|
|
335
|
+
|
|
336
|
+
// The database ID of the database being accessed, see
|
|
337
|
+
// `CacheUpdate.database_id`. Should match the cache entries that were used
|
|
338
|
+
// to generate the rest of the fields in this `RoutingHint`.
|
|
339
|
+
uint64 database_id = 2;
|
|
340
|
+
|
|
341
|
+
// The schema generation of the recipe that was used to generate `key` and
|
|
342
|
+
// `limit_key`. See also `RecipeList.schema_generation`.
|
|
343
|
+
bytes schema_generation = 3;
|
|
344
|
+
|
|
345
|
+
// The key / key range that this request accesses. For operations that
|
|
346
|
+
// access a single key, `key` should be set and `limit_key` should be empty.
|
|
347
|
+
// For operations that access a key range, `key` and `limit_key` should both
|
|
348
|
+
// be set, to the inclusive start and exclusive end of the range respectively.
|
|
349
|
+
//
|
|
350
|
+
// The keys are encoded in "sortable string format" (ssformat), using a
|
|
351
|
+
// `KeyRecipe` that is appropriate for the request. See `KeyRecipe` for more
|
|
352
|
+
// details.
|
|
353
|
+
bytes key = 4;
|
|
354
|
+
|
|
355
|
+
// If this request targets a key range, this is the exclusive end of the
|
|
356
|
+
// range. See `key` for more details.
|
|
357
|
+
bytes limit_key = 5;
|
|
358
|
+
|
|
359
|
+
// The group UID of the group that the client believes serves the range
|
|
360
|
+
// defined by `key` and `limit_key`. See `Range.group_uid` for more details.
|
|
361
|
+
uint64 group_uid = 6;
|
|
362
|
+
|
|
363
|
+
// The split ID of the split that the client believes contains the range
|
|
364
|
+
// defined by `key` and `limit_key`. See `Range.split_id` for more details.
|
|
365
|
+
uint64 split_id = 7;
|
|
366
|
+
|
|
367
|
+
// The tablet UID of the tablet from group `group_uid` that the client
|
|
368
|
+
// believes is best to serve this request. See `Group.local_tablet_uids` and
|
|
369
|
+
// `Group.leader_tablet_uid`.
|
|
370
|
+
uint64 tablet_uid = 8;
|
|
371
|
+
|
|
372
|
+
// If the client had multiple options for tablet selection, and some of its
|
|
373
|
+
// first choices were unhealthy (e.g., the server is unreachable, or
|
|
374
|
+
// `Tablet.skip` is true), this field will contain the tablet UIDs of those
|
|
375
|
+
// tablets, with their incarnations. The server may include a `CacheUpdate`
|
|
376
|
+
// with new locations for those tablets.
|
|
377
|
+
repeated SkippedTablet skipped_tablet_uid = 9;
|
|
378
|
+
|
|
379
|
+
// If present, the client's current location. This should be the name of a
|
|
380
|
+
// Google Cloud zone or region, such as "us-central1".
|
|
381
|
+
//
|
|
382
|
+
// If absent, the client's location will be assumed to be the same as the
|
|
383
|
+
// location of the server the client ends up connected to.
|
|
384
|
+
//
|
|
385
|
+
// Locations are primarily valuable for clients that connect from regions
|
|
386
|
+
// other than the ones that contain the Spanner database.
|
|
387
|
+
string client_location = 10;
|
|
388
|
+
}
|