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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
// This file is @generated by prost-build.
/// A transactional get command. Lookup a value for `key` in the transaction with
/// starting timestamp = `version`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "3")]
    pub version: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetResponse {
    /// A region error indicates that the request was sent to the wrong TiKV node
    /// (or other, similar errors).
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    /// A value could not be retrieved due to the state of the database for the requested key.
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// A successful result.
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    /// True if the key does not exist in the database.
    #[prost(bool, tag = "4")]
    pub not_found: bool,
    /// Time and scan details when processing the request.
    #[prost(message, optional, tag = "6")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Scan fetches values for a range of keys; it is part of the transaction with
/// starting timestamp = `version`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    /// The maximum number of results to return.
    #[prost(uint32, tag = "3")]
    pub limit: u32,
    #[prost(uint64, tag = "4")]
    pub version: u64,
    /// Return only the keys found by scanning, not their values.
    #[prost(bool, tag = "5")]
    pub key_only: bool,
    #[prost(bool, tag = "6")]
    pub reverse: bool,
    /// For compatibility, when scanning forward, the range to scan is \[start_key, end_key), where start_key \< end_key;
    /// and when scanning backward, it scans \[end_key, start_key) in descending order, where end_key \< start_key.
    #[prost(bytes = "vec", tag = "7")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    /// If sample_step > 0, skips 'sample_step - 1' number of keys after each returned key.
    /// locks are not checked.
    #[prost(uint32, tag = "8")]
    pub sample_step: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    /// Each KvPair may contain a key error.
    #[prost(message, repeated, tag = "2")]
    pub pairs: ::prost::alloc::vec::Vec<KvPair>,
    /// This KeyError exists when some key is locked but we cannot check locks of all keys.
    /// In this case, `pairs` should be empty and the client should redo scanning all the keys
    /// after resolving the lock.
    #[prost(message, optional, tag = "3")]
    pub error: ::core::option::Option<KeyError>,
}
/// A prewrite is the first phase of writing to TiKV. It contains all data to be written in a transaction.
/// TiKV will write the data in a preliminary state. Data cannot be read until it has been committed.
/// The client should only commit a transaction once all prewrites succeed.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrewriteRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// The data to be written to the database.
    #[prost(message, repeated, tag = "2")]
    pub mutations: ::prost::alloc::vec::Vec<Mutation>,
    /// The client picks one key to be primary (unrelated to the primary key concept in SQL). This
    /// key's lock is the source of truth for the state of a transaction. All other locks due to a
    /// transaction will point to the primary lock.
    #[prost(bytes = "vec", tag = "3")]
    pub primary_lock: ::prost::alloc::vec::Vec<u8>,
    /// Identifies the transaction being written.
    #[prost(uint64, tag = "4")]
    pub start_version: u64,
    #[prost(uint64, tag = "5")]
    pub lock_ttl: u64,
    /// TiKV can skip some checks, used for speeding up data migration.
    #[prost(bool, tag = "6")]
    pub skip_constraint_check: bool,
    /// For pessimistic transaction, some mutations don't need to be locked, for example, non-unique index key.
    /// Keys with deferred constraint checks are not locked.
    #[prost(enumeration = "prewrite_request::PessimisticAction", repeated, tag = "7")]
    pub pessimistic_actions: ::prost::alloc::vec::Vec<i32>,
    /// How many keys this transaction involves in this region.
    #[prost(uint64, tag = "8")]
    pub txn_size: u64,
    /// For pessimistic transactions only; used to check if a conflict lock is already committed.
    #[prost(uint64, tag = "9")]
    pub for_update_ts: u64,
    /// If min_commit_ts > 0, this is a large transaction request, the final commit_ts
    /// will be inferred from `min_commit_ts`.
    #[prost(uint64, tag = "10")]
    pub min_commit_ts: u64,
    /// When async commit is enabled, `secondaries` should be set as the key list of all secondary
    /// locks if the request prewrites the primary lock.
    #[prost(bool, tag = "11")]
    pub use_async_commit: bool,
    #[prost(bytes = "vec", repeated, tag = "12")]
    pub secondaries: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// When the transaction involves only one region, it's possible to commit the transaction
    /// directly with 1PC protocol.
    #[prost(bool, tag = "13")]
    pub try_one_pc: bool,
    /// The max commit ts is reserved for limiting the commit ts of 1PC or async commit, which can be used to avoid
    /// inconsistency with schema change.
    #[prost(uint64, tag = "14")]
    pub max_commit_ts: u64,
    /// The level of assertion to use on this prewrte request.
    #[prost(enumeration = "AssertionLevel", tag = "15")]
    pub assertion_level: i32,
    /// for_update_ts constriants that should be checked when prewriting a pessimistic transaction.
    /// See <https://github.com/tikv/tikv/issues/14311>
    #[prost(message, repeated, tag = "16")]
    pub for_update_ts_constraints: ::prost::alloc::vec::Vec<
        prewrite_request::ForUpdateTsConstraint,
    >,
    /// Reserved for file based transaction.
    #[prost(uint64, repeated, tag = "100")]
    pub txn_file_chunks: ::prost::alloc::vec::Vec<u64>,
}
/// Nested message and enum types in `PrewriteRequest`.
pub mod prewrite_request {
    /// for_update_ts constriants that should be checked when prewriting a pessimistic transaction.
    #[allow(clippy::derive_partial_eq_without_eq)]
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct ForUpdateTsConstraint {
        /// The index of key in the prewrite request that should be checked.
        #[prost(uint32, tag = "1")]
        pub index: u32,
        /// The expected for_update_ts of the pessimistic lock of the key.
        #[prost(uint64, tag = "2")]
        pub expected_for_update_ts: u64,
    }
    /// What kind of checks need to be performed for keys in a pessimistic transaction.
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum PessimisticAction {
        /// The key needn't be locked and no extra write conflict checks are needed.
        SkipPessimisticCheck = 0,
        /// The key should have been locked at the time of prewrite.
        DoPessimisticCheck = 1,
        /// The key doesn't need a pessimistic lock. But we need to do data constraint checks.
        DoConstraintCheck = 2,
    }
    impl PessimisticAction {
        /// 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 {
                PessimisticAction::SkipPessimisticCheck => "SKIP_PESSIMISTIC_CHECK",
                PessimisticAction::DoPessimisticCheck => "DO_PESSIMISTIC_CHECK",
                PessimisticAction::DoConstraintCheck => "DO_CONSTRAINT_CHECK",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "SKIP_PESSIMISTIC_CHECK" => Some(Self::SkipPessimisticCheck),
                "DO_PESSIMISTIC_CHECK" => Some(Self::DoPessimisticCheck),
                "DO_CONSTRAINT_CHECK" => Some(Self::DoConstraintCheck),
                _ => None,
            }
        }
    }
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrewriteResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub errors: ::prost::alloc::vec::Vec<KeyError>,
    /// 0 if the min_commit_ts is not ready or any other reason that async
    /// commit cannot proceed. The client can then fallback to normal way to
    /// continue committing the transaction if prewrite are all finished.
    #[prost(uint64, tag = "3")]
    pub min_commit_ts: u64,
    /// When the transaction is successfully committed with 1PC protocol, this field will be set to
    /// the commit ts of the transaction. Otherwise, if TiKV failed to commit it with 1PC or the
    /// transaction is not 1PC, the value will be 0.
    #[prost(uint64, tag = "4")]
    pub one_pc_commit_ts: u64,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "5")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Lock a set of keys to prepare to write to them.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PessimisticLockRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// In this case every `Op` of the mutations must be `PessimisticLock`.
    #[prost(message, repeated, tag = "2")]
    pub mutations: ::prost::alloc::vec::Vec<Mutation>,
    #[prost(bytes = "vec", tag = "3")]
    pub primary_lock: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "4")]
    pub start_version: u64,
    #[prost(uint64, tag = "5")]
    pub lock_ttl: u64,
    /// Each locking command in a pessimistic transaction has its own timestamp. If locking fails, then
    /// the corresponding SQL statement can be retried with a later timestamp, TiDB does not need to
    /// retry the whole transaction. The name comes from the `SELECT ... FOR UPDATE` SQL statement which
    /// is a locking read. Each `SELECT ... FOR UPDATE` in a transaction will be assigned its own
    /// timestamp.
    #[prost(uint64, tag = "6")]
    pub for_update_ts: u64,
    /// If the request is the first lock request, we don't need to detect deadlock.
    #[prost(bool, tag = "7")]
    pub is_first_lock: bool,
    /// Time to wait for lock released in milliseconds when encountering locks.
    /// 0 means using default timeout in TiKV. Negative means no wait.
    #[prost(int64, tag = "8")]
    pub wait_timeout: i64,
    /// If it is true, TiKV will acquire the pessimistic lock regardless of write conflict
    /// and return the latest value. It's only supported for single mutation.
    #[deprecated]
    #[prost(bool, tag = "9")]
    pub force: bool,
    /// If it is true, TiKV will return values of the keys if no error, so TiDB can cache the values for
    /// later read in the same transaction.
    /// When 'force' is set to true, this field is ignored.
    #[prost(bool, tag = "10")]
    pub return_values: bool,
    /// If min_commit_ts > 0, this is large transaction proto, the final commit_ts
    /// would be infered from min_commit_ts.
    #[prost(uint64, tag = "11")]
    pub min_commit_ts: u64,
    /// If set to true, it means TiKV need to check if the key exists, and return the result in
    /// the `not_founds` feild in the response. This works no matter if `return_values` is set. If
    /// `return_values` is set, it simply makes no difference; otherwise, the `value` field of the
    /// repsonse will be empty while the `not_founds` field still indicates the keys' existence.
    #[prost(bool, tag = "12")]
    pub check_existence: bool,
    /// TiKV lock the record only when it exists
    #[prost(bool, tag = "13")]
    pub lock_only_if_exists: bool,
    /// Specifies the behavior when the request is woken up after wating for lock of another transaction.
    #[prost(enumeration = "PessimisticLockWakeUpMode", tag = "14")]
    pub wake_up_mode: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PessimisticLockKeyResult {
    #[prost(enumeration = "PessimisticLockKeyResultType", tag = "1")]
    pub r#type: i32,
    #[prost(bytes = "vec", tag = "2")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    #[prost(bool, tag = "3")]
    pub existence: bool,
    /// We allow a key be locked when there is write conflict (latest commit_ts > for_update_ts).
    /// In this case, the key is semantically locked by a newer for_update_ts.
    /// For each requested key, the field is non-zero if the key is locked with write conflict, and it
    /// equals to the commit_ts of the latest version of the specified key. The for_update_ts field
    /// of the lock that's actually written to TiKV will also be this value. At the same time,
    /// `value` and `existence` will be returned regardless to how `return_values` and
    /// `check_existence` are set.
    #[prost(uint64, tag = "4")]
    pub locked_with_conflict_ts: u64,
    /// Hint the client that resolving lock is not needed for this lock. For `PessimisticLock`
    /// requests only.
    #[prost(bool, tag = "11")]
    pub skip_resolving_lock: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PessimisticLockResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub errors: ::prost::alloc::vec::Vec<KeyError>,
    /// It carries the latest value and its commit ts if force in PessimisticLockRequest is true.
    #[deprecated]
    #[prost(uint64, tag = "3")]
    pub commit_ts: u64,
    #[deprecated]
    #[prost(bytes = "vec", tag = "4")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    /// The values is set if 'return_values' is true in the request and no error.
    /// If 'force' is true, this field is not used.
    /// Only used when `wake_up_mode` is `WakeUpModeNormal`.
    #[prost(bytes = "vec", repeated, tag = "5")]
    pub values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Indicates whether the values at the same index is correspond to an existing key.
    /// In legacy TiKV, this field is not used even 'force' is false. In that case, an empty value indicates
    /// two possible situations: (1) the key does not exist. (2) the key exists but the value is empty.
    /// Only used when `wake_up_mode` is `WakeUpModeNormal`.
    #[prost(bool, repeated, tag = "6")]
    pub not_founds: ::prost::alloc::vec::Vec<bool>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "7")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
    /// Results of the request. Only used when `wake_up_mode` is `WakeUpModeForceLock`.
    #[prost(message, repeated, tag = "8")]
    pub results: ::prost::alloc::vec::Vec<PessimisticLockKeyResult>,
}
/// Unlock keys locked using `PessimisticLockRequest`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PessimisticRollbackRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub start_version: u64,
    #[prost(uint64, tag = "3")]
    pub for_update_ts: u64,
    #[prost(bytes = "vec", repeated, tag = "4")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PessimisticRollbackResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub errors: ::prost::alloc::vec::Vec<KeyError>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "3")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Used to update the lock_ttl of a psessimistic and/or large transaction to prevent it from been killed.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnHeartBeatRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// The key of the lock to update.
    #[prost(bytes = "vec", tag = "2")]
    pub primary_lock: ::prost::alloc::vec::Vec<u8>,
    /// Start timestamp of the large transaction.
    #[prost(uint64, tag = "3")]
    pub start_version: u64,
    /// The new TTL the sender would like.
    #[prost(uint64, tag = "4")]
    pub advise_lock_ttl: u64,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnHeartBeatResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// The TTL actually set on the requested lock.
    #[prost(uint64, tag = "3")]
    pub lock_ttl: u64,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "4")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// CheckTxnStatusRequest checks the status of a transaction.
/// If the transaction is rollbacked/committed, return that result.
/// If the TTL of the transaction is exhausted, abort that transaction and inform the caller.
/// Otherwise, returns the TTL information for the transaction.
/// CheckTxnStatusRequest may also push forward the minCommitTS of a large transaction.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckTxnStatusRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// Primary key and lock ts together to locate the primary lock of a transaction.
    #[prost(bytes = "vec", tag = "2")]
    pub primary_key: ::prost::alloc::vec::Vec<u8>,
    /// Starting timestamp of the transaction being checked.
    #[prost(uint64, tag = "3")]
    pub lock_ts: u64,
    /// The start timestamp of the transaction which this request is part of.
    #[prost(uint64, tag = "4")]
    pub caller_start_ts: u64,
    /// The client must specify the current time to TiKV using this timestamp. It is used to check TTL
    /// timeouts. It may be inaccurate.
    #[prost(uint64, tag = "5")]
    pub current_ts: u64,
    /// If true, then TiKV will leave a rollback tombstone in the write CF for `primary_key`, even if
    /// that key is not locked.
    #[prost(bool, tag = "6")]
    pub rollback_if_not_exist: bool,
    /// This field is set to true only if the transaction is known to fall back from async commit.
    /// Then, CheckTxnStatus treats the transaction as non-async-commit even if the use_async_commit
    /// field in the primary lock is true.
    #[prost(bool, tag = "7")]
    pub force_sync_commit: bool,
    /// If the check request is used to resolve or decide the transaction status for a input pessimistic
    /// lock, the transaction status could not be decided if the primary lock is pessimistic too and
    /// it's still uncertain.
    #[prost(bool, tag = "8")]
    pub resolving_pessimistic_lock: bool,
    /// Whether it's needed to check if the lock on the key (if any) is the primary lock.
    /// This is for handling some corner cases when a pessimistic transaction changes its primary
    /// (see <https://github.com/pingcap/tidb/issues/42937> for details). This field is necessary
    /// because the old versions of clients cannot handle some results returned from TiKV correctly.
    /// For new versions, this field should always be set to true.
    #[prost(bool, tag = "9")]
    pub verify_is_primary: bool,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckTxnStatusResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// Three kinds of transaction status:
    /// locked: lock_ttl > 0
    /// committed: commit_version > 0
    /// rollbacked: lock_ttl = 0 && commit_version = 0
    #[prost(uint64, tag = "3")]
    pub lock_ttl: u64,
    #[prost(uint64, tag = "4")]
    pub commit_version: u64,
    /// The action performed by TiKV (and why if the action is to rollback).
    #[prost(enumeration = "Action", tag = "5")]
    pub action: i32,
    #[prost(message, optional, tag = "6")]
    pub lock_info: ::core::option::Option<LockInfo>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "7")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Part of the async commit protocol, checks for locks on all supplied keys. If a lock is missing,
/// does not have a successful status, or belongs to another transaction, TiKV will leave a rollback
/// tombstone for that key.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckSecondaryLocksRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Identifies the transaction we are investigating.
    #[prost(uint64, tag = "3")]
    pub start_version: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckSecondaryLocksResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// For each key in `keys` in `CheckSecondaryLocks`, there will be a lock in
    /// this list if there is a lock present and belonging to the correct transaction,
    /// nil otherwise.
    #[prost(message, repeated, tag = "3")]
    pub locks: ::prost::alloc::vec::Vec<LockInfo>,
    /// If any of the locks have been committed, this is the commit ts used. If no
    /// locks have been committed, it will be zero.
    #[prost(uint64, tag = "4")]
    pub commit_ts: u64,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "5")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// The second phase of writing to TiKV. If there are no errors or conflicts, then this request
/// commits a transaction so that its data can be read by other transactions.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// Identifies the transaction.
    #[prost(uint64, tag = "2")]
    pub start_version: u64,
    /// All keys in the transaction (to be committed).
    #[prost(bytes = "vec", repeated, tag = "3")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Timestamp for the end of the transaction. Must be greater than `start_version`.
    #[prost(uint64, tag = "4")]
    pub commit_version: u64,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// If the commit ts is derived from min_commit_ts, this field should be set.
    #[prost(uint64, tag = "3")]
    pub commit_version: u64,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "4")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Not yet implemented.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportRequest {
    #[prost(message, repeated, tag = "1")]
    pub mutations: ::prost::alloc::vec::Vec<Mutation>,
    #[prost(uint64, tag = "2")]
    pub commit_version: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImportResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
/// Cleanup a key by possibly unlocking it.
/// From 4.0 onwards, this message is no longer used.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CleanupRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "3")]
    pub start_version: u64,
    /// The current timestamp, used in combination with a lock's TTL to determine
    /// if the lock has expired. If `current_ts == 0`, then the key will be unlocked
    /// irrespective of its TTL.
    #[prost(uint64, tag = "4")]
    pub current_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CleanupResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// Set if the key is already committed.
    #[prost(uint64, tag = "3")]
    pub commit_version: u64,
}
/// Similar to a `Get` request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    #[prost(uint64, tag = "3")]
    pub version: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchGetResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub pairs: ::prost::alloc::vec::Vec<KvPair>,
    /// Time and scan details when processing the request.
    #[prost(message, optional, tag = "4")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
    /// This KeyError exists when some key is locked but we cannot check locks of all keys.
    /// In this case, `pairs` should be empty and the client should redo batch get all the keys
    /// after resolving the lock.
    #[prost(message, optional, tag = "5")]
    pub error: ::core::option::Option<KeyError>,
}
/// Rollback a prewritten transaction. This will remove the preliminary data from the database,
/// unlock locks, and leave a rollback tombstone.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRollbackRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// Identify the transaction to be rolled back.
    #[prost(uint64, tag = "2")]
    pub start_version: u64,
    /// The keys to rollback.
    #[prost(bytes = "vec", repeated, tag = "3")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchRollbackResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "3")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Scan the database for locks. Used at the start of the GC process to find all
/// old locks.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanLockRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// Returns all locks with a start timestamp before `max_version`.
    #[prost(uint64, tag = "2")]
    pub max_version: u64,
    /// Start scanning from this key.
    #[prost(bytes = "vec", tag = "3")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    /// The maximum number of locks to return.
    #[prost(uint32, tag = "4")]
    pub limit: u32,
    /// The exclusive upperbound for scanning.
    #[prost(bytes = "vec", tag = "5")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanLockResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// Info on all locks found by the scan.
    #[prost(message, repeated, tag = "3")]
    pub locks: ::prost::alloc::vec::Vec<LockInfo>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "4")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// For all keys locked by the transaction identified by `start_version`, either
/// commit or rollback the transaction and unlock the key.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResolveLockRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub start_version: u64,
    /// `commit_version == 0` means the transaction was rolled back.
    /// `commit_version > 0` means the transaction was committed at the given timestamp.
    #[prost(uint64, tag = "3")]
    pub commit_version: u64,
    #[prost(message, repeated, tag = "4")]
    pub txn_infos: ::prost::alloc::vec::Vec<TxnInfo>,
    /// Only resolve specified keys.
    #[prost(bytes = "vec", repeated, tag = "5")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResolveLockResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
    /// Execution details about the request processing.
    #[prost(message, optional, tag = "3")]
    pub exec_details_v2: ::core::option::Option<ExecDetailsV2>,
}
/// Request TiKV to garbage collect all non-current data older than `safe_point`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub safe_point: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GcResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, optional, tag = "2")]
    pub error: ::core::option::Option<KeyError>,
}
/// Delete a range of data from TiKV.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRangeRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    /// If true, the data will not be immediately deleted, but the operation will
    /// still be replicated via Raft. This is used to notify TiKV that the data
    /// will be deleted using `unsafe_destroy_range` soon.
    #[prost(bool, tag = "4")]
    pub notify_only: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRangeResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
/// Preparing the flashback for a region/key range will "lock" the region
/// so that there is no any read, write or schedule operation could be proposed before
/// the actual flashback operation.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareFlashbackToVersionRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    /// The `start_ts` which we will use to write a lock to prevent
    /// the `resolved_ts` from advancing during the whole process.
    #[prost(uint64, tag = "4")]
    pub start_ts: u64,
    /// The TS version which the data will flashback to later.
    #[prost(uint64, tag = "5")]
    pub version: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrepareFlashbackToVersionResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
/// Flashback the region to a specific point with the given `version`, please
/// make sure the region is "locked" by `PrepareFlashbackToVersionRequest` first,
/// otherwise this request will fail.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlashbackToVersionRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// The TS version which the data should flashback to.
    #[prost(uint64, tag = "2")]
    pub version: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "4")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    /// The `start_ts` and `commit_ts` which the newly written MVCC version will use.
    /// Please make sure the `start_ts` is the same one in `PrepareFlashbackToVersionRequest`.
    #[prost(uint64, tag = "5")]
    pub start_ts: u64,
    #[prost(uint64, tag = "6")]
    pub commit_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FlashbackToVersionResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawGetRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawGetResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    #[prost(bool, tag = "4")]
    pub not_found: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchGetRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchGetResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub pairs: ::prost::alloc::vec::Vec<KvPair>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawPutRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "4")]
    pub cf: ::prost::alloc::string::String,
    #[prost(uint64, tag = "5")]
    pub ttl: u64,
    #[prost(bool, tag = "6")]
    pub for_cas: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawPutResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchPutRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(message, repeated, tag = "2")]
    pub pairs: ::prost::alloc::vec::Vec<KvPair>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
    #[deprecated]
    #[prost(uint64, tag = "4")]
    pub ttl: u64,
    #[prost(bool, tag = "5")]
    pub for_cas: bool,
    /// The time-to-live for each keys in seconds, and if the length of `ttls`
    /// is exactly one, the ttl will be applied to all keys. Otherwise, the length
    /// mismatch between `ttls` and `pairs` will return an error.
    #[prost(uint64, repeated, tag = "6")]
    pub ttls: ::prost::alloc::vec::Vec<u64>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchPutResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawDeleteRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
    #[prost(bool, tag = "4")]
    pub for_cas: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawDeleteResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchDeleteRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", repeated, tag = "2")]
    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
    #[prost(bool, tag = "4")]
    pub for_cas: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchDeleteResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawScanRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint32, tag = "3")]
    pub limit: u32,
    #[prost(bool, tag = "4")]
    pub key_only: bool,
    #[prost(string, tag = "5")]
    pub cf: ::prost::alloc::string::String,
    #[prost(bool, tag = "6")]
    pub reverse: bool,
    /// For compatibility, when scanning forward, the range to scan is \[start_key, end_key), where start_key \< end_key;
    /// and when scanning backward, it scans \[end_key, start_key) in descending order, where end_key \< start_key.
    #[prost(bytes = "vec", tag = "7")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawScanResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub kvs: ::prost::alloc::vec::Vec<KvPair>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawDeleteRangeRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "4")]
    pub cf: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawDeleteRangeResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchScanRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// scanning range
    #[prost(message, repeated, tag = "2")]
    pub ranges: ::prost::alloc::vec::Vec<KeyRange>,
    /// max number of returning kv pairs for each scanning range
    #[prost(uint32, tag = "3")]
    pub each_limit: u32,
    #[prost(bool, tag = "4")]
    pub key_only: bool,
    #[prost(string, tag = "5")]
    pub cf: ::prost::alloc::string::String,
    #[prost(bool, tag = "6")]
    pub reverse: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawBatchScanResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(message, repeated, tag = "2")]
    pub kvs: ::prost::alloc::vec::Vec<KvPair>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnsafeDestroyRangeRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnsafeDestroyRangeResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterLockObserverRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub max_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterLockObserverResponse {
    #[prost(string, tag = "1")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckLockObserverRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub max_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckLockObserverResponse {
    #[prost(string, tag = "1")]
    pub error: ::prost::alloc::string::String,
    #[prost(bool, tag = "2")]
    pub is_clean: bool,
    #[prost(message, repeated, tag = "3")]
    pub locks: ::prost::alloc::vec::Vec<LockInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveLockObserverRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub max_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveLockObserverResponse {
    #[prost(string, tag = "1")]
    pub error: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PhysicalScanLockRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub max_ts: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint32, tag = "4")]
    pub limit: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PhysicalScanLockResponse {
    #[prost(string, tag = "1")]
    pub error: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "2")]
    pub locks: ::prost::alloc::vec::Vec<LockInfo>,
}
/// Sent from PD to a TiKV node.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitRegionRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[deprecated]
    #[prost(bytes = "vec", tag = "2")]
    pub split_key: ::prost::alloc::vec::Vec<u8>,
    /// when use it to do batch split, `split_key` should be empty.
    #[prost(bytes = "vec", repeated, tag = "3")]
    pub split_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// Once enabled, the split_key will not be encoded.
    #[prost(bool, tag = "4")]
    pub is_raw_kv: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SplitRegionResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    /// set when there are only 2 result regions.
    #[deprecated]
    #[prost(message, optional, tag = "2")]
    pub left: ::core::option::Option<super::metapb::Region>,
    /// set when there are only 2 result regions.
    #[deprecated]
    #[prost(message, optional, tag = "3")]
    pub right: ::core::option::Option<super::metapb::Region>,
    /// include all result regions.
    #[prost(message, repeated, tag = "4")]
    pub regions: ::prost::alloc::vec::Vec<super::metapb::Region>,
}
/// Sent from TiFlash to a TiKV node.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadIndexRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    /// TiKV checks the given range if there is any unapplied lock
    /// blocking the read request.
    #[prost(uint64, tag = "2")]
    pub start_ts: u64,
    #[prost(message, repeated, tag = "3")]
    pub ranges: ::prost::alloc::vec::Vec<KeyRange>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadIndexResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(uint64, tag = "2")]
    pub read_index: u64,
    /// If `locked` is set, this read request is blocked by a lock.
    /// The lock should be returned to the client.
    #[prost(message, optional, tag = "3")]
    pub locked: ::core::option::Option<LockInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccGetByKeyRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccGetByKeyResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "3")]
    pub info: ::core::option::Option<MvccInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccGetByStartTsRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(uint64, tag = "2")]
    pub start_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccGetByStartTsResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "3")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(message, optional, tag = "4")]
    pub info: ::core::option::Option<MvccInfo>,
}
/// Miscellaneous metadata attached to most requests.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Context {
    #[prost(uint64, tag = "1")]
    pub region_id: u64,
    #[prost(message, optional, tag = "2")]
    pub region_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    #[prost(message, optional, tag = "3")]
    pub peer: ::core::option::Option<super::metapb::Peer>,
    #[prost(uint64, tag = "5")]
    pub term: u64,
    #[prost(enumeration = "CommandPri", tag = "6")]
    pub priority: i32,
    #[prost(enumeration = "IsolationLevel", tag = "7")]
    pub isolation_level: i32,
    #[prost(bool, tag = "8")]
    pub not_fill_cache: bool,
    #[prost(bool, tag = "9")]
    pub sync_log: bool,
    /// True means execution time statistics should be recorded and returned.
    #[prost(bool, tag = "10")]
    pub record_time_stat: bool,
    /// True means RocksDB scan statistics should be recorded and returned.
    #[prost(bool, tag = "11")]
    pub record_scan_stat: bool,
    #[prost(bool, tag = "12")]
    pub replica_read: bool,
    /// Read requests can ignore locks belonging to these transactions because either
    /// these transactions are rolled back or theirs commit_ts > read request's start_ts.
    #[prost(uint64, repeated, tag = "13")]
    pub resolved_locks: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint64, tag = "14")]
    pub max_execution_duration_ms: u64,
    /// After a region applies to `applied_index`, we can get a
    /// snapshot for the region even if the peer is a follower.
    #[prost(uint64, tag = "15")]
    pub applied_index: u64,
    /// A hint for TiKV to schedule tasks more fairly. Query with same task ID
    /// may share same priority and resource quota.
    #[prost(uint64, tag = "16")]
    pub task_id: u64,
    /// Not required to read the most up-to-date data, replicas with `safe_ts` >= `start_ts`
    /// can handle read request directly
    #[prost(bool, tag = "17")]
    pub stale_read: bool,
    /// Any additional serialized information about the request.
    #[prost(bytes = "vec", tag = "18")]
    pub resource_group_tag: ::prost::alloc::vec::Vec<u8>,
    /// Used to tell TiKV whether operations are allowed or not on different disk usages.
    #[prost(enumeration = "DiskFullOpt", tag = "19")]
    pub disk_full_opt: i32,
    /// Indicates the request is a retry request and the same request may have been sent before.
    #[prost(bool, tag = "20")]
    pub is_retry_request: bool,
    /// API version implies the encode of the key and value.
    #[prost(enumeration = "ApiVersion", tag = "21")]
    pub api_version: i32,
    /// Read request should read through locks belonging to these transactions because these
    /// transactions are committed and theirs commit_ts \<= read request's start_ts.
    #[prost(uint64, repeated, tag = "22")]
    pub committed_locks: ::prost::alloc::vec::Vec<u64>,
    /// The informantion to trace a request sent to TiKV.
    #[prost(message, optional, tag = "23")]
    pub trace_context: ::core::option::Option<super::tracepb::TraceContext>,
    /// The source of the request, will be used as the tag of the metrics reporting.
    /// This field can be set for any requests that require to report metrics with any extra labels.
    #[prost(string, tag = "24")]
    pub request_source: ::prost::alloc::string::String,
    /// The source of the current transaction.
    #[prost(uint64, tag = "25")]
    pub txn_source: u64,
    /// If `busy_threshold_ms` is given, TiKV can reject the request and return a `ServerIsBusy`
    /// error before processing if the estimated waiting duration exceeds the threshold.
    #[prost(uint32, tag = "27")]
    pub busy_threshold_ms: u32,
    /// Some information used for resource control.
    #[prost(message, optional, tag = "28")]
    pub resource_control_context: ::core::option::Option<ResourceControlContext>,
    /// The keyspace that the request is sent to.
    /// NOTE: This field is only meaningful while the api_version is V2.
    #[prost(uint32, tag = "32")]
    pub keyspace_id: u32,
    /// The buckets version that the request is sent to.
    /// NOTE: This field is only meaningful while enable buckets.
    #[prost(uint64, tag = "33")]
    pub buckets_version: u64,
    /// It tells us where the request comes from in TiDB. If it isn't from TiDB, leave it blank.
    /// This is for tests only and thus can be safely changed/removed without affecting compatibility.
    #[prost(message, optional, tag = "34")]
    pub source_stmt: ::core::option::Option<SourceStmt>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceControlContext {
    /// It's used to identify which resource group the request belongs to.
    #[prost(string, tag = "1")]
    pub resource_group_name: ::prost::alloc::string::String,
    /// The resource consumption of the resource group that have completed at all TiKVs between the previous request to this TiKV and current request.
    /// It's used as penalty to make the local resource scheduling on one TiKV takes the gloabl resource consumption into consideration.
    #[prost(message, optional, tag = "2")]
    pub penalty: ::core::option::Option<super::resource_manager::Consumption>,
    /// This priority would override the original priority of the resource group for the request.
    /// Used to deprioritize the runaway queries.
    #[prost(uint64, tag = "3")]
    pub override_priority: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SourceStmt {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(uint64, tag = "2")]
    pub connection_id: u64,
    #[prost(uint64, tag = "3")]
    pub stmt_id: u64,
    /// session alias set by user
    #[prost(string, tag = "4")]
    pub session_alias: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LockInfo {
    #[prost(bytes = "vec", tag = "1")]
    pub primary_lock: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "2")]
    pub lock_version: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "4")]
    pub lock_ttl: u64,
    /// How many keys this transaction involves in this region.
    #[prost(uint64, tag = "5")]
    pub txn_size: u64,
    #[prost(enumeration = "Op", tag = "6")]
    pub lock_type: i32,
    #[prost(uint64, tag = "7")]
    pub lock_for_update_ts: u64,
    /// Fields for transactions that are using Async Commit.
    #[prost(bool, tag = "8")]
    pub use_async_commit: bool,
    #[prost(uint64, tag = "9")]
    pub min_commit_ts: u64,
    #[prost(bytes = "vec", repeated, tag = "10")]
    pub secondaries: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    /// The time elapsed since last update of lock wait info when waiting.
    /// It's used in timeout errors. 0 means unknown or not applicable.
    /// It can be used to help the client decide whether to try resolving the lock.
    #[prost(uint64, tag = "11")]
    pub duration_to_last_update_ms: u64,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyError {
    /// Client should backoff or cleanup the lock then retry.
    #[prost(message, optional, tag = "1")]
    pub locked: ::core::option::Option<LockInfo>,
    /// Client may restart the txn. e.g write conflict.
    #[prost(string, tag = "2")]
    pub retryable: ::prost::alloc::string::String,
    /// Client should abort the txn.
    #[prost(string, tag = "3")]
    pub abort: ::prost::alloc::string::String,
    /// Write conflict is moved from retryable to here.
    #[prost(message, optional, tag = "4")]
    pub conflict: ::core::option::Option<WriteConflict>,
    /// Key already exists
    #[prost(message, optional, tag = "5")]
    pub already_exist: ::core::option::Option<AlreadyExist>,
    /// Deadlock is used in pessimistic transaction for single statement rollback.
    #[prost(message, optional, tag = "6")]
    pub deadlock: ::core::option::Option<Deadlock>,
    /// Commit ts is earlier than min commit ts of a transaction.
    #[prost(message, optional, tag = "7")]
    pub commit_ts_expired: ::core::option::Option<CommitTsExpired>,
    /// Txn not found when checking txn status.
    #[prost(message, optional, tag = "8")]
    pub txn_not_found: ::core::option::Option<TxnNotFound>,
    /// Calculated commit TS exceeds the limit given by the user.
    #[prost(message, optional, tag = "9")]
    pub commit_ts_too_large: ::core::option::Option<CommitTsTooLarge>,
    /// Assertion of a `Mutation` is evaluated as a failure.
    #[prost(message, optional, tag = "10")]
    pub assertion_failed: ::core::option::Option<AssertionFailed>,
    /// CheckTxnStatus is sent to a lock that's not the primary.
    #[prost(message, optional, tag = "11")]
    pub primary_mismatch: ::core::option::Option<PrimaryMismatch>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteConflict {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(uint64, tag = "2")]
    pub conflict_ts: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "4")]
    pub primary: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "5")]
    pub conflict_commit_ts: u64,
    #[prost(enumeration = "write_conflict::Reason", tag = "6")]
    pub reason: i32,
}
/// Nested message and enum types in `WriteConflict`.
pub mod write_conflict {
    #[derive(
        Clone,
        Copy,
        Debug,
        PartialEq,
        Eq,
        Hash,
        PartialOrd,
        Ord,
        ::prost::Enumeration
    )]
    #[repr(i32)]
    pub enum Reason {
        Unknown = 0,
        /// in optimistic transactions.
        Optimistic = 1,
        /// a lock acquisition request waits for a lock and awakes, or meets a newer version of data, let TiDB retry.
        PessimisticRetry = 2,
        /// the transaction itself has been rolled back when it tries to prewrite.
        SelfRolledBack = 3,
        /// RcCheckTs failure by meeting a newer version, let TiDB retry.
        RcCheckTs = 4,
        /// write conflict found in lazy uniqueness check in pessimistic transactions.
        LazyUniquenessCheck = 5,
    }
    impl Reason {
        /// 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 {
                Reason::Unknown => "Unknown",
                Reason::Optimistic => "Optimistic",
                Reason::PessimisticRetry => "PessimisticRetry",
                Reason::SelfRolledBack => "SelfRolledBack",
                Reason::RcCheckTs => "RcCheckTs",
                Reason::LazyUniquenessCheck => "LazyUniquenessCheck",
            }
        }
        /// Creates an enum from field names used in the ProtoBuf definition.
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "Unknown" => Some(Self::Unknown),
                "Optimistic" => Some(Self::Optimistic),
                "PessimisticRetry" => Some(Self::PessimisticRetry),
                "SelfRolledBack" => Some(Self::SelfRolledBack),
                "RcCheckTs" => Some(Self::RcCheckTs),
                "LazyUniquenessCheck" => Some(Self::LazyUniquenessCheck),
                _ => None,
            }
        }
    }
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlreadyExist {
    #[prost(bytes = "vec", tag = "1")]
    pub key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Deadlock {
    #[prost(uint64, tag = "1")]
    pub lock_ts: u64,
    #[prost(bytes = "vec", tag = "2")]
    pub lock_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "3")]
    pub deadlock_key_hash: u64,
    #[prost(message, repeated, tag = "4")]
    pub wait_chain: ::prost::alloc::vec::Vec<super::deadlock::WaitForEntry>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitTsExpired {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(uint64, tag = "2")]
    pub attempted_commit_ts: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "4")]
    pub min_commit_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnNotFound {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(bytes = "vec", tag = "2")]
    pub primary_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommitTsTooLarge {
    /// The calculated commit TS.
    #[prost(uint64, tag = "1")]
    pub commit_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AssertionFailed {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "Assertion", tag = "3")]
    pub assertion: i32,
    #[prost(uint64, tag = "4")]
    pub existing_start_ts: u64,
    #[prost(uint64, tag = "5")]
    pub existing_commit_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrimaryMismatch {
    #[prost(message, optional, tag = "1")]
    pub lock_info: ::core::option::Option<LockInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimeDetail {
    /// Off-cpu wall time elapsed in TiKV side. Usually this includes queue waiting time and
    /// other kind of waitings in series. (Wait time in the raftstore is not included.)
    #[prost(uint64, tag = "1")]
    pub wait_wall_time_ms: u64,
    /// Off-cpu and on-cpu wall time elapsed to actually process the request payload. It does not
    /// include `wait_wall_time`.
    /// This field is very close to the CPU time in most cases. Some wait time spend in RocksDB
    /// cannot be excluded for now, like Mutex wait time, which is included in this field, so that
    /// this field is called wall time instead of CPU time.
    #[prost(uint64, tag = "2")]
    pub process_wall_time_ms: u64,
    /// KV read wall Time means the time used in key/value scan and get.
    #[prost(uint64, tag = "3")]
    pub kv_read_wall_time_ms: u64,
    /// Total wall clock time spent on this RPC in TiKV .
    #[prost(uint64, tag = "4")]
    pub total_rpc_wall_time_ns: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TimeDetailV2 {
    /// Off-cpu wall time elapsed in TiKV side. Usually this includes queue waiting time and
    /// other kind of waitings in series. (Wait time in the raftstore is not included.)
    #[prost(uint64, tag = "1")]
    pub wait_wall_time_ns: u64,
    /// Off-cpu and on-cpu wall time elapsed to actually process the request payload. It does not
    /// include `wait_wall_time` and `suspend_wall_time`.
    /// This field is very close to the CPU time in most cases. Some wait time spend in RocksDB
    /// cannot be excluded for now, like Mutex wait time, which is included in this field, so that
    /// this field is called wall time instead of CPU time.
    #[prost(uint64, tag = "2")]
    pub process_wall_time_ns: u64,
    /// Cpu wall time elapsed that task is waiting in queue.
    #[prost(uint64, tag = "3")]
    pub process_suspend_wall_time_ns: u64,
    /// KV read wall Time means the time used in key/value scan and get.
    #[prost(uint64, tag = "4")]
    pub kv_read_wall_time_ns: u64,
    /// Total wall clock time spent on this RPC in TiKV .
    #[prost(uint64, tag = "5")]
    pub total_rpc_wall_time_ns: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanInfo {
    #[prost(int64, tag = "1")]
    pub total: i64,
    #[prost(int64, tag = "2")]
    pub processed: i64,
    #[prost(int64, tag = "3")]
    pub read_bytes: i64,
}
/// Only reserved for compatibility.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanDetail {
    #[prost(message, optional, tag = "1")]
    pub write: ::core::option::Option<ScanInfo>,
    #[prost(message, optional, tag = "2")]
    pub lock: ::core::option::Option<ScanInfo>,
    #[prost(message, optional, tag = "3")]
    pub data: ::core::option::Option<ScanInfo>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScanDetailV2 {
    /// Number of user keys scanned from the storage.
    /// It does not include deleted version or RocksDB tombstone keys.
    /// For Coprocessor requests, it includes keys that has been filtered out by
    /// Selection.
    #[prost(uint64, tag = "1")]
    pub processed_versions: u64,
    /// Number of bytes of user key-value pairs scanned from the storage, i.e.
    /// total size of data returned from MVCC layer.
    #[prost(uint64, tag = "8")]
    pub processed_versions_size: u64,
    /// Approximate number of MVCC keys meet during scanning. It includes
    /// deleted versions, but does not include RocksDB tombstone keys.
    ///
    /// When this field is notably larger than `processed_versions`, it means
    /// there are a lot of deleted MVCC keys.
    #[prost(uint64, tag = "2")]
    pub total_versions: u64,
    /// Total number of deletes and single deletes skipped over during
    /// iteration, i.e. how many RocksDB tombstones are skipped.
    #[prost(uint64, tag = "3")]
    pub rocksdb_delete_skipped_count: u64,
    /// Total number of internal keys skipped over during iteration.
    /// See <https://github.com/facebook/rocksdb/blob/9f1c84ca471d8b1ad7be9f3eebfc2c7e07dfd7a7/include/rocksdb/perf_context.h#L84> for details.
    #[prost(uint64, tag = "4")]
    pub rocksdb_key_skipped_count: u64,
    /// Total number of RocksDB block cache hits.
    #[prost(uint64, tag = "5")]
    pub rocksdb_block_cache_hit_count: u64,
    /// Total number of block reads (with IO).
    #[prost(uint64, tag = "6")]
    pub rocksdb_block_read_count: u64,
    /// Total number of bytes from block reads.
    #[prost(uint64, tag = "7")]
    pub rocksdb_block_read_byte: u64,
    /// Total time used for block reads.
    #[prost(uint64, tag = "9")]
    pub rocksdb_block_read_nanos: u64,
    /// Time used for getting a raftstore snapshot (including proposing read index, leader confirmation and getting the RocksDB snapshot).
    #[prost(uint64, tag = "10")]
    pub get_snapshot_nanos: u64,
    /// Time used for proposing read index from read pool to store pool, equals 0 when performing lease read.
    #[prost(uint64, tag = "11")]
    pub read_index_propose_wait_nanos: u64,
    /// Time used for leader confirmation, equals 0 when performing lease read.
    #[prost(uint64, tag = "12")]
    pub read_index_confirm_wait_nanos: u64,
    /// Time used for read pool scheduling.
    #[prost(uint64, tag = "13")]
    pub read_pool_schedule_wait_nanos: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecDetails {
    /// Available when ctx.record_time_stat = true or meet slow query.
    #[prost(message, optional, tag = "1")]
    pub time_detail: ::core::option::Option<TimeDetail>,
    /// Available when ctx.record_scan_stat = true or meet slow query.
    #[prost(message, optional, tag = "2")]
    pub scan_detail: ::core::option::Option<ScanDetail>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecDetailsV2 {
    /// Available when ctx.record_time_stat = true or meet slow query.
    /// deprecated. Should use `time_detail_v2` instead.
    #[prost(message, optional, tag = "1")]
    pub time_detail: ::core::option::Option<TimeDetail>,
    /// Available when ctx.record_scan_stat = true or meet slow query.
    #[prost(message, optional, tag = "2")]
    pub scan_detail_v2: ::core::option::Option<ScanDetailV2>,
    /// Raftstore writing durations of the request. Only available for some write requests.
    #[prost(message, optional, tag = "3")]
    pub write_detail: ::core::option::Option<WriteDetail>,
    /// Available when ctx.record_time_stat = true or meet slow query.
    #[prost(message, optional, tag = "4")]
    pub time_detail_v2: ::core::option::Option<TimeDetailV2>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteDetail {
    /// Wait duration in the store loop.
    #[prost(uint64, tag = "1")]
    pub store_batch_wait_nanos: u64,
    /// Wait duration before sending proposal to peers.
    #[prost(uint64, tag = "2")]
    pub propose_send_wait_nanos: u64,
    /// Total time spent on persisting the log.
    #[prost(uint64, tag = "3")]
    pub persist_log_nanos: u64,
    /// Wait time until the Raft log write leader begins to write.
    #[prost(uint64, tag = "4")]
    pub raft_db_write_leader_wait_nanos: u64,
    /// Time spent on synchronizing the Raft log to the disk.
    #[prost(uint64, tag = "5")]
    pub raft_db_sync_log_nanos: u64,
    /// Time spent on writing the Raft log to the Raft memtable.
    #[prost(uint64, tag = "6")]
    pub raft_db_write_memtable_nanos: u64,
    /// Time waiting for peers to confirm the proposal (counting from the instant when the leader sends the proposal message).
    #[prost(uint64, tag = "7")]
    pub commit_log_nanos: u64,
    /// Wait duration in the apply loop.
    #[prost(uint64, tag = "8")]
    pub apply_batch_wait_nanos: u64,
    /// Total time spend to applying the log.
    #[prost(uint64, tag = "9")]
    pub apply_log_nanos: u64,
    /// Wait time until the KV RocksDB lock is acquired.
    #[prost(uint64, tag = "10")]
    pub apply_mutex_lock_nanos: u64,
    /// Wait time until becoming the KV RocksDB write leader.
    #[prost(uint64, tag = "11")]
    pub apply_write_leader_wait_nanos: u64,
    /// Time spent on writing the KV DB WAL to the disk.
    #[prost(uint64, tag = "12")]
    pub apply_write_wal_nanos: u64,
    /// Time spent on writing to the memtable of the KV RocksDB.
    #[prost(uint64, tag = "13")]
    pub apply_write_memtable_nanos: u64,
    /// Time spent on waiting in the latch.
    #[prost(uint64, tag = "14")]
    pub latch_wait_nanos: u64,
    /// Processing time in the transaction layer.
    #[prost(uint64, tag = "15")]
    pub process_nanos: u64,
    /// Wait time because of the scheduler flow control or quota limiter throttling.
    #[prost(uint64, tag = "16")]
    pub throttle_nanos: u64,
    /// Wait time in the waiter manager for pessimistic locking.
    #[prost(uint64, tag = "17")]
    pub pessimistic_lock_wait_nanos: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KvPair {
    #[prost(message, optional, tag = "1")]
    pub error: ::core::option::Option<KeyError>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Mutation {
    #[prost(enumeration = "Op", tag = "1")]
    pub op: i32,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    #[prost(enumeration = "Assertion", tag = "4")]
    pub assertion: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccWrite {
    #[prost(enumeration = "Op", tag = "1")]
    pub r#type: i32,
    #[prost(uint64, tag = "2")]
    pub start_ts: u64,
    #[prost(uint64, tag = "3")]
    pub commit_ts: u64,
    #[prost(bytes = "vec", tag = "4")]
    pub short_value: ::prost::alloc::vec::Vec<u8>,
    #[prost(bool, tag = "5")]
    pub has_overlapped_rollback: bool,
    #[prost(bool, tag = "6")]
    pub has_gc_fence: bool,
    #[prost(uint64, tag = "7")]
    pub gc_fence: u64,
    #[prost(uint64, tag = "8")]
    pub last_change_ts: u64,
    #[prost(uint64, tag = "9")]
    pub versions_to_last_change: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccValue {
    #[prost(uint64, tag = "1")]
    pub start_ts: u64,
    #[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 MvccLock {
    #[prost(enumeration = "Op", tag = "1")]
    pub r#type: i32,
    #[prost(uint64, tag = "2")]
    pub start_ts: u64,
    #[prost(bytes = "vec", tag = "3")]
    pub primary: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "4")]
    pub short_value: ::prost::alloc::vec::Vec<u8>,
    #[prost(uint64, tag = "5")]
    pub ttl: u64,
    #[prost(uint64, tag = "6")]
    pub for_update_ts: u64,
    #[prost(uint64, tag = "7")]
    pub txn_size: u64,
    #[prost(bool, tag = "8")]
    pub use_async_commit: bool,
    #[prost(bytes = "vec", repeated, tag = "9")]
    pub secondaries: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
    #[prost(uint64, repeated, tag = "10")]
    pub rollback_ts: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint64, tag = "11")]
    pub last_change_ts: u64,
    #[prost(uint64, tag = "12")]
    pub versions_to_last_change: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MvccInfo {
    #[prost(message, optional, tag = "1")]
    pub lock: ::core::option::Option<MvccLock>,
    #[prost(message, repeated, tag = "2")]
    pub writes: ::prost::alloc::vec::Vec<MvccWrite>,
    #[prost(message, repeated, tag = "3")]
    pub values: ::prost::alloc::vec::Vec<MvccValue>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnInfo {
    #[prost(uint64, tag = "1")]
    pub txn: u64,
    #[prost(uint64, tag = "2")]
    pub status: u64,
    /// Reserved for file based transaction.
    #[prost(bool, tag = "100")]
    pub is_txn_file: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyRange {
    #[prost(bytes = "vec", tag = "1")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "2")]
    pub end_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeaderInfo {
    #[prost(uint64, tag = "1")]
    pub region_id: u64,
    #[prost(uint64, tag = "2")]
    pub peer_id: u64,
    #[prost(uint64, tag = "3")]
    pub term: u64,
    #[prost(message, optional, tag = "4")]
    pub region_epoch: ::core::option::Option<super::metapb::RegionEpoch>,
    #[prost(message, optional, tag = "5")]
    pub read_state: ::core::option::Option<ReadState>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadState {
    #[prost(uint64, tag = "1")]
    pub applied_index: u64,
    #[prost(uint64, tag = "2")]
    pub safe_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckLeaderRequest {
    #[prost(message, repeated, tag = "1")]
    pub regions: ::prost::alloc::vec::Vec<LeaderInfo>,
    #[prost(uint64, tag = "2")]
    pub ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckLeaderResponse {
    #[prost(uint64, repeated, tag = "1")]
    pub regions: ::prost::alloc::vec::Vec<u64>,
    #[prost(uint64, tag = "2")]
    pub ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreSafeTsRequest {
    /// Get the minimal `safe_ts` from regions that overlap with the key range \[`start_key`, `end_key`)
    /// An empty key range means all regions in the store
    #[prost(message, optional, tag = "1")]
    pub key_range: ::core::option::Option<KeyRange>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreSafeTsResponse {
    #[prost(uint64, tag = "1")]
    pub safe_ts: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawGetKeyTtlRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "3")]
    pub cf: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawGetKeyTtlResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(uint64, tag = "3")]
    pub ttl: u64,
    #[prost(bool, tag = "4")]
    pub not_found: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawCasRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(bytes = "vec", tag = "2")]
    pub key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "3")]
    pub value: ::prost::alloc::vec::Vec<u8>,
    #[prost(bool, tag = "4")]
    pub previous_not_exist: bool,
    #[prost(bytes = "vec", tag = "5")]
    pub previous_value: ::prost::alloc::vec::Vec<u8>,
    #[prost(string, tag = "6")]
    pub cf: ::prost::alloc::string::String,
    #[prost(uint64, tag = "7")]
    pub ttl: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawCasResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(bool, tag = "3")]
    pub succeed: bool,
    /// The previous value regardless of whether the comparison is succeed.
    #[prost(bool, tag = "4")]
    pub previous_not_exist: bool,
    #[prost(bytes = "vec", tag = "5")]
    pub previous_value: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLockWaitInfoRequest {
    /// TODO: There may need some filter options to be used on conditional querying, e.g., finding
    /// the lock waiting status for some specified transaction.
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLockWaitInfoResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "3")]
    pub entries: ::prost::alloc::vec::Vec<super::deadlock::WaitForEntry>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLockWaitHistoryRequest {
    /// TODO: There may need some filter options to be used on conditional querying, e.g., finding
    /// the lock waiting status for some specified transaction.
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetLockWaitHistoryResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "3")]
    pub entries: ::prost::alloc::vec::Vec<super::deadlock::WaitForEntry>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawCoprocessorRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(string, tag = "2")]
    pub copr_name: ::prost::alloc::string::String,
    /// Coprorcessor version constraint following SEMVER definition.
    #[prost(string, tag = "3")]
    pub copr_version_req: ::prost::alloc::string::String,
    #[prost(message, repeated, tag = "4")]
    pub ranges: ::prost::alloc::vec::Vec<KeyRange>,
    #[prost(bytes = "vec", tag = "5")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawCoprocessorResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    /// Error message for cases like if no coprocessor with a matching name is found
    /// or on a version mismatch between plugin_api and the coprocessor.
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(bytes = "vec", tag = "3")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawChecksumRequest {
    #[prost(message, optional, tag = "1")]
    pub context: ::core::option::Option<Context>,
    #[prost(enumeration = "ChecksumAlgorithm", tag = "2")]
    pub algorithm: i32,
    #[prost(message, repeated, tag = "3")]
    pub ranges: ::prost::alloc::vec::Vec<KeyRange>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RawChecksumResponse {
    #[prost(message, optional, tag = "1")]
    pub region_error: ::core::option::Option<super::errorpb::Error>,
    #[prost(string, tag = "2")]
    pub error: ::prost::alloc::string::String,
    #[prost(uint64, tag = "3")]
    pub checksum: u64,
    #[prost(uint64, tag = "4")]
    pub total_kvs: u64,
    #[prost(uint64, tag = "5")]
    pub total_bytes: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactError {
    #[prost(oneof = "compact_error::Error", tags = "1, 2, 3, 4")]
    pub error: ::core::option::Option<compact_error::Error>,
}
/// Nested message and enum types in `CompactError`.
pub mod compact_error {
    #[allow(clippy::derive_partial_eq_without_eq)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Error {
        #[prost(message, tag = "1")]
        ErrInvalidStartKey(super::CompactErrorInvalidStartKey),
        #[prost(message, tag = "2")]
        ErrPhysicalTableNotExist(super::CompactErrorPhysicalTableNotExist),
        #[prost(message, tag = "3")]
        ErrCompactInProgress(super::CompactErrorCompactInProgress),
        #[prost(message, tag = "4")]
        ErrTooManyPendingTasks(super::CompactErrorTooManyPendingTasks),
    }
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactErrorInvalidStartKey {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactErrorPhysicalTableNotExist {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactErrorCompactInProgress {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactErrorTooManyPendingTasks {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactRequest {
    /// If specified, the compaction will start from this start key.
    /// If unspecified, the compaction will start from beginning.
    /// NOTE 1: The start key should be never manually constructed. You should always use a key
    /// returned in CompactResponse.
    /// NOTE 2: the compaction range will be always restricted by physical_table_id.
    #[prost(bytes = "vec", tag = "1")]
    pub start_key: ::prost::alloc::vec::Vec<u8>,
    /// The physical table that will be compacted.
    ///
    /// TODO: this is information that TiKV doesn't need to know.
    /// See <https://github.com/pingcap/kvproto/issues/912>
    #[prost(int64, tag = "2")]
    pub physical_table_id: i64,
    /// The logical table id of the compaction. When receiving parallel requests with the same
    /// logical table id, err_compact_in_progress will be returned.
    ///
    /// TODO: this is information that TiKV doesn't need to know.
    /// See <https://github.com/pingcap/kvproto/issues/912>
    #[prost(int64, tag = "3")]
    pub logical_table_id: i64,
    /// API version of the request
    #[prost(enumeration = "ApiVersion", tag = "7")]
    pub api_version: i32,
    /// Keyspace of the table located in.
    #[prost(uint32, tag = "8")]
    pub keyspace_id: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactResponse {
    #[prost(message, optional, tag = "1")]
    pub error: ::core::option::Option<CompactError>,
    /// The compaction is done incrementally. If there are more data to compact, this field
    /// will be set. The client can request to compact more data according to the `compacted_end_key`.
    #[prost(bool, tag = "2")]
    pub has_remaining: bool,
    #[prost(bytes = "vec", tag = "3")]
    pub compacted_start_key: ::prost::alloc::vec::Vec<u8>,
    #[prost(bytes = "vec", tag = "4")]
    pub compacted_end_key: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TiFlashSystemTableRequest {
    #[prost(string, tag = "1")]
    pub sql: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TiFlashSystemTableResponse {
    #[prost(bytes = "vec", tag = "1")]
    pub data: ::prost::alloc::vec::Vec<u8>,
}
/// Used to specify the behavior when a pessimistic lock request is woken up after waiting for another
/// lock.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PessimisticLockWakeUpMode {
    /// When woken up, returns WriteConflict error to the client and the client should retry if necessary.
    /// In this mode, results of `return_values` or `check_existence` will be set to `values` and `not_founds`
    /// fields of the PessimisticLockResponse, which is compatible with old versions.
    WakeUpModeNormal = 0,
    /// When woken up, continue trying to lock the key. This implicitly enables the `allow_lock_with_conflict`
    /// behavior, which means, allow acquiring the lock even if there is WriteConflict on the key.
    /// In this mode, `return_values` or `check_existence` fields of PessimisticLockResponse won't be used, and
    /// all results are carried in the `results` field.
    WakeUpModeForceLock = 1,
}
impl PessimisticLockWakeUpMode {
    /// 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 {
            PessimisticLockWakeUpMode::WakeUpModeNormal => "WakeUpModeNormal",
            PessimisticLockWakeUpMode::WakeUpModeForceLock => "WakeUpModeForceLock",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "WakeUpModeNormal" => Some(Self::WakeUpModeNormal),
            "WakeUpModeForceLock" => Some(Self::WakeUpModeForceLock),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum PessimisticLockKeyResultType {
    LockResultNormal = 0,
    LockResultLockedWithConflict = 1,
    LockResultFailed = 2,
}
impl PessimisticLockKeyResultType {
    /// 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 {
            PessimisticLockKeyResultType::LockResultNormal => "LockResultNormal",
            PessimisticLockKeyResultType::LockResultLockedWithConflict => {
                "LockResultLockedWithConflict"
            }
            PessimisticLockKeyResultType::LockResultFailed => "LockResultFailed",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "LockResultNormal" => Some(Self::LockResultNormal),
            "LockResultLockedWithConflict" => Some(Self::LockResultLockedWithConflict),
            "LockResultFailed" => Some(Self::LockResultFailed),
            _ => None,
        }
    }
}
/// The API version the server and the client is using.
/// See more details in <https://github.com/tikv/rfcs/blob/master/text/0069-api-v2.md.>
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ApiVersion {
    /// `V1` is mainly for TiDB & TxnKV, and is not safe to use RawKV along with the others.
    /// V1 server only accepts V1 requests. V1 raw requests with TTL will be rejected.
    V1 = 0,
    /// ## `V1TTL` is only available to RawKV, and 8 bytes representing the unix timestamp in
    /// seconds for expiring time will be append to the value of all RawKV entries. For example:
    ///
    /// ## \| User value     | Expire Ts                               |
    ///
    /// ## \| 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff |
    ///
    /// V1TTL server only accepts V1 raw requests.
    /// V1 client should not use `V1TTL` in request. V1 client should always send `V1`.
    V1ttl = 1,
    /// `V2` use new encoding for RawKV & TxnKV to support more features.
    ///
    /// Key Encoding:
    /// TiDB: start with `m` or `t`, the same as `V1`.
    /// TxnKV: prefix with `x`, encoded as `MCE( x{keyspace id} + {user key} ) + timestamp`.
    /// RawKV: prefix with `r`, encoded as `MCE( r{keyspace id} + {user key} ) + timestamp`.
    /// Where the `{keyspace id}` is fixed-length of 3 bytes in network byte order.
    /// Besides, RawKV entires must be in `default` CF.
    ///
    /// ## Value Encoding:
    /// TiDB & TxnKV: the same as `V1`.
    /// RawKV: `{user value} + {optional fields} + {meta flag}`. The last byte in the
    /// raw value must be meta flags. For example:
    ///
    /// ## \| User value     | Meta flags        |
    ///
    /// ## \| 0x12 0x34 0x56 | 0x00 (0b00000000) |
    ///
    /// ## Bit 0 of meta flags is for TTL. If set, the value contains 8 bytes expiring time as
    /// unix timestamp in seconds at the very left to the meta flags.
    ///
    /// ## \| User value     | Expiring time                           | Meta flags        |
    ///
    /// ## \| 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff | 0x01 (0b00000001) |
    ///
    /// ## Bit 1 is for deletion. If set, the entry is logical deleted.
    ///
    /// |Meta flags|
    /// |----------|
    /// |0x02 (0b00000010)|
    ///
    /// ---
    ///
    /// V2 server accpets V2 requests and V1 transactional requests that statrts with TiDB key
    /// prefix (`m` and `t`).
    V2 = 2,
}
impl ApiVersion {
    /// 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 {
            ApiVersion::V1 => "V1",
            ApiVersion::V1ttl => "V1TTL",
            ApiVersion::V2 => "V2",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "V1" => Some(Self::V1),
            "V1TTL" => Some(Self::V1ttl),
            "V2" => Some(Self::V2),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CommandPri {
    /// Normal is the default value.
    Normal = 0,
    Low = 1,
    High = 2,
}
impl CommandPri {
    /// 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 {
            CommandPri::Normal => "Normal",
            CommandPri::Low => "Low",
            CommandPri::High => "High",
        }
    }
    /// 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),
            "Low" => Some(Self::Low),
            "High" => Some(Self::High),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum IsolationLevel {
    /// SI = snapshot isolation
    Si = 0,
    /// RC = read committed
    Rc = 1,
    /// RC read and it's needed to check if there exists more recent versions.
    RcCheckTs = 2,
}
impl IsolationLevel {
    /// 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 {
            IsolationLevel::Si => "SI",
            IsolationLevel::Rc => "RC",
            IsolationLevel::RcCheckTs => "RCCheckTS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SI" => Some(Self::Si),
            "RC" => Some(Self::Rc),
            "RCCheckTS" => Some(Self::RcCheckTs),
            _ => None,
        }
    }
}
/// Operation allowed info during each TiKV storage threshold.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DiskFullOpt {
    /// The default value, means operations are not allowed either under almost full or already full.
    NotAllowedOnFull = 0,
    /// Means operations will be allowed when disk is almost full.
    AllowedOnAlmostFull = 1,
    /// Means operations will be allowed when disk is already full.
    AllowedOnAlreadyFull = 2,
}
impl DiskFullOpt {
    /// 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 {
            DiskFullOpt::NotAllowedOnFull => "NotAllowedOnFull",
            DiskFullOpt::AllowedOnAlmostFull => "AllowedOnAlmostFull",
            DiskFullOpt::AllowedOnAlreadyFull => "AllowedOnAlreadyFull",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "NotAllowedOnFull" => Some(Self::NotAllowedOnFull),
            "AllowedOnAlmostFull" => Some(Self::AllowedOnAlmostFull),
            "AllowedOnAlreadyFull" => Some(Self::AllowedOnAlreadyFull),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Op {
    Put = 0,
    Del = 1,
    Lock = 2,
    Rollback = 3,
    /// insert operation has a constraint that key should not exist before.
    Insert = 4,
    PessimisticLock = 5,
    CheckNotExists = 6,
}
impl Op {
    /// 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 {
            Op::Put => "Put",
            Op::Del => "Del",
            Op::Lock => "Lock",
            Op::Rollback => "Rollback",
            Op::Insert => "Insert",
            Op::PessimisticLock => "PessimisticLock",
            Op::CheckNotExists => "CheckNotExists",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Put" => Some(Self::Put),
            "Del" => Some(Self::Del),
            "Lock" => Some(Self::Lock),
            "Rollback" => Some(Self::Rollback),
            "Insert" => Some(Self::Insert),
            "PessimisticLock" => Some(Self::PessimisticLock),
            "CheckNotExists" => Some(Self::CheckNotExists),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Assertion {
    None = 0,
    Exist = 1,
    NotExist = 2,
}
impl Assertion {
    /// 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 {
            Assertion::None => "None",
            Assertion::Exist => "Exist",
            Assertion::NotExist => "NotExist",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "None" => Some(Self::None),
            "Exist" => Some(Self::Exist),
            "NotExist" => Some(Self::NotExist),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AssertionLevel {
    /// No assertion.
    Off = 0,
    /// Assertion is enabled, but not enforced when it might affect performance.
    Fast = 1,
    /// Assertion is enabled and enforced.
    Strict = 2,
}
impl AssertionLevel {
    /// 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 {
            AssertionLevel::Off => "Off",
            AssertionLevel::Fast => "Fast",
            AssertionLevel::Strict => "Strict",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Off" => Some(Self::Off),
            "Fast" => Some(Self::Fast),
            "Strict" => Some(Self::Strict),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum Action {
    NoAction = 0,
    TtlExpireRollback = 1,
    LockNotExistRollback = 2,
    MinCommitTsPushed = 3,
    TtlExpirePessimisticRollback = 4,
    LockNotExistDoNothing = 5,
}
impl Action {
    /// 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 {
            Action::NoAction => "NoAction",
            Action::TtlExpireRollback => "TTLExpireRollback",
            Action::LockNotExistRollback => "LockNotExistRollback",
            Action::MinCommitTsPushed => "MinCommitTSPushed",
            Action::TtlExpirePessimisticRollback => "TTLExpirePessimisticRollback",
            Action::LockNotExistDoNothing => "LockNotExistDoNothing",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "NoAction" => Some(Self::NoAction),
            "TTLExpireRollback" => Some(Self::TtlExpireRollback),
            "LockNotExistRollback" => Some(Self::LockNotExistRollback),
            "MinCommitTSPushed" => Some(Self::MinCommitTsPushed),
            "TTLExpirePessimisticRollback" => Some(Self::TtlExpirePessimisticRollback),
            "LockNotExistDoNothing" => Some(Self::LockNotExistDoNothing),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ExtraOp {
    Noop = 0,
    /// ReadOldValue represents to output the previous value for delete/update operations.
    ReadOldValue = 1,
}
impl ExtraOp {
    /// 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 {
            ExtraOp::Noop => "Noop",
            ExtraOp::ReadOldValue => "ReadOldValue",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Noop" => Some(Self::Noop),
            "ReadOldValue" => Some(Self::ReadOldValue),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ChecksumAlgorithm {
    Crc64Xor = 0,
}
impl ChecksumAlgorithm {
    /// 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 {
            ChecksumAlgorithm::Crc64Xor => "Crc64_Xor",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "Crc64_Xor" => Some(Self::Crc64Xor),
            _ => None,
        }
    }
}