1// Copyright 2023 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 15syntax = "proto3"; 16 17package google.datastore.admin.v1; 18 19option csharp_namespace = "Google.Cloud.Datastore.Admin.V1"; 20option go_package = "cloud.google.com/go/datastore/admin/apiv1/adminpb;adminpb"; 21option java_multiple_files = true; 22option java_outer_classname = "MigrationProto"; 23option java_package = "com.google.datastore.admin.v1"; 24option php_namespace = "Google\\Cloud\\Datastore\\Admin\\V1"; 25option ruby_package = "Google::Cloud::Datastore::Admin::V1"; 26 27// An event signifying a change in state of a [migration from Cloud Datastore to 28// Cloud Firestore in Datastore 29// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore). 30message MigrationStateEvent { 31 // The new state of the migration. 32 MigrationState state = 1; 33} 34 35// An event signifying the start of a new step in a [migration from Cloud 36// Datastore to Cloud Firestore in Datastore 37// mode](https://cloud.google.com/datastore/docs/upgrade-to-firestore). 38message MigrationProgressEvent { 39 // Concurrency modes for transactions in Cloud Firestore. 40 enum ConcurrencyMode { 41 // Unspecified. 42 CONCURRENCY_MODE_UNSPECIFIED = 0; 43 44 // Pessimistic concurrency. 45 PESSIMISTIC = 1; 46 47 // Optimistic concurrency. 48 OPTIMISTIC = 2; 49 50 // Optimistic concurrency with entity groups. 51 OPTIMISTIC_WITH_ENTITY_GROUPS = 3; 52 } 53 54 // Details for the `PREPARE` step. 55 message PrepareStepDetails { 56 // The concurrency mode this database will use when it reaches the 57 // `REDIRECT_WRITES` step. 58 ConcurrencyMode concurrency_mode = 1; 59 } 60 61 // Details for the `REDIRECT_WRITES` step. 62 message RedirectWritesStepDetails { 63 // Ths concurrency mode for this database. 64 ConcurrencyMode concurrency_mode = 1; 65 } 66 67 // The step that is starting. 68 // 69 // An event with step set to `START` indicates that the migration 70 // has been reverted back to the initial pre-migration state. 71 MigrationStep step = 1; 72 73 // Details about this step. 74 oneof step_details { 75 // Details for the `PREPARE` step. 76 PrepareStepDetails prepare_step_details = 2; 77 78 // Details for the `REDIRECT_WRITES` step. 79 RedirectWritesStepDetails redirect_writes_step_details = 3; 80 } 81} 82 83// States for a migration. 84enum MigrationState { 85 // Unspecified. 86 MIGRATION_STATE_UNSPECIFIED = 0; 87 88 // The migration is running. 89 RUNNING = 1; 90 91 // The migration is paused. 92 PAUSED = 2; 93 94 // The migration is complete. 95 COMPLETE = 3; 96} 97 98// Steps in a migration. 99enum MigrationStep { 100 // Unspecified. 101 MIGRATION_STEP_UNSPECIFIED = 0; 102 103 // Pre-migration: the database is prepared for migration. 104 PREPARE = 6; 105 106 // Start of migration. 107 START = 1; 108 109 // Writes are applied synchronously to at least one replica. 110 APPLY_WRITES_SYNCHRONOUSLY = 7; 111 112 // Data is copied to Cloud Firestore and then verified to match the data in 113 // Cloud Datastore. 114 COPY_AND_VERIFY = 2; 115 116 // Eventually-consistent reads are redirected to Cloud Firestore. 117 REDIRECT_EVENTUALLY_CONSISTENT_READS = 3; 118 119 // Strongly-consistent reads are redirected to Cloud Firestore. 120 REDIRECT_STRONGLY_CONSISTENT_READS = 4; 121 122 // Writes are redirected to Cloud Firestore. 123 REDIRECT_WRITES = 5; 124} 125