2015-06-30 04:37:52 +03:00
|
|
|
syntax = "proto3";
|
2016-04-25 22:32:58 +03:00
|
|
|
package mvccpb;
|
2015-05-19 00:35:10 +03:00
|
|
|
|
2015-09-03 19:57:59 +03:00
|
|
|
import "gogoproto/gogo.proto";
|
2015-05-19 00:35:10 +03:00
|
|
|
|
|
|
|
option (gogoproto.marshaler_all) = true;
|
|
|
|
option (gogoproto.sizer_all) = true;
|
|
|
|
option (gogoproto.unmarshaler_all) = true;
|
|
|
|
option (gogoproto.goproto_getters_all) = false;
|
|
|
|
option (gogoproto.goproto_enum_prefix_all) = false;
|
|
|
|
|
|
|
|
message KeyValue {
|
2016-04-15 23:13:24 +03:00
|
|
|
// key is the key in bytes. An empty key is not allowed.
|
2015-06-30 04:37:52 +03:00
|
|
|
bytes key = 1;
|
2016-02-12 04:25:43 +03:00
|
|
|
// create_revision is the revision of last creation on this key.
|
2015-09-04 00:45:54 +03:00
|
|
|
int64 create_revision = 2;
|
2016-02-12 04:25:43 +03:00
|
|
|
// mod_revision is the revision of last modification on this key.
|
2015-09-04 00:45:54 +03:00
|
|
|
int64 mod_revision = 3;
|
2015-05-19 00:35:10 +03:00
|
|
|
// version is the version of the key. A deletion resets
|
|
|
|
// the version to zero and any modification of the key
|
|
|
|
// increases its version.
|
2015-06-30 04:37:52 +03:00
|
|
|
int64 version = 4;
|
2016-04-15 23:13:24 +03:00
|
|
|
// value is the value held by the key, in bytes.
|
2015-06-30 04:37:52 +03:00
|
|
|
bytes value = 5;
|
2015-12-29 22:49:00 +03:00
|
|
|
// lease is the ID of the lease that attached to key.
|
|
|
|
// When the attached lease expires, the key will be deleted.
|
2016-04-15 23:13:24 +03:00
|
|
|
// If lease is 0, then no lease is attached to the key.
|
2015-12-29 22:49:00 +03:00
|
|
|
int64 lease = 6;
|
2015-05-19 00:35:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message Event {
|
|
|
|
enum EventType {
|
|
|
|
PUT = 0;
|
|
|
|
DELETE = 1;
|
|
|
|
}
|
2016-04-15 23:13:24 +03:00
|
|
|
// type is the kind of event. If type is a PUT, it indicates
|
|
|
|
// new data has been stored to the key. If type is a DELETE,
|
|
|
|
// it indicates the key was deleted.
|
2015-06-30 04:37:52 +03:00
|
|
|
EventType type = 1;
|
2016-04-15 23:13:24 +03:00
|
|
|
// kv holds the KeyValue for the event.
|
2016-02-19 00:56:37 +03:00
|
|
|
// A PUT event contains current kv pair.
|
|
|
|
// A PUT event with kv.Version=1 indicates the creation of a key.
|
2016-02-26 00:39:05 +03:00
|
|
|
// A DELETE/EXPIRE event contains the deleted key with
|
|
|
|
// its modification revision set to the revision of deletion.
|
2015-06-30 04:37:52 +03:00
|
|
|
KeyValue kv = 2;
|
2016-07-02 05:17:01 +03:00
|
|
|
|
|
|
|
// prev_kv holds the key-value pair before the event happens.
|
|
|
|
KeyValue prev_kv = 3;
|
2015-05-19 00:35:10 +03:00
|
|
|
}
|