chore: Bump prost to 0.12 and tonic to 0.10 (#430)

* chore: Bump prost to 0.12 and tonic to 0.10

Signed-off-by: Xuanwo <github@xuanwo.io>

* Fix build

Signed-off-by: Xuanwo <github@xuanwo.io>

* Commit changes

Signed-off-by: Xuanwo <github@xuanwo.io>

---------

Signed-off-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
Xuanwo 2023-11-03 10:02:48 +08:00 committed by GitHub
parent a7885be25b
commit 802b361df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 224 additions and 224 deletions

View File

@ -34,7 +34,7 @@ lazy_static = "1"
log = "0.4" log = "0.4"
pin-project = "1" pin-project = "1"
prometheus = { version = "0.13", features = ["push"], default-features = false } prometheus = { version = "0.13", features = ["push"], default-features = false }
prost = "0.11" prost = "0.12"
rand = "0.8" rand = "0.8"
regex = "1" regex = "1"
semver = "1.0" semver = "1.0"
@ -42,7 +42,7 @@ serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
thiserror = "1" thiserror = "1"
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] } tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }
tonic = { version = "0.9", features = ["tls"] } tonic = { version = "0.10", features = ["tls"] }
[dev-dependencies] [dev-dependencies]
clap = "2" clap = "2"

View File

@ -12,6 +12,4 @@ edition = "2021"
[dependencies] [dependencies]
glob = "0.3" glob = "0.3"
tonic-build = "0.9" tonic-build = { version = "0.10", features = ["cleanup-markdown"] }
# Suppress doctest bug (https://stackoverflow.com/questions/66074003/how-to-turn-off-cargo-doc-test-and-compile-for-a-specific-module-in-rust)
tonic-disable-doctest = "0.1.0"

View File

@ -1,10 +1,7 @@
// Copyright 2023 TiKV Project Authors. Licensed under Apache-2.0. // Copyright 2023 TiKV Project Authors. Licensed under Apache-2.0.
fn main() { fn main() {
use tonic_disable_doctest::BuilderEx;
tonic_build::configure() tonic_build::configure()
.disable_doctests_for_types([".google.api.HttpRule"])
.emit_rerun_if_changed(false) .emit_rerun_if_changed(false)
.build_server(false) .build_server(false)
.include_file("mod.rs") .include_file("mod.rs")

View File

@ -25,7 +25,7 @@ pub struct BackupMeta {
/// For full backup, the start_version equals to the end_version, /// For full backup, the start_version equals to the end_version,
/// it means point in time. /// it means point in time.
/// For incremental backup, the time range is specified as /// For incremental backup, the time range is specified as
/// (start_version, end_version]. /// (start_version, end_version\].
#[prost(uint64, tag = "5")] #[prost(uint64, tag = "5")]
pub start_version: u64, pub start_version: u64,
#[prost(uint64, tag = "6")] #[prost(uint64, tag = "6")]
@ -50,7 +50,7 @@ pub struct BackupMeta {
#[prost(message, optional, tag = "15")] #[prost(message, optional, tag = "15")]
pub raw_range_index: ::core::option::Option<MetaFile>, pub raw_range_index: ::core::option::Option<MetaFile>,
/// In incremental backup, DDLs which are completed in /// In incremental backup, DDLs which are completed in
/// (lastBackupTS, backupTS] will be stored here. /// (lastBackupTS, backupTS\] will be stored here.
/// Note: `raw_ranges` is deprecated, as it bloats backupmeta. It is kept for /// Note: `raw_ranges` is deprecated, as it bloats backupmeta. It is kept for
/// compatibility, so new BR can restore older backups. /// compatibility, so new BR can restore older backups.
#[prost(bytes = "vec", tag = "10")] #[prost(bytes = "vec", tag = "10")]

View File

@ -1,4 +1,4 @@
/// [start, end) /// \[start, end)
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct KeyRange { pub struct KeyRange {

View File

@ -361,10 +361,11 @@ pub mod debug_client {
/// Debug service for TiKV. /// Debug service for TiKV.
/// ///
/// Errors are defined as follow: /// Errors are defined as follow:
/// - OK: Okay, we are good! ///
/// - UNKNOWN: For unknown error. /// * OK: Okay, we are good!
/// - INVALID_ARGUMENT: Something goes wrong within requests. /// * UNKNOWN: For unknown error.
/// - NOT_FOUND: It is key or region not found, it's based on context, detailed /// * INVALID_ARGUMENT: Something goes wrong within requests.
/// * NOT_FOUND: It is key or region not found, it's based on context, detailed
/// reason can be found in grpc message. /// reason can be found in grpc message.
/// Note: It bypasses raft layer. /// Note: It bypasses raft layer.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -97,10 +97,10 @@ pub struct ServerInfoItem {
/// ServerInfoItem { /// ServerInfoItem {
/// tp = "network" /// tp = "network"
/// name = "eth0" /// name = "eth0"
/// paris = [ /// paris = \[
/// ServerInfoPair { key = "readbytes", value = "4k"}, /// ServerInfoPair { key = "readbytes", value = "4k"},
/// ServerInfoPair { key = "writebytes", value = "1k"}, /// ServerInfoPair { key = "writebytes", value = "1k"},
/// ] /// \]
/// } /// }
#[prost(message, repeated, tag = "3")] #[prost(message, repeated, tag = "3")]
pub pairs: ::prost::alloc::vec::Vec<ServerInfoPair>, pub pairs: ::prost::alloc::vec::Vec<ServerInfoPair>,

View File

@ -1,5 +1,5 @@
/// Defines the HTTP configuration for an API service. It contains a list of /// Defines the HTTP configuration for an API service. It contains a list of
/// \[HttpRule][google.api.HttpRule\], each specifying the mapping of an RPC method /// \[HttpRule\]\[google.api.HttpRule\], each specifying the mapping of an RPC method
/// to one or more HTTP REST API methods. /// to one or more HTTP REST API methods.
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
@ -26,7 +26,7 @@ pub struct Http {
/// APIs](<https://github.com/googleapis/googleapis>), /// APIs](<https://github.com/googleapis/googleapis>),
/// [Cloud Endpoints](<https://cloud.google.com/endpoints>), [gRPC /// [Cloud Endpoints](<https://cloud.google.com/endpoints>), [gRPC
/// Gateway](<https://github.com/grpc-ecosystem/grpc-gateway>), /// Gateway](<https://github.com/grpc-ecosystem/grpc-gateway>),
/// and \[Envoy\](<https://github.com/envoyproxy/envoy>) proxy support this feature /// and [Envoy](<https://github.com/envoyproxy/envoy>) proxy support this feature
/// and use it for large scale production services. /// and use it for large scale production services.
/// ///
/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies /// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
@ -43,6 +43,7 @@ pub struct Http {
/// ///
/// Example: /// Example:
/// ///
/// ```text
/// service Messaging { /// service Messaging {
/// rpc GetMessage(GetMessageRequest) returns (Message) { /// rpc GetMessage(GetMessageRequest) returns (Message) {
/// option (google.api.http) = { /// option (google.api.http) = {
@ -56,17 +57,19 @@ pub struct Http {
/// message Message { /// message Message {
/// string text = 1; // The resource content. /// string text = 1; // The resource content.
/// } /// }
/// ```
/// ///
/// This enables an HTTP REST to gRPC mapping as below: /// This enables an HTTP REST to gRPC mapping as below:
/// ///
/// HTTP | gRPC /// |HTTP|gRPC|
/// -----|----- /// |----|----|
/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` /// |`GET /v1/messages/123456`|`GetMessage(name: "messages/123456")`|
/// ///
/// Any fields in the request message which are not bound by the path template /// Any fields in the request message which are not bound by the path template
/// automatically become HTTP query parameters if there is no HTTP request body. /// automatically become HTTP query parameters if there is no HTTP request body.
/// For example: /// For example:
/// ///
/// ```text
/// service Messaging { /// service Messaging {
/// rpc GetMessage(GetMessageRequest) returns (Message) { /// rpc GetMessage(GetMessageRequest) returns (Message) {
/// option (google.api.http) = { /// option (google.api.http) = {
@ -82,14 +85,15 @@ pub struct Http {
/// int64 revision = 2; // Mapped to URL query parameter `revision`. /// int64 revision = 2; // Mapped to URL query parameter `revision`.
/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. /// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
/// } /// }
/// ```
/// ///
/// This enables a HTTP JSON to RPC mapping as below: /// This enables a HTTP JSON to RPC mapping as below:
/// ///
/// HTTP | gRPC /// |HTTP|gRPC|
/// -----|----- /// |----|----|
/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | /// |`GET /v1/messages/123456?revision=2&sub.subfield=foo`||
/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: /// |\`GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:||
/// "foo"))` /// |"foo"))\`||
/// ///
/// Note that fields which are mapped to URL query parameters must have a /// Note that fields which are mapped to URL query parameters must have a
/// primitive type or a repeated primitive type or a non-repeated message type. /// primitive type or a repeated primitive type or a non-repeated message type.
@ -102,6 +106,7 @@ pub struct Http {
/// specifies the mapping. Consider a REST update method on the /// specifies the mapping. Consider a REST update method on the
/// message resource collection: /// message resource collection:
/// ///
/// ```text
/// service Messaging { /// service Messaging {
/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { /// rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
/// option (google.api.http) = { /// option (google.api.http) = {
@ -114,21 +119,23 @@ pub struct Http {
/// string message_id = 1; // mapped to the URL /// string message_id = 1; // mapped to the URL
/// Message message = 2; // mapped to the body /// Message message = 2; // mapped to the body
/// } /// }
/// ```
/// ///
/// The following HTTP JSON to RPC mapping is enabled, where the /// The following HTTP JSON to RPC mapping is enabled, where the
/// representation of the JSON in the request body is determined by /// representation of the JSON in the request body is determined by
/// protos JSON encoding: /// protos JSON encoding:
/// ///
/// HTTP | gRPC /// |HTTP|gRPC|
/// -----|----- /// |----|----|
/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: /// |`PATCH /v1/messages/123456 { "text": "Hi!" }`|\`UpdateMessage(message_id:|
/// "123456" message { text: "Hi!" })` /// |"123456" message { text: "Hi!" })\`||
/// ///
/// The special name `*` can be used in the body mapping to define that /// The special name `*` can be used in the body mapping to define that
/// every field not bound by the path template should be mapped to the /// every field not bound by the path template should be mapped to the
/// request body. This enables the following alternative definition of /// request body. This enables the following alternative definition of
/// the update method: /// the update method:
/// ///
/// ```text
/// service Messaging { /// service Messaging {
/// rpc UpdateMessage(Message) returns (Message) { /// rpc UpdateMessage(Message) returns (Message) {
/// option (google.api.http) = { /// option (google.api.http) = {
@ -141,14 +148,14 @@ pub struct Http {
/// string message_id = 1; /// string message_id = 1;
/// string text = 2; /// string text = 2;
/// } /// }
/// /// ```
/// ///
/// The following HTTP JSON to RPC mapping is enabled: /// The following HTTP JSON to RPC mapping is enabled:
/// ///
/// HTTP | gRPC /// |HTTP|gRPC|
/// -----|----- /// |----|----|
/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: /// |`PATCH /v1/messages/123456 { "text": "Hi!" }`|\`UpdateMessage(message_id:|
/// "123456" text: "Hi!")` /// |"123456" text: "Hi!")\`||
/// ///
/// Note that when using `*` in the body mapping, it is not possible to /// Note that when using `*` in the body mapping, it is not possible to
/// have HTTP parameters, as all fields not bound by the path end in /// have HTTP parameters, as all fields not bound by the path end in
@ -159,6 +166,7 @@ pub struct Http {
/// It is possible to define multiple HTTP methods for one RPC by using /// It is possible to define multiple HTTP methods for one RPC by using
/// the `additional_bindings` option. Example: /// the `additional_bindings` option. Example:
/// ///
/// ```text
/// service Messaging { /// service Messaging {
/// rpc GetMessage(GetMessageRequest) returns (Message) { /// rpc GetMessage(GetMessageRequest) returns (Message) {
/// option (google.api.http) = { /// option (google.api.http) = {
@ -173,39 +181,42 @@ pub struct Http {
/// string message_id = 1; /// string message_id = 1;
/// string user_id = 2; /// string user_id = 2;
/// } /// }
/// ```
/// ///
/// This enables the following two alternative HTTP JSON to RPC mappings: /// This enables the following two alternative HTTP JSON to RPC mappings:
/// ///
/// HTTP | gRPC /// |HTTP|gRPC|
/// -----|----- /// |----|----|
/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` /// |`GET /v1/messages/123456`|`GetMessage(message_id: "123456")`|
/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: /// |`GET /v1/users/me/messages/123456`|\`GetMessage(user_id: "me" message_id:|
/// "123456")` /// |"123456")\`||
/// ///
/// ## Rules for HTTP mapping /// ## Rules for HTTP mapping
/// ///
/// 1. Leaf request fields (recursive expansion nested messages in the request /// 1. Leaf request fields (recursive expansion nested messages in the request
/// message) are classified into three categories: /// message) are classified into three categories:
/// - Fields referred by the path template. They are passed via the URL path. /// * Fields referred by the path template. They are passed via the URL path.
/// - Fields referred by the \[HttpRule.body][google.api.HttpRule.body\]. They are passed via the HTTP /// * Fields referred by the \[HttpRule.body\]\[google.api.HttpRule.body\]. They are passed via the HTTP
/// request body. /// request body.
/// - All other fields are passed via the URL query parameters, and the /// * All other fields are passed via the URL query parameters, and the
/// parameter name is the field path in the request message. A repeated /// parameter name is the field path in the request message. A repeated
/// field can be represented as multiple query parameters under the same /// field can be represented as multiple query parameters under the same
/// name. /// name.
/// 2. If \[HttpRule.body][google.api.HttpRule.body\] is "*", there is no URL query parameter, all fields /// 1. If \[HttpRule.body\]\[google.api.HttpRule.body\] is "\*", there is no URL query parameter, all fields
/// are passed via URL path and HTTP request body. /// are passed via URL path and HTTP request body.
/// 3. If \[HttpRule.body][google.api.HttpRule.body\] is omitted, there is no HTTP request body, all /// 1. If \[HttpRule.body\]\[google.api.HttpRule.body\] is omitted, there is no HTTP request body, all
/// fields are passed via URL path and URL query parameters. /// fields are passed via URL path and URL query parameters.
/// ///
/// ### Path template syntax /// ### Path template syntax
/// ///
/// Template = "/" Segments [ Verb ] ; /// ```text
/// Template = "/" Segments \[ Verb \] ;
/// Segments = Segment { "/" Segment } ; /// Segments = Segment { "/" Segment } ;
/// Segment = "*" | "**" | LITERAL | Variable ; /// Segment = "*" | "**" | LITERAL | Variable ;
/// Variable = "{" FieldPath [ "=" Segments ] "}" ; /// Variable = "{" FieldPath \[ "=" Segments \] "}" ;
/// FieldPath = IDENT { "." IDENT } ; /// FieldPath = IDENT { "." IDENT } ;
/// Verb = ":" LITERAL ; /// Verb = ":" LITERAL ;
/// ```
/// ///
/// The syntax `*` matches a single URL path segment. The syntax `**` matches /// The syntax `*` matches a single URL path segment. The syntax `**` matches
/// zero or more URL path segments, which must be the last part of the URL path /// zero or more URL path segments, which must be the last part of the URL path
@ -254,11 +265,13 @@ pub struct Http {
/// ///
/// Example: /// Example:
/// ///
/// ```text
/// http: /// http:
/// rules: /// rules:
/// # Selects a gRPC method and applies HttpRule to it. /// # Selects a gRPC method and applies HttpRule to it.
/// - selector: example.v1.Messaging.GetMessage /// - selector: example.v1.Messaging.GetMessage
/// get: /v1/messages/{message_id}/{sub.subfield} /// get: /v1/messages/{message_id}/{sub.subfield}
/// ```
/// ///
/// ## Special notes /// ## Special notes
/// ///
@ -287,18 +300,12 @@ pub struct Http {
/// If an API needs to use a JSON array for request or response body, it can map /// If an API needs to use a JSON array for request or response body, it can map
/// the request or response body to a repeated field. However, some gRPC /// the request or response body to a repeated field. However, some gRPC
/// Transcoding implementations may not support this feature. /// Transcoding implementations may not support this feature.
#[cfg(not(doctest))]
#[allow(dead_code)]
pub struct __GoogleApiHttpRuleDocs;
/// HACK: for docs see [`__GoogleApiHttpRuleDocs`]
///
/// this hack allows full doctest pass without failures on examples from that doc
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct HttpRule { pub struct HttpRule {
/// Selects a method to which this rule applies. /// Selects a method to which this rule applies.
/// ///
/// Refer to \[selector][google.api.DocumentationRule.selector\] for syntax details. /// Refer to \[selector\]\[google.api.DocumentationRule.selector\] for syntax details.
#[prost(string, tag = "1")] #[prost(string, tag = "1")]
pub selector: ::prost::alloc::string::String, pub selector: ::prost::alloc::string::String,
/// The name of the request field whose value is mapped to the HTTP request /// The name of the request field whose value is mapped to the HTTP request
@ -333,12 +340,6 @@ pub mod http_rule {
/// Determines the URL pattern is matched by this rules. This pattern can be /// Determines the URL pattern is matched by this rules. This pattern can be
/// used with any of the {get|put|post|delete|patch} methods. A custom method /// used with any of the {get|put|post|delete|patch} methods. A custom method
/// can be defined using the 'custom' field. /// can be defined using the 'custom' field.
#[cfg(not(doctest))]
#[allow(dead_code)]
pub struct __GoogleApiHttpRuleDocs;
/// HACK: for docs see [`__GoogleApiHttpRuleDocs`]
///
/// this hack allows full doctest pass without failures on examples from that doc
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)] #[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Pattern { pub enum Pattern {
@ -359,7 +360,7 @@ pub mod http_rule {
#[prost(string, tag = "6")] #[prost(string, tag = "6")]
Patch(::prost::alloc::string::String), Patch(::prost::alloc::string::String),
/// The custom pattern is used for specifying an HTTP method that is not /// The custom pattern is used for specifying an HTTP method that is not
/// included in the `pattern` field, such as HEAD, or "*" to leave the /// included in the `pattern` field, such as HEAD, or "\*" to leave the
/// HTTP method unspecified for this rule. The wild-card rule is useful /// HTTP method unspecified for this rule. The wild-card rule is useful
/// for services that provide content to Web (HTML) clients. /// for services that provide content to Web (HTML) clients.
#[prost(message, tag = "8")] #[prost(message, tag = "8")]

View File

@ -211,19 +211,20 @@ pub mod import_kv_client {
/// ImportKV provides a service to import key-value pairs to TiKV. /// ImportKV provides a service to import key-value pairs to TiKV.
/// ///
/// In order to import key-value pairs to TiKV, the user should: /// In order to import key-value pairs to TiKV, the user should:
///
/// 1. Open an engine identified by an UUID. /// 1. Open an engine identified by an UUID.
/// 2. Open write streams to write key-value batches to the opened engine. /// 1. Open write streams to write key-value batches to the opened engine.
/// Different streams/clients can write to the same engine concurrently. /// Different streams/clients can write to the same engine concurrently.
/// 3. Close the engine after all write batches have been finished. An /// 1. Close the engine after all write batches have been finished. An
/// engine can only be closed when all write streams are closed. An /// engine can only be closed when all write streams are closed. An
/// engine can only be closed once, and it can not be opened again /// engine can only be closed once, and it can not be opened again
/// once it is closed. /// once it is closed.
/// 4. Import the data in the engine to the target cluster. Note that /// 1. Import the data in the engine to the target cluster. Note that
/// the import process is not atomic, it requires the data to be /// the import process is not atomic, it requires the data to be
/// idempotent on retry. An engine can only be imported after it is /// idempotent on retry. An engine can only be imported after it is
/// closed. An engine can be imported multiple times, but can not be /// closed. An engine can be imported multiple times, but can not be
/// imported concurrently. /// imported concurrently.
/// 5. Clean up the engine after it has been imported. Delete all data /// 1. Clean up the engine after it has been imported. Delete all data
/// in the engine. An engine can not be cleaned up when it is /// in the engine. An engine can not be cleaned up when it is
/// writing or importing. /// writing or importing.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]

View File

@ -340,14 +340,14 @@ pub struct DuplicateDetectResponse {
pub key_error: ::core::option::Option<Error>, pub key_error: ::core::option::Option<Error>,
/// The these keys will be in asc order (but commit time is in desc order), /// The these keys will be in asc order (but commit time is in desc order),
/// and the content is just like following: /// and the content is just like following:
/// [ /// \[
/// {key: "key1", value: "value11", commit_ts: 1005}, /// {key: "key1", value: "value11", commit_ts: 1005},
/// {key: "key1", value: "value12", commit_ts: 1004}, /// {key: "key1", value: "value12", commit_ts: 1004},
/// {key: "key1", value: "value13", commit_ts: 1001}, /// {key: "key1", value: "value13", commit_ts: 1001},
/// {key: "key2", value: "value21", commit_ts: 1004}, /// {key: "key2", value: "value21", commit_ts: 1004},
/// {key: "key2", value: "value22", commit_ts: 1002}, /// {key: "key2", value: "value22", commit_ts: 1002},
/// ... /// ...
/// ] /// \]
#[prost(message, repeated, tag = "3")] #[prost(message, repeated, tag = "3")]
pub pairs: ::prost::alloc::vec::Vec<KvPair>, pub pairs: ::prost::alloc::vec::Vec<KvPair>,
} }
@ -385,9 +385,10 @@ pub mod import_sst_client {
/// ImportSST provides a service to import a generated SST file to a region in TiKV. /// ImportSST provides a service to import a generated SST file to a region in TiKV.
/// ///
/// In order to import an SST file to a region, the user should: /// In order to import an SST file to a region, the user should:
///
/// 1. Retrieve the meta of the region according to the SST file's range. /// 1. Retrieve the meta of the region according to the SST file's range.
/// 2. Upload the SST file to the servers where the region's peers locate in. /// 1. Upload the SST file to the servers where the region's peers locate in.
/// 3. Issue an ingest request to the region's leader with the SST file's metadata. /// 1. Issue an ingest request to the region's leader with the SST file's metadata.
/// ///
/// It's the user's responsibility to make sure that the SST file is uploaded to /// It's the user's responsibility to make sure that the SST file is uploaded to
/// the servers where the region's peers locate in, before issue the ingest /// the servers where the region's peers locate in, before issue the ingest

View File

@ -49,8 +49,8 @@ pub struct ScanRequest {
pub key_only: bool, pub key_only: bool,
#[prost(bool, tag = "6")] #[prost(bool, tag = "6")]
pub reverse: bool, pub reverse: bool,
/// For compatibility, when scanning forward, the range to scan is [start_key, end_key), where start_key < end_key; /// 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. /// and when scanning backward, it scans \[end_key, start_key) in descending order, where end_key \< start_key.
#[prost(bytes = "vec", tag = "7")] #[prost(bytes = "vec", tag = "7")]
pub end_key: ::prost::alloc::vec::Vec<u8>, pub end_key: ::prost::alloc::vec::Vec<u8>,
/// If sample_step > 0, skips 'sample_step - 1' number of keys after each returned key. /// If sample_step > 0, skips 'sample_step - 1' number of keys after each returned key.
@ -723,8 +723,8 @@ pub struct RawScanRequest {
pub cf: ::prost::alloc::string::String, pub cf: ::prost::alloc::string::String,
#[prost(bool, tag = "6")] #[prost(bool, tag = "6")]
pub reverse: bool, pub reverse: bool,
/// For compatibility, when scanning forward, the range to scan is [start_key, end_key), where start_key < end_key; /// 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. /// and when scanning backward, it scans \[end_key, start_key) in descending order, where end_key \< start_key.
#[prost(bytes = "vec", tag = "7")] #[prost(bytes = "vec", tag = "7")]
pub end_key: ::prost::alloc::vec::Vec<u8>, pub end_key: ::prost::alloc::vec::Vec<u8>,
} }
@ -1021,7 +1021,7 @@ pub struct Context {
#[prost(enumeration = "ApiVersion", tag = "21")] #[prost(enumeration = "ApiVersion", tag = "21")]
pub api_version: i32, pub api_version: i32,
/// Read request should read through locks belonging to these transactions because these /// Read request should read through locks belonging to these transactions because these
/// transactions are committed and theirs commit_ts <= read request's start_ts. /// transactions are committed and theirs commit_ts \<= read request's start_ts.
#[prost(uint64, repeated, tag = "22")] #[prost(uint64, repeated, tag = "22")]
pub committed_locks: ::prost::alloc::vec::Vec<u64>, pub committed_locks: ::prost::alloc::vec::Vec<u64>,
} }
@ -1394,7 +1394,7 @@ pub struct CheckLeaderResponse {
#[allow(clippy::derive_partial_eq_without_eq)] #[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct StoreSafeTsRequest { pub struct StoreSafeTsRequest {
/// Get the minimal `safe_ts` from regions that overlap with the key range [`start_key`, `end_key`) /// 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 /// An empty key range means all regions in the store
#[prost(message, optional, tag = "1")] #[prost(message, optional, tag = "1")]
pub key_range: ::core::option::Option<KeyRange>, pub key_range: ::core::option::Option<KeyRange>,
@ -1542,11 +1542,11 @@ pub enum ApiVersion {
/// Only RawKV is available, and then 8 bytes representing the unix timestamp in /// Only RawKV is available, and then 8 bytes representing the unix timestamp in
/// seconds for expiring time will be append to the value of all RawKV kv pairs. /// seconds for expiring time will be append to the value of all RawKV kv pairs.
/// ///
/// ------------------------------------------------------------ /// ---
/// | User value | Expire Ts | ///
/// ------------------------------------------------------------ /// ## \| User value | Expire Ts |
/// | 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff | ///
/// ------------------------------------------------------------ /// ## \| 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff |
/// ///
/// V1TTL server only accepts V1 raw requests. /// V1TTL server only accepts V1 raw requests.
/// V1 client should not use `V1TTL` in request. V1 client should always send `V1`. /// V1 client should not use `V1TTL` in request. V1 client should always send `V1`.
@ -1559,21 +1559,21 @@ pub enum ApiVersion {
/// ///
/// The last byte in the raw value must be a meta flag. For example: /// The last byte in the raw value must be a meta flag. For example:
/// ///
/// -------------------------------------- /// ---
/// | User value | Meta flags | ///
/// -------------------------------------- /// ## \| User value | Meta flags |
/// | 0x12 0x34 0x56 | 0x00 (0b00000000) | ///
/// -------------------------------------- /// ## \| 0x12 0x34 0x56 | 0x00 (0b00000000) |
/// ///
/// As shown in the example below, the least significant bit of the meta flag /// As shown in the example below, the least significant bit of the meta flag
/// indicates whether the value contains 8 bytes expire ts at the very left to the /// indicates whether the value contains 8 bytes expire ts at the very left to the
/// meta flags. /// meta flags.
/// ///
/// -------------------------------------------------------------------------------- /// ---
/// | User value | Expire Ts | Meta flags | ///
/// -------------------------------------------------------------------------------- /// ## \| User value | Expire Ts | Meta flags |
/// | 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff | 0x01 (0b00000001) | ///
/// -------------------------------------------------------------------------------- /// ## \| 0x12 0x34 0x56 | 0x00 0x00 0x00 0x00 0x00 0x00 0xff 0xff | 0x01 (0b00000001) |
/// ///
/// V2 server accpets V2 requests and V1 txn requests that statrts with TiDB key /// V2 server accpets V2 requests and V1 txn requests that statrts with TiDB key
/// prefix (`m` and `t`). /// prefix (`m` and `t`).

View File

@ -69,7 +69,7 @@ pub struct RegionEpoch {
pub struct Region { pub struct Region {
#[prost(uint64, tag = "1")] #[prost(uint64, tag = "1")]
pub id: u64, pub id: u64,
/// Region key range [start_key, end_key). /// Region key range \[start_key, end_key).
#[prost(bytes = "vec", tag = "2")] #[prost(bytes = "vec", tag = "2")]
pub start_key: ::prost::alloc::vec::Vec<u8>, pub start_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")] #[prost(bytes = "vec", tag = "3")]

View File

@ -198,7 +198,7 @@ pub struct ScanRegionsRequest {
pub header: ::core::option::Option<RequestHeader>, pub header: ::core::option::Option<RequestHeader>,
#[prost(bytes = "vec", tag = "2")] #[prost(bytes = "vec", tag = "2")]
pub start_key: ::prost::alloc::vec::Vec<u8>, pub start_key: ::prost::alloc::vec::Vec<u8>,
/// no limit when limit <= 0. /// no limit when limit \<= 0.
#[prost(int32, tag = "3")] #[prost(int32, tag = "3")]
pub limit: i32, pub limit: i32,
/// end_key is +inf when it is empty. /// end_key is +inf when it is empty.
@ -415,13 +415,14 @@ pub struct RegionHeartbeatResponse {
/// to pd regularly, pd will determine whether this region /// to pd regularly, pd will determine whether this region
/// should do ChangePeer or not. /// should do ChangePeer or not.
/// E,g, max peer number is 3, region A, first only peer 1 in A. /// E,g, max peer number is 3, region A, first only peer 1 in A.
///
/// 1. Pd region state -> Peers (1), ConfVer (1). /// 1. Pd region state -> Peers (1), ConfVer (1).
/// 2. Leader peer 1 reports region state to pd, pd finds the /// 1. Leader peer 1 reports region state to pd, pd finds the
/// peer number is < 3, so first changes its current region /// peer number is \< 3, so first changes its current region
/// state -> Peers (1, 2), ConfVer (1), and returns ChangePeer Adding 2. /// state -> Peers (1, 2), ConfVer (1), and returns ChangePeer Adding 2.
/// 3. Leader does ChangePeer, then reports Peers (1, 2), ConfVer (2), /// 1. Leader does ChangePeer, then reports Peers (1, 2), ConfVer (2),
/// pd updates its state -> Peers (1, 2), ConfVer (2). /// pd updates its state -> Peers (1, 2), ConfVer (2).
/// 4. Leader may report old Peers (1), ConfVer (1) to pd before ConfChange /// 1. Leader may report old Peers (1), ConfVer (1) to pd before ConfChange
/// finished, pd stills responses ChangePeer Adding 2, of course, we must /// finished, pd stills responses ChangePeer Adding 2, of course, we must
/// guarantee the second ChangePeer can't be applied in TiKV. /// guarantee the second ChangePeer can't be applied in TiKV.
#[prost(message, optional, tag = "2")] #[prost(message, optional, tag = "2")]
@ -622,7 +623,7 @@ pub struct StoreStats {
/// Store query stats /// Store query stats
#[prost(message, optional, tag = "21")] #[prost(message, optional, tag = "21")]
pub query_stats: ::core::option::Option<QueryStats>, pub query_stats: ::core::option::Option<QueryStats>,
/// Score that represents the speed of the store, ranges in [1, 100], lower is better. /// Score that represents the speed of the store, ranges in \[1, 100\], lower is better.
#[prost(uint64, tag = "22")] #[prost(uint64, tag = "22")]
pub slow_score: u64, pub slow_score: u64,
/// Damaged regions on the store that need to be removed by PD. /// Damaged regions on the store that need to be removed by PD.

View File

@ -14,7 +14,7 @@ pub struct RaftMessage {
/// true means to_peer is a tombstone peer and it should remove itself. /// true means to_peer is a tombstone peer and it should remove itself.
#[prost(bool, tag = "6")] #[prost(bool, tag = "6")]
pub is_tombstone: bool, pub is_tombstone: bool,
/// Region key range [start_key, end_key). /// Region key range \[start_key, end_key).
#[prost(bytes = "vec", tag = "7")] #[prost(bytes = "vec", tag = "7")]
pub start_key: ::prost::alloc::vec::Vec<u8>, pub start_key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "8")] #[prost(bytes = "vec", tag = "8")]

View File

@ -257,7 +257,7 @@ const ENGINE_LABEL_TIFLASH: &str = "tiflash";
const ENGINE_LABEL_TIFLASH_COMPUTE: &str = "tiflash_compute"; const ENGINE_LABEL_TIFLASH_COMPUTE: &str = "tiflash_compute";
fn is_valid_tikv_store(store: &metapb::Store) -> bool { fn is_valid_tikv_store(store: &metapb::Store) -> bool {
if metapb::StoreState::from_i32(store.state).unwrap() == metapb::StoreState::Tombstone { if metapb::StoreState::try_from(store.state).unwrap() == metapb::StoreState::Tombstone {
return false; return false;
} }
let is_tiflash = store.labels.iter().any(|label| { let is_tiflash = store.labels.iter().any(|label| {

View File

@ -61,7 +61,7 @@ macro_rules! impl_request {
.map(|c| c.api_version) .map(|c| c.api_version)
.unwrap_or_default(); .unwrap_or_default();
self.context = Some(context); self.context = Some(context);
self.set_api_version(kvrpcpb::ApiVersion::from_i32(api_version).unwrap()); self.set_api_version(kvrpcpb::ApiVersion::try_from(api_version).unwrap());
} }
fn set_api_version(&mut self, api_version: kvrpcpb::ApiVersion) { fn set_api_version(&mut self, api_version: kvrpcpb::ApiVersion) {

View File

@ -245,7 +245,7 @@ impl Buffer {
} }
pub(crate) fn mutate(&mut self, m: kvrpcpb::Mutation) { pub(crate) fn mutate(&mut self, m: kvrpcpb::Mutation) {
let op = kvrpcpb::Op::from_i32(m.op).unwrap(); let op = kvrpcpb::Op::try_from(m.op).unwrap();
match op { match op {
kvrpcpb::Op::Put => self.put(m.key.into(), m.value), kvrpcpb::Op::Put => self.put(m.key.into(), m.value),
kvrpcpb::Op::Del => self.delete(m.key.into()), kvrpcpb::Op::Del => self.delete(m.key.into()),

View File

@ -706,7 +706,7 @@ pub struct TransactionStatus {
impl From<kvrpcpb::CheckTxnStatusResponse> for TransactionStatus { impl From<kvrpcpb::CheckTxnStatusResponse> for TransactionStatus {
fn from(mut resp: kvrpcpb::CheckTxnStatusResponse) -> TransactionStatus { fn from(mut resp: kvrpcpb::CheckTxnStatusResponse) -> TransactionStatus {
TransactionStatus { TransactionStatus {
action: Action::from_i32(resp.action).unwrap(), action: Action::try_from(resp.action).unwrap(),
kind: (resp.commit_version, resp.lock_ttl, resp.lock_info.take()).into(), kind: (resp.commit_version, resp.lock_ttl, resp.lock_info.take()).into(),
is_expired: false, is_expired: false,
} }