tikv-client 0.4.0

The Rust language implementation of TiKV client.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftMessage {
    #[prost(uint64, tag = "1")]
    pub region_id: u64,
    #[prost(message, optional, tag = "2")]
    pub from_peer: ::core::option::Option<super::metapb::Peer>,
    #[prost(message, optional, tag = "3")]
    pub to_peer: ::core::option::Option<super::metapb::Peer>,
    #[prost(message, optional, tag = "4")]
    pub message: ::core::option::Option<super::eraftpb::Message>,
    #[prost(message, optional, tag = "5")]
    pub region_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    /// true means to_peer is a tombstone peer and it should remove itself.
    #[prost(bool, tag = "6")]
    pub is_tombstone: bool,
    /// Region key range \[start_key, end_key).
    #[prost(bytes = "vec", tag = "7")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "8")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    /// If it has value, to_peer should be removed if merge is never going to complete.
    #[prost(message, optional, tag = "9")]
    pub merge_target: ::core::option::Option<super::metapb::Region>,
    #[prost(message, optional, tag = "10")]
    pub extra_msg: ::core::option::Option<ExtraMessage>,
    #[prost(bytes = "vec", tag = "11")]
    pub extra_ctx: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "super::disk_usage::DiskUsage", tag = "12")]
    pub disk_usage: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftTruncatedState {
    #[prost(uint64, tag = "1")]
    pub index: u64,
    #[prost(uint64, tag = "2")]
    pub term: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SnapshotCfFile {
    #[prost(string, tag = "1")]
    pub cf: ::prost::alloc::string::String,
    #[prost(uint64, tag = "2")]
    pub size: u64,
    #[prost(uint32, tag = "3")]
    pub checksum: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SnapshotMeta {
    #[prost(message, repeated, tag = "1")]
    pub cf_files: ::prost::alloc::vec::Vec<SnapshotCfFile>,
    /// true means this snapshot is triggered for load balance
    #[prost(bool, tag = "2")]
    pub for_balance: bool,
    /// true means this is an empty snapshot for witness
    #[prost(bool, tag = "3")]
    pub for_witness: bool,
    /// the timestamp second to generate snapshot
    #[prost(uint64, tag = "4")]
    pub start: u64,
    /// the duration of generating snapshot
    #[prost(uint64, tag = "5")]
    pub generate_duration_sec: u64,
    /// the path of the tablet snapshot, it should only be used for v1 to receive
    /// snapshot from v2
    #[prost(string, tag = "6")]
    pub tablet_snap_path: ::prost::alloc::string::String,
    /// A hint of the latest commit index on leader when sending snapshot.
    /// It should only be used for v2 to send snapshot to v1.
    /// See <https://github.com/pingcap/tiflash/issues/7568>
    #[prost(uint64, tag = "7")]
    pub commit_index_hint: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SnapshotChunk {
    #[prost(message, optional, tag = "1")]
    pub message: ::core::option::Option<RaftMessage>,
    #[prost(bytes = "vec", tag = "2")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Done {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotFileMeta {
    #[prost(uint64, tag = "1")]
    pub file_size: u64,
    #[prost(string, tag = "2")]
    pub file_name: ::prost::alloc::string::String,
    /// Some block data. Unencrypted.
    #[prost(bytes = "vec", tag = "3")]
    pub head_chunk: ::prost::alloc::vec::Vec<u8>,
    /// trailing data including checksum. Unencrypted.
    #[prost(bytes = "vec", tag = "4")]
    pub trailing_chunk: ::prost::alloc::vec::Vec<u8>,
}
/// Snapshot preview for server to decide whether skip some files.
/// Server should send back an `AcceptedSnapshotFile` to let client
/// keep sending specified files. Only SST files can be skipped, all
/// other files should always be sent.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotPreview {
    #[prost(message, repeated, tag = "1")]
    pub metas: ::prost::alloc::vec::Vec<TabletSnapshotFileMeta>,
    /// There may be too many metas, use a flag to indicate all metas
    /// are sent.
    #[prost(bool, tag = "2")]
    pub end: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotFileChunk {
    #[prost(uint64, tag = "1")]
    pub file_size: u64,
    #[prost(string, tag = "2")]
    pub file_name: ::prost::alloc::string::String,
    /// Encrypted.
    #[prost(bytes = "vec", tag = "3")]
    pub data: ::prost::alloc::vec::Vec<u8>,
    /// Initial vector if encryption is enabled.
    #[prost(bytes = "vec", tag = "4")]
    pub iv: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, optional, tag = "5")]
    pub key: ::core::option::Option<super::encryptionpb::DataKey>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotHead {
    #[prost(message, optional, tag = "1")]
    pub message: ::core::option::Option<RaftMessage>,
    #[prost(bool, tag = "2")]
    pub use_cache: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotEnd {
    /// Checksum of all data sent in `TabletSnapshotFileChunk.data` and
    /// `TabletSnapshotFileChunk.file_name`.
    #[prost(uint64, tag = "1")]
    pub checksum: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotRequest {
    #[prost(oneof = "tablet_snapshot_request::Payload", tags = "1, 2, 3, 4")]
    pub payload: ::core::option::Option<tablet_snapshot_request::Payload>,
}
/// Nested message and enum types in `TabletSnapshotRequest`.
pub mod tablet_snapshot_request {
    #[allow(clippy::derive_partial_eq_without_eq)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Payload {
        #[prost(message, tag = "1")]
        Head(super::TabletSnapshotHead),
        #[prost(message, tag = "2")]
        Preview(super::TabletSnapshotPreview),
        #[prost(message, tag = "3")]
        Chunk(super::TabletSnapshotFileChunk),
        #[prost(message, tag = "4")]
        End(super::TabletSnapshotEnd),
    }
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AcceptedSnapshotFiles {
    #[prost(string, repeated, tag = "1")]
    pub file_name: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TabletSnapshotResponse {
    #[prost(message, optional, tag = "1")]
    pub files: ::core::option::Option<AcceptedSnapshotFiles>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyValue {
    #[prost(bytes = "vec", tag = "1")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftSnapshotData {
    #[prost(message, optional, tag = "1")]
    pub region: ::core::option::Option<super::metapb::Region>,
    #[prost(uint64, tag = "2")]
    pub file_size: u64,
    #[prost(message, repeated, tag = "3")]
    pub data: ::prost::alloc::vec::Vec<KeyValue>,
    #[prost(uint64, tag = "4")]
    pub version: u64,
    #[prost(message, optional, tag = "5")]
    pub meta: ::core::option::Option<SnapshotMeta>,
    #[prost(message, repeated, tag = "6")]
    pub removed_records: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    #[prost(message, repeated, tag = "7")]
    pub merged_records: ::prost::alloc::vec::Vec<MergedRecord>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreIdent {
    #[prost(uint64, tag = "1")]
    pub cluster_id: u64,
    #[prost(uint64, tag = "2")]
    pub store_id: u64,
    #[prost(enumeration = "super::kvrpcpb::ApiVersion", tag = "3")]
    pub api_version: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreRecoverState {
    /// Used for TiKV start recovery when WAL of KVDB was disabled.
    /// TiKV may read all relations between seqno and raft log index, and replay
    /// all raft logs which corresponding seqno smaller than the seqno here.
    /// After TiKV replays all raft logs and flushed KV data, the seqno here must
    /// be updated.
    #[prost(uint64, tag = "1")]
    pub seqno: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftLocalState {
    #[prost(message, optional, tag = "1")]
    pub hard_state: ::core::option::Option<super::eraftpb::HardState>,
    #[prost(uint64, tag = "2")]
    pub last_index: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RaftApplyState {
    #[prost(uint64, tag = "1")]
    pub applied_index: u64,
    #[prost(uint64, tag = "3")]
    pub last_commit_index: u64,
    #[prost(uint64, tag = "4")]
    pub commit_index: u64,
    #[prost(uint64, tag = "5")]
    pub commit_term: u64,
    #[prost(message, optional, tag = "2")]
    pub truncated_state: ::core::option::Option<RaftTruncatedState>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MergeState {
    #[prost(uint64, tag = "1")]
    pub min_index: u64,
    #[prost(message, optional, tag = "2")]
    pub target: ::core::option::Option<super::metapb::Region>,
    #[prost(uint64, tag = "3")]
    pub commit: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MergedRecord {
    #[prost(uint64, tag = "1")]
    pub source_region_id: u64,
    #[prost(message, optional, tag = "2")]
    pub source_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    /// Peers of source region when merge is committed.
    #[prost(message, repeated, tag = "3")]
    pub source_peers: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    /// Removed peers (by confchange) of source region when merge is committed.
    #[prost(message, repeated, tag = "9")]
    pub source_removed_records: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    #[prost(uint64, tag = "4")]
    pub target_region_id: u64,
    #[prost(message, optional, tag = "5")]
    pub target_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    #[prost(message, repeated, tag = "6")]
    pub target_peers: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    /// Commit merge index.
    #[prost(uint64, tag = "7")]
    pub index: u64,
    /// Prepare merge index.
    #[prost(uint64, tag = "8")]
    pub source_index: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegionLocalState {
    #[prost(enumeration = "PeerState", tag = "1")]
    pub state: i32,
    #[prost(message, optional, tag = "2")]
    pub region: ::core::option::Option<super::metapb::Region>,
    #[prost(message, optional, tag = "3")]
    pub merge_state: ::core::option::Option<MergeState>,
    /// The apply index corresponding to the storage when it's initialized.
    #[prost(uint64, tag = "4")]
    pub tablet_index: u64,
    /// Raft doesn't guarantee peer will be removed in the end. In v1, peer finds
    /// out its destiny by logs or broadcast; in v2, leader is responsible to
    /// ensure removed peers are destroyed.
    /// Note: only peers who has been part of this region can be in this list.
    #[prost(message, repeated, tag = "5")]
    pub removed_records: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    /// Merged peer can't be deleted like gc peers. Instead, leader needs to
    /// query target peer to decide whether source peer can be destroyed.
    #[prost(message, repeated, tag = "6")]
    pub merged_records: ::prost::alloc::vec::Vec<MergedRecord>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegionSequenceNumberRelation {
    #[prost(uint64, tag = "1")]
    pub region_id: u64,
    #[prost(uint64, tag = "2")]
    pub sequence_number: u64,
    #[prost(message, optional, tag = "3")]
    pub apply_state: ::core::option::Option<RaftApplyState>,
    #[prost(message, optional, tag = "4")]
    pub region_state: ::core::option::Option<RegionLocalState>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AvailabilityContext {
    #[prost(uint64, tag = "1")]
    pub from_region_id: u64,
    #[prost(message, optional, tag = "2")]
    pub from_region_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    #[prost(bool, tag = "3")]
    pub unavailable: bool,
    #[prost(bool, tag = "4")]
    pub trimmed: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlushMemtable {
    #[prost(uint64, tag = "1")]
    pub region_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RefreshBuckets {
    #[prost(uint64, tag = "1")]
    pub version: u64,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    #[prost(uint64, repeated, tag = "3")]
    pub sizes: ::prost::alloc::vec::Vec<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckGcPeer {
    /// The region ID who triggers the check and wait for report. It should be
    /// the ID of RaftMessage.from.
    #[prost(uint64, tag = "1")]
    pub from_region_id: u64,
    /// The region ID to be checked if should be destroyed.
    #[prost(uint64, tag = "2")]
    pub check_region_id: u64,
    /// The epoch of the region to be checked.
    #[prost(message, optional, tag = "3")]
    pub check_region_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    /// The peer to be checked.
    #[prost(message, optional, tag = "4")]
    pub check_peer: ::core::option::Option<super::metapb::Peer>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExtraMessage {
    #[prost(enumeration = "ExtraMessageType", tag = "1")]
    pub r#type: i32,
    /// It's merge related index. In `WantRollbackMerge`, it's prepare merge index. In
    /// `MsgGcPeerRequest`, it's the commit merge index. In `MsgVoterReplicatedIndexRequest`
    /// it's the voter_replicated_index.
    #[prost(uint64, tag = "2")]
    pub index: u64,
    /// In `MsgCheckStalePeerResponse`, it's the peers that receiver can continue to query.
    #[prost(message, repeated, tag = "3")]
    pub check_peers: ::prost::alloc::vec::Vec<super::metapb::Peer>,
    #[prost(bool, tag = "4")]
    pub wait_data: bool,
    /// Flag for forcely wake up hibernate regions if true.
    #[prost(bool, tag = "5")]
    pub forcely_awaken: bool,
    #[prost(message, optional, tag = "6")]
    pub check_gc_peer: ::core::option::Option<CheckGcPeer>,
    #[prost(message, optional, tag = "7")]
    pub flush_memtable: ::core::option::Option<FlushMemtable>,
    /// Used by `MsgAvailabilityRequest` and `MsgAvailabilityResponse` in v2.
    #[prost(message, optional, tag = "8")]
    pub availability_context: ::core::option::Option<AvailabilityContext>,
    /// notice the peer to refresh buckets version
    #[prost(message, optional, tag = "9")]
    pub refresh_buckets: ::core::option::Option<RefreshBuckets>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PeerState {
    Normal = 0,
    Applying = 1,
    Tombstone = 2,
    Merging = 3,
    /// Currently used for witness to non-witness conversion: When a witness
    /// has just become a non-witness, we need to set and persist this state,
    /// so that when the service restarts before applying snapshot, we can
    /// actively request snapshot when initializing this peer.
    Unavailable = 4,
}
impl PeerState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            PeerState::Normal => "Normal",
            PeerState::Applying => "Applying",
            PeerState::Tombstone => "Tombstone",
            PeerState::Merging => "Merging",
            PeerState::Unavailable => "Unavailable",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Normal" => Some(Self::Normal),
            "Applying" => Some(Self::Applying),
            "Tombstone" => Some(Self::Tombstone),
            "Merging" => Some(Self::Merging),
            "Unavailable" => Some(Self::Unavailable),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ExtraMessageType {
    MsgRegionWakeUp = 0,
    MsgWantRollbackMerge = 1,
    MsgCheckStalePeer = 2,
    MsgCheckStalePeerResponse = 3,
    /// If leader is going to sleep, it will send requests to all its followers
    /// to make sure they all agree to sleep.
    MsgHibernateRequest = 4,
    MsgHibernateResponse = 5,
    MsgRejectRaftLogCausedByMemoryUsage = 6,
    MsgAvailabilityRequest = 7,
    MsgAvailabilityResponse = 8,
    MsgVoterReplicatedIndexRequest = 9,
    MsgVoterReplicatedIndexResponse = 10,
    /// Message means that `from` is tombstone. Leader can then update removed_records.
    MsgGcPeerRequest = 11,
    MsgGcPeerResponse = 12,
    MsgFlushMemtable = 13,
    MsgRefreshBuckets = 14,
}
impl ExtraMessageType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            ExtraMessageType::MsgRegionWakeUp => "MsgRegionWakeUp",
            ExtraMessageType::MsgWantRollbackMerge => "MsgWantRollbackMerge",
            ExtraMessageType::MsgCheckStalePeer => "MsgCheckStalePeer",
            ExtraMessageType::MsgCheckStalePeerResponse => "MsgCheckStalePeerResponse",
            ExtraMessageType::MsgHibernateRequest => "MsgHibernateRequest",
            ExtraMessageType::MsgHibernateResponse => "MsgHibernateResponse",
            ExtraMessageType::MsgRejectRaftLogCausedByMemoryUsage => {
                "MsgRejectRaftLogCausedByMemoryUsage"
            }
            ExtraMessageType::MsgAvailabilityRequest => "MsgAvailabilityRequest",
            ExtraMessageType::MsgAvailabilityResponse => "MsgAvailabilityResponse",
            ExtraMessageType::MsgVoterReplicatedIndexRequest => {
                "MsgVoterReplicatedIndexRequest"
            }
            ExtraMessageType::MsgVoterReplicatedIndexResponse => {
                "MsgVoterReplicatedIndexResponse"
            }
            ExtraMessageType::MsgGcPeerRequest => "MsgGcPeerRequest",
            ExtraMessageType::MsgGcPeerResponse => "MsgGcPeerResponse",
            ExtraMessageType::MsgFlushMemtable => "MsgFlushMemtable",
            ExtraMessageType::MsgRefreshBuckets => "MsgRefreshBuckets",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "MsgRegionWakeUp" => Some(Self::MsgRegionWakeUp),
            "MsgWantRollbackMerge" => Some(Self::MsgWantRollbackMerge),
            "MsgCheckStalePeer" => Some(Self::MsgCheckStalePeer),
            "MsgCheckStalePeerResponse" => Some(Self::MsgCheckStalePeerResponse),
            "MsgHibernateRequest" => Some(Self::MsgHibernateRequest),
            "MsgHibernateResponse" => Some(Self::MsgHibernateResponse),
            "MsgRejectRaftLogCausedByMemoryUsage" => {
                Some(Self::MsgRejectRaftLogCausedByMemoryUsage)
            }
            "MsgAvailabilityRequest" => Some(Self::MsgAvailabilityRequest),
            "MsgAvailabilityResponse" => Some(Self::MsgAvailabilityResponse),
            "MsgVoterReplicatedIndexRequest" => {
                Some(Self::MsgVoterReplicatedIndexRequest)
            }
            "MsgVoterReplicatedIndexResponse" => {
                Some(Self::MsgVoterReplicatedIndexResponse)
            }
            "MsgGcPeerRequest" => Some(Self::MsgGcPeerRequest),
            "MsgGcPeerResponse" => Some(Self::MsgGcPeerResponse),
            "MsgFlushMemtable" => Some(Self::MsgFlushMemtable),
            "MsgRefreshBuckets" => Some(Self::MsgRefreshBuckets),
            _ => None,
        }
    }
}