blob: 23c911b7da881b850898a91bb14cb26e701b401d [file] [log] [blame]
Prince Pereirac1c21d62021-04-22 08:38:15 +00001syntax = "proto3";
2package mvccpb;
3
4import "gogoproto/gogo.proto";
5
6option (gogoproto.marshaler_all) = true;
7option (gogoproto.sizer_all) = true;
8option (gogoproto.unmarshaler_all) = true;
9option (gogoproto.goproto_getters_all) = false;
10option (gogoproto.goproto_enum_prefix_all) = false;
11
12message 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
31message 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}