etcdv3client/pb/mvccpb.rs
1// This file is @generated by prost-build.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct KeyValue {
5 /// key is the key in bytes. An empty key is not allowed.
6 #[prost(bytes = "vec", tag = "1")]
7 pub key: ::prost::alloc::vec::Vec<u8>,
8 /// create_revision is the revision of last creation on this key.
9 #[prost(int64, tag = "2")]
10 pub create_revision: i64,
11 /// mod_revision is the revision of last modification on this key.
12 #[prost(int64, tag = "3")]
13 pub mod_revision: i64,
14 /// version is the version of the key. A deletion resets
15 /// the version to zero and any modification of the key
16 /// increases its version.
17 #[prost(int64, tag = "4")]
18 pub version: i64,
19 /// value is the value held by the key, in bytes.
20 #[prost(bytes = "vec", tag = "5")]
21 pub value: ::prost::alloc::vec::Vec<u8>,
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 #[prost(int64, tag = "6")]
26 pub lease: i64,
27}
28#[allow(clippy::derive_partial_eq_without_eq)]
29#[derive(Clone, PartialEq, ::prost::Message)]
30pub struct Event {
31 /// type is the kind of event. If type is a PUT, it indicates
32 /// new data has been stored to the key. If type is a DELETE,
33 /// it indicates the key was deleted.
34 #[prost(enumeration = "event::EventType", tag = "1")]
35 pub r#type: i32,
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 #[prost(message, optional, tag = "2")]
42 pub kv: ::core::option::Option<KeyValue>,
43 /// prev_kv holds the key-value pair before the event happens.
44 #[prost(message, optional, tag = "3")]
45 pub prev_kv: ::core::option::Option<KeyValue>,
46}
47/// Nested message and enum types in `Event`.
48pub mod event {
49 #[derive(
50 Clone,
51 Copy,
52 Debug,
53 PartialEq,
54 Eq,
55 Hash,
56 PartialOrd,
57 Ord,
58 ::prost::Enumeration
59 )]
60 #[repr(i32)]
61 pub enum EventType {
62 Put = 0,
63 Delete = 1,
64 }
65 impl EventType {
66 /// String value of the enum field names used in the ProtoBuf definition.
67 ///
68 /// The values are not transformed in any way and thus are considered stable
69 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
70 pub fn as_str_name(&self) -> &'static str {
71 match self {
72 EventType::Put => "PUT",
73 EventType::Delete => "DELETE",
74 }
75 }
76 /// Creates an enum from field names used in the ProtoBuf definition.
77 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
78 match value {
79 "PUT" => Some(Self::Put),
80 "DELETE" => Some(Self::Delete),
81 _ => None,
82 }
83 }
84 }
85}