migration.proto 3.6 KB

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