kv.proto 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. syntax = "proto3";
  2. package mvccpb;
  3. import "gogoproto/gogo.proto";
  4. option (gogoproto.marshaler_all) = true;
  5. option (gogoproto.sizer_all) = true;
  6. option (gogoproto.unmarshaler_all) = true;
  7. option (gogoproto.goproto_getters_all) = false;
  8. option (gogoproto.goproto_enum_prefix_all) = false;
  9. message KeyValue {
  10. // key is the key in bytes. An empty key is not allowed.
  11. bytes key = 1;
  12. // create_revision is the revision of last creation on this key.
  13. int64 create_revision = 2;
  14. // mod_revision is the revision of last modification on this key.
  15. int64 mod_revision = 3;
  16. // version is the version of the key. A deletion resets
  17. // the version to zero and any modification of the key
  18. // increases its version.
  19. int64 version = 4;
  20. // value is the value held by the key, in bytes.
  21. bytes value = 5;
  22. // lease is the ID of the lease that attached to key.
  23. // When the attached lease expires, the key will be deleted.
  24. // If lease is 0, then no lease is attached to the key.
  25. int64 lease = 6;
  26. }
  27. message Event {
  28. enum EventType {
  29. PUT = 0;
  30. DELETE = 1;
  31. }
  32. // type is the kind of event. If type is a PUT, it indicates
  33. // new data has been stored to the key. If type is a DELETE,
  34. // it indicates the key was deleted.
  35. EventType type = 1;
  36. // kv holds the KeyValue for the event.
  37. // A PUT event contains current kv pair.
  38. // A PUT event with kv.Version=1 indicates the creation of a key.
  39. // A DELETE/EXPIRE event contains the deleted key with
  40. // its modification revision set to the revision of deletion.
  41. KeyValue kv = 2;
  42. // prev_kv holds the key-value pair before the event happens.
  43. KeyValue prev_kv = 3;
  44. }