Skip to content

Commit d57f2c1

Browse files
Google APIscopybara-github
authored andcommitted
feat: add AddSplitPoints API
PiperOrigin-RevId: 721248606
1 parent 2e899ee commit d57f2c1

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

google/spanner/admin/database/v1/BUILD.bazel

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
# * extra_protoc_file_parameters
1010
# The complete list of preserved parameters can be found in the source code.
1111

12-
##############################################################################
13-
# Common
14-
##############################################################################
15-
load("@rules_proto//proto:defs.bzl", "proto_library")
1612
load(
1713
"@com_google_googleapis_imports//:imports.bzl",
1814
"cc_grpc_library",
@@ -44,6 +40,11 @@ load(
4440
"ruby_proto_library",
4541
)
4642

43+
##############################################################################
44+
# Common
45+
##############################################################################
46+
load("@rules_proto//proto:defs.bzl", "proto_library")
47+
4748
# This is an API workspace, having public visibility by default makes perfect sense.
4849
package(default_visibility = ["//visibility:public"])
4950

@@ -67,6 +68,7 @@ proto_library(
6768
"@com_google_protobuf//:duration_proto",
6869
"@com_google_protobuf//:empty_proto",
6970
"@com_google_protobuf//:field_mask_proto",
71+
"@com_google_protobuf//:struct_proto",
7072
"@com_google_protobuf//:timestamp_proto",
7173
],
7274
)

google/spanner/admin/database/v1/spanner_admin_database_grpc_service_config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@
7373
{
7474
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
7575
"method": "ListBackupSchedules"
76+
},
77+
{
78+
"service": "google.spanner.admin.database.v1.DatabaseAdmin",
79+
"method": "AddSplitPoints"
7680
}
7781
],
7882
"timeout": "3600s",

google/spanner/admin/database/v1/spanner_database_admin.proto

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import "google/iam/v1/policy.proto";
2525
import "google/longrunning/operations.proto";
2626
import "google/protobuf/empty.proto";
2727
import "google/protobuf/field_mask.proto";
28+
import "google/protobuf/struct.proto";
2829
import "google/protobuf/timestamp.proto";
2930
import "google/spanner/admin/database/v1/backup.proto";
3031
import "google/spanner/admin/database/v1/backup_schedule.proto";
@@ -425,6 +426,15 @@ service DatabaseAdmin {
425426
option (google.api.method_signature) = "parent";
426427
}
427428

429+
// Adds split points to specified tables, indexes of a database.
430+
rpc AddSplitPoints(AddSplitPointsRequest) returns (AddSplitPointsResponse) {
431+
option (google.api.http) = {
432+
post: "/v1/{database=projects/*/instances/*/databases/*}:addSplitPoints"
433+
body: "*"
434+
};
435+
option (google.api.method_signature) = "database,split_points";
436+
}
437+
428438
// Creates a new backup schedule.
429439
rpc CreateBackupSchedule(CreateBackupScheduleRequest)
430440
returns (BackupSchedule) {
@@ -1207,3 +1217,59 @@ message ListDatabaseRolesResponse {
12071217
// call to fetch more of the matching roles.
12081218
string next_page_token = 2;
12091219
}
1220+
1221+
// The request for
1222+
// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1223+
message AddSplitPointsRequest {
1224+
// Required. The database on whose tables/indexes split points are to be
1225+
// added. Values are of the form
1226+
// `projects/<project>/instances/<instance>/databases/<database>`.
1227+
string database = 1 [
1228+
(google.api.field_behavior) = REQUIRED,
1229+
(google.api.resource_reference) = {
1230+
type: "spanner.googleapis.com/Database"
1231+
}
1232+
];
1233+
1234+
// Required. The split points to add.
1235+
repeated SplitPoints split_points = 2
1236+
[(google.api.field_behavior) = REQUIRED];
1237+
1238+
// Optional. A user-supplied tag associated with the split points.
1239+
// For example, "intital_data_load", "special_event_1".
1240+
// Defaults to "CloudAddSplitPointsAPI" if not specified.
1241+
// The length of the tag must not exceed 50 characters,else will be trimmed.
1242+
// Only valid UTF8 characters are allowed.
1243+
string initiator = 3 [(google.api.field_behavior) = OPTIONAL];
1244+
}
1245+
1246+
// The response for
1247+
// [AddSplitPoints][google.spanner.admin.database.v1.DatabaseAdmin.AddSplitPoints].
1248+
message AddSplitPointsResponse {}
1249+
1250+
// The split points of a table/index.
1251+
message SplitPoints {
1252+
// A split key.
1253+
message Key {
1254+
// Required. The column values making up the split key.
1255+
google.protobuf.ListValue key_parts = 1
1256+
[(google.api.field_behavior) = REQUIRED];
1257+
}
1258+
1259+
// The table to split.
1260+
string table = 1;
1261+
1262+
// The index to split.
1263+
// If specified, the `table` field must refer to the index's base table.
1264+
string index = 2;
1265+
1266+
// Required. The list of split keys, i.e., the split boundaries.
1267+
repeated Key keys = 3 [(google.api.field_behavior) = REQUIRED];
1268+
1269+
// Optional. The expiration timestamp of the split points.
1270+
// A timestamp in the past means immediate expiration.
1271+
// The maximum value can be 30 days in the future.
1272+
// Defaults to 10 days in the future if not specified.
1273+
google.protobuf.Timestamp expire_time = 5
1274+
[(google.api.field_behavior) = OPTIONAL];
1275+
}

0 commit comments

Comments
 (0)