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