kv.proto 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. syntax = "proto3";
  2. package storagepb;
  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. bytes key = 1;
  11. // create_revision is the revision of last creation on this key.
  12. int64 create_revision = 2;
  13. // mod_revision is the revision of last modification on this key.
  14. int64 mod_revision = 3;
  15. // version is the version of the key. A deletion resets
  16. // the version to zero and any modification of the key
  17. // increases its version.
  18. int64 version = 4;
  19. bytes value = 5;
  20. // lease is the ID of the lease that attached to key.
  21. // When the attached lease expires, the key will be deleted.
  22. int64 lease = 6;
  23. }
  24. message Event {
  25. enum EventType {
  26. PUT = 0;
  27. DELETE = 1;
  28. EXPIRE = 2;
  29. }
  30. EventType type = 1;
  31. // A PUT event contains current kv pair.
  32. // A PUT event with kv.Version=1 indicates the creation of a key.
  33. // A DELETE/EXPIRE event contains the deleted key with
  34. // its modification revision set to the revision of deletion.
  35. KeyValue kv = 2;
  36. }