mutation.proto 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2018 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. import "google/firestore/v1/write.proto";
  16. import "google/protobuf/timestamp.proto";
  17. package firestore.client;
  18. option java_multiple_files = true;
  19. option java_package = "com.google.firebase.firestore.proto";
  20. option objc_class_prefix = "FSTPB";
  21. // Each user gets a single queue of WriteBatches to apply to the server.
  22. // MutationQueue tracks the metadata about the queue.
  23. message MutationQueue {
  24. // An identifier for the highest numbered batch that has been acknowledged by
  25. // the server. All WriteBatches in this queue with batch_ids less than or
  26. // equal to this value are considered to have been acknowledged by the
  27. // server.
  28. int32 last_acknowledged_batch_id = 1;
  29. // A stream token that was previously sent by the server.
  30. //
  31. // See StreamingWriteRequest in datastore.proto for more details about usage.
  32. //
  33. // After sending this token, earlier tokens may not be used anymore so only a
  34. // single stream token is retained.
  35. bytes last_stream_token = 2;
  36. }
  37. // Message containing a batch of user-level writes intended to be sent to
  38. // the server in a single call. Each user-level batch gets a separate
  39. // WriteBatch with a new batch_id.
  40. message WriteBatch {
  41. // An identifier for this batch, allocated by the mutation queue in a
  42. // monotonically increasing manner.
  43. int32 batch_id = 1;
  44. // A list of writes to apply. All writes will be applied atomically.
  45. repeated google.firestore.v1.Write writes = 2;
  46. // The local time at which the write batch was initiated.
  47. google.protobuf.Timestamp local_write_time = 3;
  48. // A list of pseudo-writes that represent a partial base state from when this
  49. // write batch was initially created. When computing the local view batch,
  50. // these base_writes are applied prior to the real writes in order to
  51. // override certain document fields from the remote document cache. This is
  52. // necessary in the case of non-idempotent writes (e.g. numericAdd
  53. // transforms) to make sure that the local view of the modified documents
  54. // doesn't flicker if the remote document cache receives the result of the
  55. // non-idempotent write before the write is removed from the queue.
  56. //
  57. // These writes are never sent to the backend.
  58. repeated google.firestore.v1.Write base_writes = 4;
  59. }