diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..5e62a081 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/generated/ diff=false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99318793..20a6baed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,9 @@ jobs: uses: Swatinem/rust-cache@v1.4.0 - name: make check run: make check + - name: Catch unexpected changes in the generated code + run: | + git diff --exit-code unit-test: name: unit test diff --git a/Cargo.toml b/Cargo.toml index 040271e1..9535a6e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,12 @@ integration-tests = [] [lib] name = "tikv_client" +[workspace] +members = [ + ".", + "proto-build", +] + [dependencies] async-recursion = "0.3" async-trait = "0.1" @@ -39,7 +45,6 @@ tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] } tonic = { version = "0.9", features = ["tls"] } [dev-dependencies] -tempfile = "3.6" clap = "2" env_logger = "0.10" fail = { version = "0.4", features = ["failpoints"] } @@ -51,14 +56,9 @@ reqwest = { version = "0.11", default-features = false, features = [ serde_json = "1" serial_test = "0.5.0" simple_logger = "1" +tempfile = "3.6" tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] } -[build-dependencies] -glob = "0.3" -tonic-build = "0.9" -# 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" - [[test]] name = "failpoint_tests" path = "tests/failpoint_tests.rs" diff --git a/Makefile b/Makefile index a96d584a..b57685a5 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,18 @@ INTEGRATION_TEST_ARGS := --features "integration-tests" default: check -check: +generate: + cargo run -p tikv-client-proto-build + +check: generate cargo check --all --all-targets --features "${ALL_FEATURES}" cargo fmt -- --check cargo clippy --all-targets --features "${ALL_FEATURES}" -- -D clippy::all -unit-test: +unit-test: generate cargo test --all --no-default-features -integration-test: +integration-test: generate cargo test txn_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture cargo test raw_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture cargo test misc_ --all ${INTEGRATION_TEST_ARGS} -- --nocapture @@ -32,7 +35,7 @@ doc: tiup: tiup playground nightly --mode tikv-slim --kv 3 --without-monitor --kv.config $(shell pwd)/config/tikv.toml --pd.config $(shell pwd)/config/pd.toml & -all: check doc test +all: generate check doc test clean: cargo clean diff --git a/proto-build/Cargo.toml b/proto-build/Cargo.toml new file mode 100644 index 00000000..dfc637dc --- /dev/null +++ b/proto-build/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "tikv-client-proto-build" +version = "0.0.0" +publish = false + +keywords = ["TiKV", "KV", "distributed-systems"] +license = "Apache-2.0" +authors = ["The TiKV Project Authors"] +repository = "https://github.com/tikv/client-rust" +description = "The Rust language implementation of TiKV client." +edition = "2021" + +[dependencies] +glob = "0.3" +tonic-build = "0.9" +# 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" diff --git a/build.rs b/proto-build/src/main.rs similarity index 69% rename from build.rs rename to proto-build/src/main.rs index 907c3585..3825f216 100644 --- a/build.rs +++ b/proto-build/src/main.rs @@ -1,12 +1,14 @@ -// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. - -use tonic_disable_doctest::BuilderEx; +// Copyright 2023 TiKV Project Authors. Licensed under Apache-2.0. fn main() { + use tonic_disable_doctest::BuilderEx; + tonic_build::configure() .disable_doctests_for_types([".google.api.HttpRule"]) + .emit_rerun_if_changed(false) .build_server(false) .include_file("mod.rs") + .out_dir("src/generated") .compile( &glob::glob("proto/*.proto") .unwrap() diff --git a/src/generated/backup.rs b/src/generated/backup.rs new file mode 100644 index 00000000..2342baca --- /dev/null +++ b/src/generated/backup.rs @@ -0,0 +1,700 @@ +/// The message save the metadata of a backup. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BackupMeta { + /// ID and version of backuped cluster. + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + #[prost(string, tag = "2")] + pub cluster_version: ::prost::alloc::string::String, + /// Save the version of BR running backup jobs. + #[prost(string, tag = "11")] + pub br_version: ::prost::alloc::string::String, + /// The backupmeta scheme version. + #[prost(int32, tag = "12")] + pub version: i32, + /// A set of files that compose a backup. + /// Note: `files` is deprecated, as it bloats backupmeta. It is kept for + /// compatibility, so new BR can restore older backups. + #[prost(message, repeated, tag = "4")] + pub files: ::prost::alloc::vec::Vec, + /// An index to files contains data files. + #[prost(message, optional, tag = "13")] + pub file_index: ::core::option::Option, + /// A pair of timestamp specifies a time range of a backup. + /// For full backup, the start_version equals to the end_version, + /// it means point in time. + /// For incremental backup, the time range is specified as + /// (start_version, end_version]. + #[prost(uint64, tag = "5")] + pub start_version: u64, + #[prost(uint64, tag = "6")] + pub end_version: u64, + /// Table metadata describes database and table info. + /// Note: `schemas` is deprecated, as it bloats backupmeta. It is kept for + /// compatibility, so new BR can restore older backups. + #[prost(message, repeated, tag = "7")] + pub schemas: ::prost::alloc::vec::Vec, + /// An index to files contains Schemas. + #[prost(message, optional, tag = "14")] + pub schema_index: ::core::option::Option, + /// If in raw kv mode, `start_versions`, `end_versions` and `schemas` will be + /// ignored, and the backup data's range is represented by raw_ranges. + #[prost(bool, tag = "8")] + pub is_raw_kv: bool, + /// Note: `raw_ranges` is deprecated, as it bloats backupmeta. It is kept for + /// compatibility, so new BR can restore older backups. + #[prost(message, repeated, tag = "9")] + pub raw_ranges: ::prost::alloc::vec::Vec, + /// An index to files contains RawRanges. + #[prost(message, optional, tag = "15")] + pub raw_range_index: ::core::option::Option, + /// In incremental backup, DDLs which are completed in + /// (lastBackupTS, backupTS] will be stored here. + /// Note: `raw_ranges` is deprecated, as it bloats backupmeta. It is kept for + /// compatibility, so new BR can restore older backups. + #[prost(bytes = "vec", tag = "10")] + pub ddls: ::prost::alloc::vec::Vec, + /// An index to files contains DDLs. + #[prost(message, optional, tag = "16")] + pub ddl_indexes: ::core::option::Option, + /// the backup result into `backupmeta` file + #[prost(string, tag = "17")] + pub backup_result: ::prost::alloc::string::String, + /// API version implies the encode of the key and value. + #[prost(enumeration = "super::kvrpcpb::ApiVersion", tag = "18")] + pub api_version: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct File { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub sha256: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "4")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "5")] + pub start_version: u64, + #[prost(uint64, tag = "6")] + pub end_version: u64, + #[prost(uint64, tag = "7")] + pub crc64xor: u64, + #[prost(uint64, tag = "8")] + pub total_kvs: u64, + #[prost(uint64, tag = "9")] + pub total_bytes: u64, + #[prost(string, tag = "10")] + pub cf: ::prost::alloc::string::String, + #[prost(uint64, tag = "11")] + pub size: u64, + /// cipher_iv is used for AES cipher + #[prost(bytes = "vec", tag = "12")] + pub cipher_iv: ::prost::alloc::vec::Vec, +} +/// MetaFile describes a multi-level index of data used in backup. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetaFile { + /// A set of files that contains a MetaFile. + /// It is used as a multi-level index. + #[prost(message, repeated, tag = "1")] + pub meta_files: ::prost::alloc::vec::Vec, + /// A set of files that contains user data. + #[prost(message, repeated, tag = "2")] + pub data_files: ::prost::alloc::vec::Vec, + /// A set of files that contains Schemas. + #[prost(message, repeated, tag = "3")] + pub schemas: ::prost::alloc::vec::Vec, + /// A set of files that contains RawRanges. + #[prost(message, repeated, tag = "4")] + pub raw_ranges: ::prost::alloc::vec::Vec, + /// A set of files that contains DDLs. + #[prost(bytes = "vec", repeated, tag = "5")] + pub ddls: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Schema { + #[prost(bytes = "vec", tag = "1")] + pub db: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub table: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub crc64xor: u64, + #[prost(uint64, tag = "4")] + pub total_kvs: u64, + #[prost(uint64, tag = "5")] + pub total_bytes: u64, + #[prost(uint32, tag = "6")] + pub tiflash_replicas: u32, + /// stats represents the dump stats for a analyzed table, which generate by DumpStatsToJSON + /// + #[prost(bytes = "vec", tag = "7")] + pub stats: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RawRange { + #[prost(bytes = "vec", tag = "1")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(string, tag = "3")] + pub cf: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClusterIdError { + #[prost(uint64, tag = "1")] + pub current: u64, + #[prost(uint64, tag = "2")] + pub request: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(string, tag = "1")] + pub msg: ::prost::alloc::string::String, + #[prost(oneof = "error::Detail", tags = "3, 4, 5")] + pub detail: ::core::option::Option, +} +/// Nested message and enum types in `Error`. +pub mod error { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Detail { + #[prost(message, tag = "3")] + ClusterIdError(super::ClusterIdError), + #[prost(message, tag = "4")] + KvError(super::super::kvrpcpb::KeyError), + #[prost(message, tag = "5")] + RegionError(super::super::errorpb::Error), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CipherInfo { + #[prost(enumeration = "super::encryptionpb::EncryptionMethod", tag = "1")] + pub cipher_type: i32, + #[prost(bytes = "vec", tag = "2")] + pub cipher_key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BackupRequest { + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "4")] + pub start_version: u64, + #[prost(uint64, tag = "5")] + pub end_version: u64, + /// The I/O rate limit for backup request. + #[prost(uint64, tag = "7")] + pub rate_limit: u64, + /// The concurrency for executing the backup request in every tikv node. + #[prost(uint32, tag = "8")] + pub concurrency: u32, + #[prost(message, optional, tag = "9")] + pub storage_backend: ::core::option::Option, + /// If raw kv mode is enabled, `start_version` and `end_version` will be ignored, and `cf` + /// specifies which cf to backup. + #[prost(bool, tag = "10")] + pub is_raw_kv: bool, + #[prost(string, tag = "11")] + pub cf: ::prost::alloc::string::String, + /// algorithm used for compress sst files + #[prost(enumeration = "CompressionType", tag = "12")] + pub compression_type: i32, + /// sst compression level, some algorithms support negative compression levels + #[prost(int32, tag = "13")] + pub compression_level: i32, + /// The cipher_info is Used to encrypt sst + #[prost(message, optional, tag = "14")] + pub cipher_info: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StorageBackend { + #[prost(oneof = "storage_backend::Backend", tags = "1, 2, 3, 4, 5, 6, 7")] + pub backend: ::core::option::Option, +} +/// Nested message and enum types in `StorageBackend`. +pub mod storage_backend { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Backend { + #[prost(message, tag = "1")] + Noop(super::Noop), + #[prost(message, tag = "2")] + Local(super::Local), + #[prost(message, tag = "3")] + S3(super::S3), + #[prost(message, tag = "4")] + Gcs(super::Gcs), + #[prost(message, tag = "5")] + CloudDynamic(super::CloudDynamic), + #[prost(message, tag = "6")] + Hdfs(super::Hdfs), + #[prost(message, tag = "7")] + AzureBlobStorage(super::AzureBlobStorage), + } +} +/// Noop storage backend saves files into void. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Noop {} +/// Local storage backend saves files into local disk +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Local { + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, +} +/// S3 storage backend saves files into S3 compatible storages +/// For non-aws providers, endpoint must be provided +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct S3 { + #[prost(string, tag = "1")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub region: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub bucket: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub prefix: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub storage_class: ::prost::alloc::string::String, + /// server side encryption + #[prost(string, tag = "6")] + pub sse: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub acl: ::prost::alloc::string::String, + #[prost(string, tag = "8")] + pub access_key: ::prost::alloc::string::String, + #[prost(string, tag = "9")] + pub secret_access_key: ::prost::alloc::string::String, + #[prost(bool, tag = "10")] + pub force_path_style: bool, + #[prost(string, tag = "11")] + pub sse_kms_key_id: ::prost::alloc::string::String, +} +/// GCS storage backend saves files into google cloud storage. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Gcs { + #[prost(string, tag = "1")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub bucket: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub prefix: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub storage_class: ::prost::alloc::string::String, + /// If not empty, applies a predefined set of access controls. + /// See + /// for valid values. + #[prost(string, tag = "5")] + pub predefined_acl: ::prost::alloc::string::String, + /// Service Account Credentials JSON blob + /// You can get one from and + /// copy the content, set it as string here. + #[prost(string, tag = "6")] + pub credentials_blob: ::prost::alloc::string::String, +} +/// AzureBlobStorage storage backend saves files into azure blob storage. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AzureBlobStorage { + #[prost(string, tag = "1")] + pub endpoint: ::prost::alloc::string::String, + /// Alias: container + #[prost(string, tag = "2")] + pub bucket: ::prost::alloc::string::String, + /// Notice: prefix starts without `/`, otherwise the first directory's name is empty. + #[prost(string, tag = "3")] + pub prefix: ::prost::alloc::string::String, + /// Alias: access_tier. + /// See + #[prost(string, tag = "4")] + pub storage_class: ::prost::alloc::string::String, + /// if empty, try to read account_name from the node's environment variable $AZURE_STORAGE_ACCOUNT. + #[prost(string, tag = "5")] + pub account_name: ::prost::alloc::string::String, + /// Use shared key to access the azure blob + /// If the node's environment variables($AZURE_CLIENT_ID, $AZURE_TENANT_ID, $AZURE_CLIENT_SECRET) exist, + /// prefer to use token to access the azure blob. + /// + /// See + /// + /// Otherwise, if empty, try to read shared key from the node's environment variable $AZURE_STORAGE_KEY. + #[prost(string, tag = "6")] + pub shared_key: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Bucket { + #[prost(string, tag = "1")] + pub endpoint: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub region: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub bucket: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub prefix: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub storage_class: ::prost::alloc::string::String, +} +/// CloudDynamic allows testing new cloud providers and new fields without changing protobuf definitions +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloudDynamic { + #[prost(message, optional, tag = "1")] + pub bucket: ::core::option::Option, + /// s3, gcs and azureBlobStorage are supported + #[prost(string, tag = "2")] + pub provider_name: ::prost::alloc::string::String, + #[prost(map = "string, string", tag = "3")] + pub attrs: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, +} +/// HDFS storage backend saves file into HDFS compatible storages +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Hdfs { + /// a URL: hdfs:///some/path or hdfs://host:port/some/path + #[prost(string, tag = "1")] + pub remote: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BackupResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub files: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExternalStorageRestoreRequest { + #[prost(message, optional, tag = "1")] + pub storage_backend: ::core::option::Option, + #[prost(string, tag = "2")] + pub object_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub restore_name: ::prost::alloc::string::String, + #[prost(uint64, tag = "4")] + pub content_length: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExternalStorageRestoreResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExternalStorageSaveRequest { + #[prost(message, optional, tag = "1")] + pub storage_backend: ::core::option::Option, + #[prost(string, tag = "2")] + pub object_name: ::prost::alloc::string::String, + #[prost(uint64, tag = "3")] + pub content_length: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExternalStorageSaveResponse {} +/// sst files compression algorithm +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum CompressionType { + Unknown = 0, + Lz4 = 1, + Snappy = 2, + Zstd = 3, +} +impl CompressionType { + /// 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 { + CompressionType::Unknown => "UNKNOWN", + CompressionType::Lz4 => "LZ4", + CompressionType::Snappy => "SNAPPY", + CompressionType::Zstd => "ZSTD", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "LZ4" => Some(Self::Lz4), + "SNAPPY" => Some(Self::Snappy), + "ZSTD" => Some(Self::Zstd), + _ => None, + } + } +} +/// Generated client implementations. +pub mod backup_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct BackupClient { + inner: tonic::client::Grpc, + } + impl BackupClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl BackupClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> BackupClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + BackupClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + pub async fn backup( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/backup.Backup/backup"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("backup.Backup", "backup")); + self.inner.server_streaming(req, path, codec).await + } + } +} +/// Generated client implementations. +pub mod external_storage_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// ExternalStorage is a service for using a cloud backend from StorageBackend to store files. + /// This can be used to backup and restore SST files. + #[derive(Debug, Clone)] + pub struct ExternalStorageClient { + inner: tonic::client::Grpc, + } + impl ExternalStorageClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ExternalStorageClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ExternalStorageClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ExternalStorageClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Restore to a file + pub async fn restore( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/backup.ExternalStorage/restore", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("backup.ExternalStorage", "restore")); + self.inner.unary(req, path, codec).await + } + /// Save a file to storage + pub async fn save( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/backup.ExternalStorage/save", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("backup.ExternalStorage", "save")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/cdcpb.rs b/src/generated/cdcpb.rs new file mode 100644 index 00000000..0cf47c51 --- /dev/null +++ b/src/generated/cdcpb.rs @@ -0,0 +1,407 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Header { + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + #[prost(string, tag = "2")] + pub ticdc_version: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DuplicateRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Compatibility { + #[prost(string, tag = "1")] + pub required_version: ::prost::alloc::string::String, +} +/// ClusterIDMismatch is an error variable that +/// tells people that the cluster ID of the request does not match the TiKV cluster ID. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClusterIdMismatch { + /// The current tikv cluster ID. + #[prost(uint64, tag = "1")] + pub current: u64, + /// The cluster ID of the TiCDC request. + #[prost(uint64, tag = "2")] + pub request: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(message, optional, tag = "1")] + pub not_leader: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region_not_found: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub epoch_not_match: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub duplicate_request: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub compatibility: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub cluster_id_mismatch: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxnInfo { + #[prost(uint64, tag = "1")] + pub start_ts: u64, + #[prost(bytes = "vec", tag = "2")] + pub primary: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxnStatus { + #[prost(uint64, tag = "1")] + pub start_ts: u64, + #[prost(uint64, tag = "2")] + pub min_commit_ts: u64, + #[prost(uint64, tag = "3")] + pub commit_ts: u64, + #[prost(bool, tag = "4")] + pub is_rolled_back: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Event { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint64, tag = "2")] + pub index: u64, + #[prost(uint64, tag = "7")] + pub request_id: u64, + #[prost(oneof = "event::Event", tags = "3, 4, 5, 6, 8")] + pub event: ::core::option::Option, +} +/// Nested message and enum types in `Event`. +pub mod event { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Row { + #[prost(uint64, tag = "1")] + pub start_ts: u64, + #[prost(uint64, tag = "2")] + pub commit_ts: u64, + #[prost(enumeration = "LogType", tag = "3")] + pub r#type: i32, + #[prost(enumeration = "row::OpType", tag = "4")] + pub op_type: i32, + #[prost(bytes = "vec", tag = "5")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "6")] + pub value: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "7")] + pub old_value: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `Row`. + pub mod row { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum OpType { + Unknown = 0, + Put = 1, + Delete = 2, + } + impl OpType { + /// 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 { + OpType::Unknown => "UNKNOWN", + OpType::Put => "PUT", + OpType::Delete => "DELETE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "PUT" => Some(Self::Put), + "DELETE" => Some(Self::Delete), + _ => None, + } + } + } + } + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Entries { + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, + } + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Admin { + #[prost(message, optional, tag = "1")] + pub admin_request: ::core::option::Option< + super::super::raft_cmdpb::AdminRequest, + >, + #[prost(message, optional, tag = "2")] + pub admin_response: ::core::option::Option< + super::super::raft_cmdpb::AdminResponse, + >, + } + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct LongTxn { + #[prost(message, repeated, tag = "1")] + pub txn_info: ::prost::alloc::vec::Vec, + } + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum LogType { + Unknown = 0, + Prewrite = 1, + Commit = 2, + Rollback = 3, + Committed = 4, + Initialized = 5, + } + impl LogType { + /// 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 { + LogType::Unknown => "UNKNOWN", + LogType::Prewrite => "PREWRITE", + LogType::Commit => "COMMIT", + LogType::Rollback => "ROLLBACK", + LogType::Committed => "COMMITTED", + LogType::Initialized => "INITIALIZED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "PREWRITE" => Some(Self::Prewrite), + "COMMIT" => Some(Self::Commit), + "ROLLBACK" => Some(Self::Rollback), + "COMMITTED" => Some(Self::Committed), + "INITIALIZED" => Some(Self::Initialized), + _ => None, + } + } + } + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Event { + #[prost(message, tag = "3")] + Entries(Entries), + #[prost(message, tag = "4")] + Admin(Admin), + #[prost(message, tag = "5")] + Error(super::Error), + #[prost(uint64, tag = "6")] + ResolvedTs(u64), + /// Note that field 7 is taken by request_id. + /// + /// More region level events ... + #[prost(message, tag = "8")] + LongTxn(LongTxn), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeDataEvent { + #[prost(message, repeated, tag = "1")] + pub events: ::prost::alloc::vec::Vec, + /// More store level events ... + #[prost(message, optional, tag = "2")] + pub resolved_ts: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResolvedTs { + #[prost(uint64, repeated, tag = "1")] + pub regions: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub ts: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangeDataRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(uint64, tag = "2")] + pub region_id: u64, + #[prost(message, optional, tag = "3")] + pub region_epoch: ::core::option::Option, + #[prost(uint64, tag = "4")] + pub checkpoint_ts: u64, + #[prost(bytes = "vec", tag = "5")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "6")] + pub end_key: ::prost::alloc::vec::Vec, + /// Used for CDC to identify events corresponding to different requests. + #[prost(uint64, tag = "7")] + pub request_id: u64, + #[prost(enumeration = "super::kvrpcpb::ExtraOp", tag = "8")] + pub extra_op: i32, + #[prost(oneof = "change_data_request::Request", tags = "9, 10")] + pub request: ::core::option::Option, +} +/// Nested message and enum types in `ChangeDataRequest`. +pub mod change_data_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Register {} + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct NotifyTxnStatus { + #[prost(message, repeated, tag = "1")] + pub txn_status: ::prost::alloc::vec::Vec, + } + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Request { + /// A normal request that trying to register change data feed on a region. + #[prost(message, tag = "9")] + Register(Register), + /// Notify the region that some of the running transactions on the region has a pushed + /// min_commit_ts so that the resolved_ts can be advanced. + #[prost(message, tag = "10")] + NotifyTxnStatus(NotifyTxnStatus), + } +} +/// Generated client implementations. +pub mod change_data_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ChangeDataClient { + inner: tonic::client::Grpc, + } + impl ChangeDataClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ChangeDataClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ChangeDataClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ChangeDataClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + pub async fn event_feed( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/cdcpb.ChangeData/EventFeed", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("cdcpb.ChangeData", "EventFeed")); + self.inner.streaming(req, path, codec).await + } + } +} diff --git a/src/generated/configpb.rs b/src/generated/configpb.rs new file mode 100644 index 00000000..48886295 --- /dev/null +++ b/src/generated/configpb.rs @@ -0,0 +1,407 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Status { + #[prost(enumeration = "StatusCode", tag = "1")] + pub code: i32, + #[prost(string, tag = "2")] + pub message: ::prost::alloc::string::String, +} +/// The version is used to tell the configuration which can be shared +/// or not apart. +/// Global version represents the version of these configuration +/// which can be shared, each kind of component only have one. +/// For local version, every component will have one to represent +/// the version of these configuration which cannot be shared. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Version { + #[prost(uint64, tag = "1")] + pub local: u64, + #[prost(uint64, tag = "2")] + pub global: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Local { + #[prost(string, tag = "1")] + pub component_id: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Global { + #[prost(string, tag = "1")] + pub component: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigKind { + #[prost(oneof = "config_kind::Kind", tags = "1, 2")] + pub kind: ::core::option::Option, +} +/// Nested message and enum types in `ConfigKind`. +pub mod config_kind { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Kind { + #[prost(message, tag = "1")] + Local(super::Local), + #[prost(message, tag = "2")] + Global(super::Global), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfigEntry { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub value: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LocalConfig { + #[prost(message, optional, tag = "1")] + pub version: ::core::option::Option, + #[prost(string, tag = "2")] + pub component: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub component_id: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub config: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Header { + #[prost(uint64, tag = "1")] + pub cluster_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub version: ::core::option::Option, + #[prost(string, tag = "3")] + pub component: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub component_id: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub config: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub status: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub version: ::core::option::Option, + #[prost(string, tag = "4")] + pub config: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub status: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub local_configs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub version: ::core::option::Option, + #[prost(string, tag = "3")] + pub component: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub component_id: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub status: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub version: ::core::option::Option, + #[prost(string, tag = "4")] + pub config: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub version: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub kind: ::core::option::Option, + #[prost(message, repeated, tag = "4")] + pub entries: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub status: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub version: ::core::option::Option, + #[prost(string, tag = "4")] + pub config: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub version: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub kind: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option
, + #[prost(message, optional, tag = "2")] + pub status: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub version: ::core::option::Option, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StatusCode { + Unknown = 0, + Ok = 1, + WrongVersion = 2, + NotChange = 3, + ComponentNotFound = 4, + ComponentIdNotFound = 5, +} +impl StatusCode { + /// 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 { + StatusCode::Unknown => "UNKNOWN", + StatusCode::Ok => "OK", + StatusCode::WrongVersion => "WRONG_VERSION", + StatusCode::NotChange => "NOT_CHANGE", + StatusCode::ComponentNotFound => "COMPONENT_NOT_FOUND", + StatusCode::ComponentIdNotFound => "COMPONENT_ID_NOT_FOUND", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "OK" => Some(Self::Ok), + "WRONG_VERSION" => Some(Self::WrongVersion), + "NOT_CHANGE" => Some(Self::NotChange), + "COMPONENT_NOT_FOUND" => Some(Self::ComponentNotFound), + "COMPONENT_ID_NOT_FOUND" => Some(Self::ComponentIdNotFound), + _ => None, + } + } +} +/// Generated client implementations. +pub mod config_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct ConfigClient { + inner: tonic::client::Grpc, + } + impl ConfigClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ConfigClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ConfigClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ConfigClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + pub async fn create( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/configpb.Config/Create"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("configpb.Config", "Create")); + self.inner.unary(req, path, codec).await + } + pub async fn get_all( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/configpb.Config/GetAll"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("configpb.Config", "GetAll")); + self.inner.unary(req, path, codec).await + } + pub async fn get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/configpb.Config/Get"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("configpb.Config", "Get")); + self.inner.unary(req, path, codec).await + } + pub async fn update( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/configpb.Config/Update"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("configpb.Config", "Update")); + self.inner.unary(req, path, codec).await + } + pub async fn delete( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/configpb.Config/Delete"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("configpb.Config", "Delete")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/coprocessor.rs b/src/generated/coprocessor.rs new file mode 100644 index 00000000..54ceb882 --- /dev/null +++ b/src/generated/coprocessor.rs @@ -0,0 +1,106 @@ +/// [start, end) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyRange { + #[prost(bytes = "vec", tag = "1")] + pub start: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub end: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Request { + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + #[prost(int64, tag = "2")] + pub tp: i64, + #[prost(bytes = "vec", tag = "3")] + pub data: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "7")] + pub start_ts: u64, + #[prost(message, repeated, tag = "4")] + pub ranges: ::prost::alloc::vec::Vec, + /// If cache is enabled, TiKV returns cache hit instead of data if + /// its last version matches this `cache_if_match_version`. + #[prost(bool, tag = "5")] + pub is_cache_enabled: bool, + #[prost(uint64, tag = "6")] + pub cache_if_match_version: u64, + /// Any schema-ful storage to validate schema correctness if necessary. + #[prost(int64, tag = "8")] + pub schema_ver: i64, + #[prost(bool, tag = "9")] + pub is_trace_enabled: bool, + /// paging_size is 0 when it's disabled, otherwise, it should be a positive number. + #[prost(uint64, tag = "10")] + pub paging_size: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Response { + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub region_error: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub locked: ::core::option::Option, + #[prost(string, tag = "4")] + pub other_error: ::prost::alloc::string::String, + #[prost(message, optional, tag = "5")] + pub range: ::core::option::Option, + /// This field is always filled for compatibility consideration. However + /// newer TiDB should respect `exec_details_v2` field instead. + #[prost(message, optional, tag = "6")] + pub exec_details: ::core::option::Option, + /// This field is provided in later versions, containing more detailed + /// information. + #[prost(message, optional, tag = "11")] + pub exec_details_v2: ::core::option::Option, + #[prost(bool, tag = "7")] + pub is_cache_hit: bool, + #[prost(uint64, tag = "8")] + pub cache_last_version: u64, + #[prost(bool, tag = "9")] + pub can_be_cached: bool, + #[prost(message, repeated, tag = "10")] + pub spans: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionInfo { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub region_epoch: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub ranges: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchRequest { + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + #[prost(int64, tag = "2")] + pub tp: i64, + #[prost(bytes = "vec", tag = "3")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "4")] + pub regions: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "5")] + pub start_ts: u64, + /// Any schema-ful storage to validate schema correctness if necessary. + #[prost(int64, tag = "6")] + pub schema_ver: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchResponse { + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(string, tag = "2")] + pub other_error: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub exec_details: ::core::option::Option, + #[prost(message, repeated, tag = "4")] + pub retry_regions: ::prost::alloc::vec::Vec, +} diff --git a/src/generated/deadlock.rs b/src/generated/deadlock.rs new file mode 100644 index 00000000..ed760b98 --- /dev/null +++ b/src/generated/deadlock.rs @@ -0,0 +1,223 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WaitForEntriesRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WaitForEntriesResponse { + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WaitForEntry { + /// The transaction id that is waiting. + #[prost(uint64, tag = "1")] + pub txn: u64, + /// The transaction id that is being waited for. + #[prost(uint64, tag = "2")] + pub wait_for_txn: u64, + /// The hash value of the key is being waited for. + #[prost(uint64, tag = "3")] + pub key_hash: u64, + /// The key the current txn is trying to lock. + #[prost(bytes = "vec", tag = "4")] + pub key: ::prost::alloc::vec::Vec, + /// The tag came from the lock request's context. + #[prost(bytes = "vec", tag = "5")] + pub resource_group_tag: ::prost::alloc::vec::Vec, + /// Milliseconds it has been waits. + #[prost(uint64, tag = "6")] + pub wait_time: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeadlockRequest { + #[prost(enumeration = "DeadlockRequestType", tag = "1")] + pub tp: i32, + #[prost(message, optional, tag = "2")] + pub entry: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeadlockResponse { + /// The same entry sent by DeadlockRequest, identifies the sender. + #[prost(message, optional, tag = "1")] + pub entry: ::core::option::Option, + /// The key hash of the lock that is hold by the waiting transaction. + #[prost(uint64, tag = "2")] + pub deadlock_key_hash: u64, + /// The other entries of the dead lock circle. The current entry is in `entry` field and not + /// included in this field. + #[prost(message, repeated, tag = "3")] + pub wait_chain: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum DeadlockRequestType { + Detect = 0, + /// CleanUpWaitFor cleans a single entry the transaction is waiting. + CleanUpWaitFor = 1, + /// CleanUp cleans all entries the transaction is waiting. + CleanUp = 2, +} +impl DeadlockRequestType { + /// 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 { + DeadlockRequestType::Detect => "Detect", + DeadlockRequestType::CleanUpWaitFor => "CleanUpWaitFor", + DeadlockRequestType::CleanUp => "CleanUp", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Detect" => Some(Self::Detect), + "CleanUpWaitFor" => Some(Self::CleanUpWaitFor), + "CleanUp" => Some(Self::CleanUp), + _ => None, + } + } +} +/// Generated client implementations. +pub mod deadlock_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct DeadlockClient { + inner: tonic::client::Grpc, + } + impl DeadlockClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl DeadlockClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> DeadlockClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + DeadlockClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Get local wait for entries, should be handle by every node. + /// The owner should sent this request to all members to build the complete wait for graph. + pub async fn get_wait_for_entries( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/deadlock.Deadlock/GetWaitForEntries", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("deadlock.Deadlock", "GetWaitForEntries")); + self.inner.unary(req, path, codec).await + } + /// Detect should only sent to the owner. only be handled by the owner. + /// The DeadlockResponse is sent back only if there is deadlock detected. + /// CleanUpWaitFor and CleanUp doesn't return responses. + pub async fn detect( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/deadlock.Deadlock/Detect"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("deadlock.Deadlock", "Detect")); + self.inner.streaming(req, path, codec).await + } + } +} diff --git a/src/generated/debugpb.rs b/src/generated/debugpb.rs new file mode 100644 index 00000000..ae7fb059 --- /dev/null +++ b/src/generated/debugpb.rs @@ -0,0 +1,848 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRequest { + #[prost(enumeration = "Db", tag = "1")] + pub db: i32, + #[prost(string, tag = "2")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "3")] + pub key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetResponse { + #[prost(bytes = "vec", tag = "1")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftLogRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint64, tag = "2")] + pub log_index: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftLogResponse { + #[prost(message, optional, tag = "1")] + pub entry: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionInfoRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionInfoResponse { + #[prost(message, optional, tag = "1")] + pub raft_local_state: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub raft_apply_state: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region_local_state: ::core::option::Option< + super::raft_serverpb::RegionLocalState, + >, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionSizeRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(string, repeated, tag = "2")] + pub cfs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionSizeResponse { + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `RegionSizeResponse`. +pub mod region_size_response { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Entry { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub size: u64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScanMvccRequest { + #[prost(bytes = "vec", tag = "1")] + pub from_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub to_key: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub limit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScanMvccResponse { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub info: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactRequest { + #[prost(enumeration = "Db", tag = "1")] + pub db: i32, + #[prost(string, tag = "2")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "3")] + pub from_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "4")] + pub to_key: ::prost::alloc::vec::Vec, + #[prost(uint32, tag = "5")] + pub threads: u32, + #[prost(enumeration = "BottommostLevelCompaction", tag = "6")] + pub bottommost_level_compaction: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InjectFailPointRequest { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub actions: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InjectFailPointResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RecoverFailPointRequest { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RecoverFailPointResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListFailPointsRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListFailPointsResponse { + #[prost(message, repeated, tag = "1")] + pub entries: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `ListFailPointsResponse`. +pub mod list_fail_points_response { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Entry { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub actions: ::prost::alloc::string::String, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMetricsRequest { + #[prost(bool, tag = "1")] + pub all: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMetricsResponse { + #[prost(string, tag = "1")] + pub prometheus: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub rocksdb_kv: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub rocksdb_raft: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub jemalloc: ::prost::alloc::string::String, + #[prost(uint64, tag = "5")] + pub store_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionConsistencyCheckRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionConsistencyCheckResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModifyTikvConfigRequest { + #[prost(enumeration = "Module", tag = "1")] + pub module: i32, + #[prost(string, tag = "2")] + pub config_name: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub config_value: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ModifyTikvConfigResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Property { + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub value: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRegionPropertiesRequest { + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRegionPropertiesResponse { + #[prost(message, repeated, tag = "1")] + pub props: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetStoreInfoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetStoreInfoResponse { + #[prost(uint64, tag = "1")] + pub store_id: u64, + #[prost(enumeration = "super::kvrpcpb::ApiVersion", tag = "2")] + pub api_version: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetClusterInfoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetClusterInfoResponse { + #[prost(uint64, tag = "1")] + pub cluster_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllRegionsInStoreRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllRegionsInStoreResponse { + #[prost(uint64, repeated, tag = "1")] + pub regions: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Db { + Invalid = 0, + Kv = 1, + Raft = 2, +} +impl Db { + /// 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 { + Db::Invalid => "INVALID", + Db::Kv => "KV", + Db::Raft => "RAFT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "INVALID" => Some(Self::Invalid), + "KV" => Some(Self::Kv), + "RAFT" => Some(Self::Raft), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Module { + Unused = 0, + Kvdb = 1, + Raftdb = 2, + Readpool = 3, + Server = 4, + Storage = 5, + Pd = 6, + Metric = 7, + Coprocessor = 8, + Security = 9, + Import = 10, +} +impl Module { + /// 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 { + Module::Unused => "UNUSED", + Module::Kvdb => "KVDB", + Module::Raftdb => "RAFTDB", + Module::Readpool => "READPOOL", + Module::Server => "SERVER", + Module::Storage => "STORAGE", + Module::Pd => "PD", + Module::Metric => "METRIC", + Module::Coprocessor => "COPROCESSOR", + Module::Security => "SECURITY", + Module::Import => "IMPORT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNUSED" => Some(Self::Unused), + "KVDB" => Some(Self::Kvdb), + "RAFTDB" => Some(Self::Raftdb), + "READPOOL" => Some(Self::Readpool), + "SERVER" => Some(Self::Server), + "STORAGE" => Some(Self::Storage), + "PD" => Some(Self::Pd), + "METRIC" => Some(Self::Metric), + "COPROCESSOR" => Some(Self::Coprocessor), + "SECURITY" => Some(Self::Security), + "IMPORT" => Some(Self::Import), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum BottommostLevelCompaction { + /// Skip bottommost level compaction + Skip = 0, + /// Force bottommost level compaction + Force = 1, + /// Compact bottommost level if there is a compaction filter. + IfHaveCompactionFilter = 2, +} +impl BottommostLevelCompaction { + /// 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 { + BottommostLevelCompaction::Skip => "Skip", + BottommostLevelCompaction::Force => "Force", + BottommostLevelCompaction::IfHaveCompactionFilter => "IfHaveCompactionFilter", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Skip" => Some(Self::Skip), + "Force" => Some(Self::Force), + "IfHaveCompactionFilter" => Some(Self::IfHaveCompactionFilter), + _ => None, + } + } +} +/// Generated client implementations. +pub mod debug_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Debug service for TiKV. + /// + /// Errors are defined as follow: + /// - OK: Okay, we are good! + /// - UNKNOWN: For unknown error. + /// - 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. + /// Note: It bypasses raft layer. + #[derive(Debug, Clone)] + pub struct DebugClient { + inner: tonic::client::Grpc, + } + impl DebugClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl DebugClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> DebugClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + DebugClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Read a value arbitrarily for a key. + /// Note: Server uses key directly w/o any encoding. + pub async fn get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/Get"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "Get")); + self.inner.unary(req, path, codec).await + } + /// Read raft info. + pub async fn raft_log( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/RaftLog"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "RaftLog")); + self.inner.unary(req, path, codec).await + } + pub async fn region_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/RegionInfo"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "RegionInfo")); + self.inner.unary(req, path, codec).await + } + /// Calculate size of a region. + /// Note: DO NOT CALL IT IN PRODUCTION, it's really expensive. + pub async fn region_size( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/RegionSize"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "RegionSize")); + self.inner.unary(req, path, codec).await + } + /// Scan a specific range. + /// Note: DO NOT CALL IT IN PRODUCTION, it's really expensive. + /// Server uses keys directly w/o any encoding. + pub async fn scan_mvcc( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/ScanMvcc"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "ScanMvcc")); + self.inner.server_streaming(req, path, codec).await + } + /// Compact a column family in a specified range. + /// Note: Server uses keys directly w/o any encoding. + pub async fn compact( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/Compact"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "Compact")); + self.inner.unary(req, path, codec).await + } + /// Inject a fail point. Currently, it's only used in tests. + /// Note: DO NOT CALL IT IN PRODUCTION. + pub async fn inject_fail_point( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/InjectFailPoint", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "InjectFailPoint")); + self.inner.unary(req, path, codec).await + } + /// Recover from a fail point. + pub async fn recover_fail_point( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/RecoverFailPoint", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "RecoverFailPoint")); + self.inner.unary(req, path, codec).await + } + /// List all fail points. + pub async fn list_fail_points( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/ListFailPoints", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "ListFailPoints")); + self.inner.unary(req, path, codec).await + } + /// Get Metrics + pub async fn get_metrics( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/debugpb.Debug/GetMetrics"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("debugpb.Debug", "GetMetrics")); + self.inner.unary(req, path, codec).await + } + /// Do a consistent check for a region. + pub async fn check_region_consistency( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/CheckRegionConsistency", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "CheckRegionConsistency")); + self.inner.unary(req, path, codec).await + } + /// dynamically modify tikv's config + pub async fn modify_tikv_config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/ModifyTikvConfig", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "ModifyTikvConfig")); + self.inner.unary(req, path, codec).await + } + /// Get region properties + pub async fn get_region_properties( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/GetRegionProperties", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "GetRegionProperties")); + self.inner.unary(req, path, codec).await + } + /// Get store ID + pub async fn get_store_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/GetStoreInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "GetStoreInfo")); + self.inner.unary(req, path, codec).await + } + /// Get cluster ID + pub async fn get_cluster_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/GetClusterInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "GetClusterInfo")); + self.inner.unary(req, path, codec).await + } + /// Get all region IDs in the store + pub async fn get_all_regions_in_store( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/debugpb.Debug/GetAllRegionsInStore", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("debugpb.Debug", "GetAllRegionsInStore")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/diagnosticspb.rs b/src/generated/diagnosticspb.rs new file mode 100644 index 00000000..c1844c20 --- /dev/null +++ b/src/generated/diagnosticspb.rs @@ -0,0 +1,326 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SearchLogRequest { + #[prost(int64, tag = "1")] + pub start_time: i64, + #[prost(int64, tag = "2")] + pub end_time: i64, + #[prost(enumeration = "LogLevel", repeated, tag = "3")] + pub levels: ::prost::alloc::vec::Vec, + /// We use a string array to represent multiple CNF pattern sceniaor like: + /// SELECT * FROM t WHERE c LIKE '%s%' and c REGEXP '.*a.*' because + /// Golang and Rust don't support perl-like (?=re1)(?=re2) + #[prost(string, repeated, tag = "4")] + pub patterns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(enumeration = "search_log_request::Target", tag = "5")] + pub target: i32, +} +/// Nested message and enum types in `SearchLogRequest`. +pub mod search_log_request { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Target { + Normal = 0, + Slow = 1, + } + impl Target { + /// 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 { + Target::Normal => "Normal", + Target::Slow => "Slow", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Normal" => Some(Self::Normal), + "Slow" => Some(Self::Slow), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SearchLogResponse { + #[prost(message, repeated, tag = "1")] + pub messages: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LogMessage { + #[prost(int64, tag = "1")] + pub time: i64, + #[prost(enumeration = "LogLevel", tag = "2")] + pub level: i32, + #[prost(string, tag = "3")] + pub message: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerInfoRequest { + #[prost(enumeration = "ServerInfoType", tag = "1")] + pub tp: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerInfoPair { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub value: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerInfoItem { + /// cpu, memory, disk, network ... + #[prost(string, tag = "1")] + pub tp: ::prost::alloc::string::String, + /// eg. network: lo1/eth0, cpu: core1/core2, disk: sda1/sda2 + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, + /// all key-value pairs for specified item, e.g: + /// ServerInfoItem { + /// tp = "network" + /// name = "eth0" + /// paris = [ + /// ServerInfoPair { key = "readbytes", value = "4k"}, + /// ServerInfoPair { key = "writebytes", value = "1k"}, + /// ] + /// } + #[prost(message, repeated, tag = "3")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerInfoResponse { + #[prost(message, repeated, tag = "1")] + pub items: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum LogLevel { + Unknown = 0, + Debug = 1, + Info = 2, + Warn = 3, + Trace = 4, + Critical = 5, + Error = 6, +} +impl LogLevel { + /// 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 { + LogLevel::Unknown => "UNKNOWN", + LogLevel::Debug => "Debug", + LogLevel::Info => "Info", + LogLevel::Warn => "Warn", + LogLevel::Trace => "Trace", + LogLevel::Critical => "Critical", + LogLevel::Error => "Error", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "Debug" => Some(Self::Debug), + "Info" => Some(Self::Info), + "Warn" => Some(Self::Warn), + "Trace" => Some(Self::Trace), + "Critical" => Some(Self::Critical), + "Error" => Some(Self::Error), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ServerInfoType { + All = 0, + HardwareInfo = 1, + SystemInfo = 2, + LoadInfo = 3, +} +impl ServerInfoType { + /// 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 { + ServerInfoType::All => "All", + ServerInfoType::HardwareInfo => "HardwareInfo", + ServerInfoType::SystemInfo => "SystemInfo", + ServerInfoType::LoadInfo => "LoadInfo", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "All" => Some(Self::All), + "HardwareInfo" => Some(Self::HardwareInfo), + "SystemInfo" => Some(Self::SystemInfo), + "LoadInfo" => Some(Self::LoadInfo), + _ => None, + } + } +} +/// Generated client implementations. +pub mod diagnostics_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Diagnostics service for TiDB cluster components. + #[derive(Debug, Clone)] + pub struct DiagnosticsClient { + inner: tonic::client::Grpc, + } + impl DiagnosticsClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl DiagnosticsClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> DiagnosticsClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + DiagnosticsClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Searchs log in the target node + pub async fn search_log( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/diagnosticspb.Diagnostics/search_log", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("diagnosticspb.Diagnostics", "search_log")); + self.inner.server_streaming(req, path, codec).await + } + /// Retrieves server info in the target node + pub async fn server_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/diagnosticspb.Diagnostics/server_info", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("diagnosticspb.Diagnostics", "server_info")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/disk_usage.rs b/src/generated/disk_usage.rs new file mode 100644 index 00000000..6f4292af --- /dev/null +++ b/src/generated/disk_usage.rs @@ -0,0 +1,29 @@ +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum DiskUsage { + Normal = 0, + AlmostFull = 1, + AlreadyFull = 2, +} +impl DiskUsage { + /// 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 { + DiskUsage::Normal => "Normal", + DiskUsage::AlmostFull => "AlmostFull", + DiskUsage::AlreadyFull => "AlreadyFull", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Normal" => Some(Self::Normal), + "AlmostFull" => Some(Self::AlmostFull), + "AlreadyFull" => Some(Self::AlreadyFull), + _ => None, + } + } +} diff --git a/src/generated/encryptionpb.rs b/src/generated/encryptionpb.rs new file mode 100644 index 00000000..26c2be81 --- /dev/null +++ b/src/generated/encryptionpb.rs @@ -0,0 +1,170 @@ +/// General encryption metadata for any data type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EncryptionMeta { + /// ID of the key used to encrypt the data. + #[prost(uint64, tag = "1")] + pub key_id: u64, + /// Initialization vector (IV) of the data. + #[prost(bytes = "vec", tag = "2")] + pub iv: ::prost::alloc::vec::Vec, +} +/// Information about an encrypted file. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FileInfo { + /// ID of the key used to encrypt the file. + #[prost(uint64, tag = "1")] + pub key_id: u64, + /// Initialization vector (IV) of the file. + #[prost(bytes = "vec", tag = "2")] + pub iv: ::prost::alloc::vec::Vec, + /// Method of encryption algorithm used to encrypted the file. + #[prost(enumeration = "EncryptionMethod", tag = "3")] + pub method: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FileDictionary { + /// A map of file name to file info. + #[prost(map = "string, message", tag = "1")] + pub files: ::std::collections::HashMap<::prost::alloc::string::String, FileInfo>, +} +/// The key used to encrypt the user data. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DataKey { + /// A sequence of secret bytes used to encrypt data. + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// Method of encryption algorithm used to encrypted data. + #[prost(enumeration = "EncryptionMethod", tag = "2")] + pub method: i32, + /// Creation time of the key. + #[prost(uint64, tag = "3")] + pub creation_time: u64, + /// A flag for the key have ever been exposed. + #[prost(bool, tag = "4")] + pub was_exposed: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyDictionary { + /// A map of key ID to dat key. + #[prost(map = "uint64, message", tag = "1")] + pub keys: ::std::collections::HashMap, + /// ID of a key currently in use. + #[prost(uint64, tag = "2")] + pub current_key_id: u64, +} +/// Master key config. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterKey { + #[prost(oneof = "master_key::Backend", tags = "1, 2, 3")] + pub backend: ::core::option::Option, +} +/// Nested message and enum types in `MasterKey`. +pub mod master_key { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Backend { + #[prost(message, tag = "1")] + Plaintext(super::MasterKeyPlaintext), + #[prost(message, tag = "2")] + File(super::MasterKeyFile), + #[prost(message, tag = "3")] + Kms(super::MasterKeyKms), + } +} +/// MasterKeyPlaintext indicates content is stored as plaintext. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterKeyPlaintext {} +/// MasterKeyFile is a master key backed by a file containing encryption key in human-readable +/// hex format. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterKeyFile { + /// Local file path. + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, +} +/// MasterKeyKms is a master key backed by KMS service that manages the encryption key, +/// and provide API to encrypt and decrypt a data key, which is used to encrypt the content. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterKeyKms { + /// KMS vendor. + #[prost(string, tag = "1")] + pub vendor: ::prost::alloc::string::String, + /// KMS key id. + #[prost(string, tag = "2")] + pub key_id: ::prost::alloc::string::String, + /// KMS region. + #[prost(string, tag = "3")] + pub region: ::prost::alloc::string::String, + /// KMS endpoint. Normally not needed. + #[prost(string, tag = "4")] + pub endpoint: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EncryptedContent { + /// Metadata of the encrypted content. + /// Eg. IV, method and KMS key ID + /// It is preferred to define new fields for extra metadata than using this metadata map. + #[prost(map = "string, bytes", tag = "1")] + pub metadata: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::vec::Vec, + >, + /// Encrypted content. + #[prost(bytes = "vec", tag = "2")] + pub content: ::prost::alloc::vec::Vec, + /// Master key used to encrypt the content. + #[prost(message, optional, tag = "3")] + pub master_key: ::core::option::Option, + /// Initilization vector (IV) used. + #[prost(bytes = "vec", tag = "4")] + pub iv: ::prost::alloc::vec::Vec, + /// Encrypted data key generated by KMS and used to actually encrypt data. + /// Valid only when KMS is used. + #[prost(bytes = "vec", tag = "5")] + pub ciphertext_key: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EncryptionMethod { + Unknown = 0, + Plaintext = 1, + Aes128Ctr = 2, + Aes192Ctr = 3, + Aes256Ctr = 4, +} +impl EncryptionMethod { + /// 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 { + EncryptionMethod::Unknown => "UNKNOWN", + EncryptionMethod::Plaintext => "PLAINTEXT", + EncryptionMethod::Aes128Ctr => "AES128_CTR", + EncryptionMethod::Aes192Ctr => "AES192_CTR", + EncryptionMethod::Aes256Ctr => "AES256_CTR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "PLAINTEXT" => Some(Self::Plaintext), + "AES128_CTR" => Some(Self::Aes128Ctr), + "AES192_CTR" => Some(Self::Aes192Ctr), + "AES256_CTR" => Some(Self::Aes256Ctr), + _ => None, + } + } +} diff --git a/src/generated/enginepb.rs b/src/generated/enginepb.rs new file mode 100644 index 00000000..486cefec --- /dev/null +++ b/src/generated/enginepb.rs @@ -0,0 +1,244 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandRequestHeader { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint64, tag = "2")] + pub index: u64, + #[prost(uint64, tag = "3")] + pub term: u64, + /// Flush in-memory data to disk. + #[prost(bool, tag = "4")] + pub sync_log: bool, + /// Destroy the region. + #[prost(bool, tag = "5")] + pub destroy: bool, + /// Additional information for the request. + #[prost(bytes = "vec", tag = "6")] + pub context: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// kv put / delete + #[prost(message, repeated, tag = "2")] + pub requests: ::prost::alloc::vec::Vec, + /// region metadata manipulation command. + #[prost(message, optional, tag = "3")] + pub admin_request: ::core::option::Option, + /// region metadata manipulation result. + #[prost(message, optional, tag = "4")] + pub admin_response: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandRequestBatch { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandResponseHeader { + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Region is destroyed. + #[prost(bool, tag = "2")] + pub destroyed: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub apply_state: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub applied_term: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommandResponseBatch { + #[prost(message, repeated, tag = "1")] + pub responses: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotState { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub peer: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub apply_state: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotData { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(uint32, tag = "2")] + pub checksum: u32, + #[prost(message, repeated, tag = "3")] + pub data: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotRequest { + #[prost(oneof = "snapshot_request::Chunk", tags = "1, 2")] + pub chunk: ::core::option::Option, +} +/// Nested message and enum types in `SnapshotRequest`. +pub mod snapshot_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Chunk { + /// The first message for snapshots. + /// It contains the latest region information after applied snapshot. + #[prost(message, tag = "1")] + State(super::SnapshotState), + /// Following messages are always data. + #[prost(message, tag = "2")] + Data(super::SnapshotData), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotDone {} +/// Generated client implementations. +pub mod engine_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct EngineClient { + inner: tonic::client::Grpc, + } + impl EngineClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl EngineClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> EngineClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + EngineClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + pub async fn apply_command_batch( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::CommandRequestBatch, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/enginepb.Engine/ApplyCommandBatch", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("enginepb.Engine", "ApplyCommandBatch")); + self.inner.streaming(req, path, codec).await + } + pub async fn apply_snapshot( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/enginepb.Engine/ApplySnapshot", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("enginepb.Engine", "ApplySnapshot")); + self.inner.client_streaming(req, path, codec).await + } + } +} diff --git a/src/generated/eraftpb.rs b/src/generated/eraftpb.rs new file mode 100644 index 00000000..c2920dca --- /dev/null +++ b/src/generated/eraftpb.rs @@ -0,0 +1,351 @@ +/// The entry is a type of change that needs to be applied. It contains two data fields. +/// While the fields are built into the model; their usage is determined by the entry_type. +/// +/// For normal entries, the data field should contain the data change that should be applied. +/// The context field can be used for any contextual data that might be relevant to the +/// application of the data. +/// +/// For configuration changes, the data will contain the ConfChange message and the +/// context will provide anything needed to assist the configuration change. The context +/// if for the user to set and use in this case. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Entry { + #[prost(enumeration = "EntryType", tag = "1")] + pub entry_type: i32, + #[prost(uint64, tag = "2")] + pub term: u64, + #[prost(uint64, tag = "3")] + pub index: u64, + #[prost(bytes = "vec", tag = "4")] + pub data: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "6")] + pub context: ::prost::alloc::vec::Vec, + /// Deprecated! It is kept for backward compatibility. + /// TODO: remove it in the next major release. + #[prost(bool, tag = "5")] + pub sync_log: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotMetadata { + /// The current `ConfState`. + #[prost(message, optional, tag = "1")] + pub conf_state: ::core::option::Option, + /// The applied index. + #[prost(uint64, tag = "2")] + pub index: u64, + /// The term of the applied index. + #[prost(uint64, tag = "3")] + pub term: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Snapshot { + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub metadata: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Message { + #[prost(enumeration = "MessageType", tag = "1")] + pub msg_type: i32, + #[prost(uint64, tag = "2")] + pub to: u64, + #[prost(uint64, tag = "3")] + pub from: u64, + #[prost(uint64, tag = "4")] + pub term: u64, + #[prost(uint64, tag = "5")] + pub log_term: u64, + #[prost(uint64, tag = "6")] + pub index: u64, + #[prost(message, repeated, tag = "7")] + pub entries: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "8")] + pub commit: u64, + #[prost(message, optional, tag = "9")] + pub snapshot: ::core::option::Option, + #[prost(uint64, tag = "13")] + pub request_snapshot: u64, + #[prost(bool, tag = "10")] + pub reject: bool, + #[prost(uint64, tag = "11")] + pub reject_hint: u64, + #[prost(bytes = "vec", tag = "12")] + pub context: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "14")] + pub priority: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HardState { + #[prost(uint64, tag = "1")] + pub term: u64, + #[prost(uint64, tag = "2")] + pub vote: u64, + #[prost(uint64, tag = "3")] + pub commit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfState { + #[prost(uint64, repeated, tag = "1")] + pub voters: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "2")] + pub learners: ::prost::alloc::vec::Vec, + /// The voters in the outgoing config. If not empty the node is in joint consensus. + #[prost(uint64, repeated, tag = "3")] + pub voters_outgoing: ::prost::alloc::vec::Vec, + /// The nodes that will become learners when the outgoing config is removed. + /// These nodes are necessarily currently in nodes_joint (or they would have + /// been added to the incoming config right away). + #[prost(uint64, repeated, tag = "4")] + pub learners_next: ::prost::alloc::vec::Vec, + /// If set, the config is joint and Raft will automatically transition into + /// the final config (i.e. remove the outgoing config) when this is safe. + #[prost(bool, tag = "5")] + pub auto_leave: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfChange { + #[prost(enumeration = "ConfChangeType", tag = "2")] + pub change_type: i32, + #[prost(uint64, tag = "3")] + pub node_id: u64, + #[prost(bytes = "vec", tag = "4")] + pub context: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "1")] + pub id: u64, +} +/// ConfChangeSingle is an individual configuration change operation. Multiple +/// such operations can be carried out atomically via a ConfChangeV2. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfChangeSingle { + #[prost(enumeration = "ConfChangeType", tag = "1")] + pub change_type: i32, + #[prost(uint64, tag = "2")] + pub node_id: u64, +} +/// ConfChangeV2 messages initiate configuration changes. They support both the +/// simple "one at a time" membership change protocol and full Joint Consensus +/// allowing for arbitrary changes in membership. +/// +/// The supplied context is treated as an opaque payload and can be used to +/// attach an action on the state machine to the application of the config change +/// proposal. Note that contrary to Joint Consensus as outlined in the Raft +/// paper\[1\], configuration changes become active when they are *applied* to the +/// state machine (not when they are appended to the log). +/// +/// The simple protocol can be used whenever only a single change is made. +/// +/// Non-simple changes require the use of Joint Consensus, for which two +/// configuration changes are run. The first configuration change specifies the +/// desired changes and transitions the Raft group into the joint configuration, +/// in which quorum requires a majority of both the pre-changes and post-changes +/// configuration. Joint Consensus avoids entering fragile intermediate +/// configurations that could compromise survivability. For example, without the +/// use of Joint Consensus and running across three availability zones with a +/// replication factor of three, it is not possible to replace a voter without +/// entering an intermediate configuration that does not survive the outage of +/// one availability zone. +/// +/// The provided ConfChangeTransition specifies how (and whether) Joint Consensus +/// is used, and assigns the task of leaving the joint configuration either to +/// Raft or the application. Leaving the joint configuration is accomplished by +/// proposing a ConfChangeV2 with only and optionally the Context field +/// populated. +/// +/// For details on Raft membership changes, see: +/// +/// \[1\]: +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConfChangeV2 { + #[prost(enumeration = "ConfChangeTransition", tag = "1")] + pub transition: i32, + #[prost(message, repeated, tag = "2")] + pub changes: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub context: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EntryType { + EntryNormal = 0, + EntryConfChange = 1, + EntryConfChangeV2 = 2, +} +impl EntryType { + /// 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 { + EntryType::EntryNormal => "EntryNormal", + EntryType::EntryConfChange => "EntryConfChange", + EntryType::EntryConfChangeV2 => "EntryConfChangeV2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "EntryNormal" => Some(Self::EntryNormal), + "EntryConfChange" => Some(Self::EntryConfChange), + "EntryConfChangeV2" => Some(Self::EntryConfChangeV2), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum MessageType { + MsgHup = 0, + MsgBeat = 1, + MsgPropose = 2, + MsgAppend = 3, + MsgAppendResponse = 4, + MsgRequestVote = 5, + MsgRequestVoteResponse = 6, + MsgSnapshot = 7, + MsgHeartbeat = 8, + MsgHeartbeatResponse = 9, + MsgUnreachable = 10, + MsgSnapStatus = 11, + MsgCheckQuorum = 12, + MsgTransferLeader = 13, + MsgTimeoutNow = 14, + MsgReadIndex = 15, + MsgReadIndexResp = 16, + MsgRequestPreVote = 17, + MsgRequestPreVoteResponse = 18, +} +impl MessageType { + /// 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 { + MessageType::MsgHup => "MsgHup", + MessageType::MsgBeat => "MsgBeat", + MessageType::MsgPropose => "MsgPropose", + MessageType::MsgAppend => "MsgAppend", + MessageType::MsgAppendResponse => "MsgAppendResponse", + MessageType::MsgRequestVote => "MsgRequestVote", + MessageType::MsgRequestVoteResponse => "MsgRequestVoteResponse", + MessageType::MsgSnapshot => "MsgSnapshot", + MessageType::MsgHeartbeat => "MsgHeartbeat", + MessageType::MsgHeartbeatResponse => "MsgHeartbeatResponse", + MessageType::MsgUnreachable => "MsgUnreachable", + MessageType::MsgSnapStatus => "MsgSnapStatus", + MessageType::MsgCheckQuorum => "MsgCheckQuorum", + MessageType::MsgTransferLeader => "MsgTransferLeader", + MessageType::MsgTimeoutNow => "MsgTimeoutNow", + MessageType::MsgReadIndex => "MsgReadIndex", + MessageType::MsgReadIndexResp => "MsgReadIndexResp", + MessageType::MsgRequestPreVote => "MsgRequestPreVote", + MessageType::MsgRequestPreVoteResponse => "MsgRequestPreVoteResponse", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MsgHup" => Some(Self::MsgHup), + "MsgBeat" => Some(Self::MsgBeat), + "MsgPropose" => Some(Self::MsgPropose), + "MsgAppend" => Some(Self::MsgAppend), + "MsgAppendResponse" => Some(Self::MsgAppendResponse), + "MsgRequestVote" => Some(Self::MsgRequestVote), + "MsgRequestVoteResponse" => Some(Self::MsgRequestVoteResponse), + "MsgSnapshot" => Some(Self::MsgSnapshot), + "MsgHeartbeat" => Some(Self::MsgHeartbeat), + "MsgHeartbeatResponse" => Some(Self::MsgHeartbeatResponse), + "MsgUnreachable" => Some(Self::MsgUnreachable), + "MsgSnapStatus" => Some(Self::MsgSnapStatus), + "MsgCheckQuorum" => Some(Self::MsgCheckQuorum), + "MsgTransferLeader" => Some(Self::MsgTransferLeader), + "MsgTimeoutNow" => Some(Self::MsgTimeoutNow), + "MsgReadIndex" => Some(Self::MsgReadIndex), + "MsgReadIndexResp" => Some(Self::MsgReadIndexResp), + "MsgRequestPreVote" => Some(Self::MsgRequestPreVote), + "MsgRequestPreVoteResponse" => Some(Self::MsgRequestPreVoteResponse), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ConfChangeTransition { + /// Automatically use the simple protocol if possible, otherwise fall back + /// to ConfChangeType::Implicit. Most applications will want to use this. + Auto = 0, + /// Use joint consensus unconditionally, and transition out of them + /// automatically (by proposing a zero configuration change). + /// + /// This option is suitable for applications that want to minimize the time + /// spent in the joint configuration and do not store the joint configuration + /// in the state machine (outside of InitialState). + Implicit = 1, + /// Use joint consensus and remain in the joint configuration until the + /// application proposes a no-op configuration change. This is suitable for + /// applications that want to explicitly control the transitions, for example + /// to use a custom payload (via the Context field). + Explicit = 2, +} +impl ConfChangeTransition { + /// 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 { + ConfChangeTransition::Auto => "Auto", + ConfChangeTransition::Implicit => "Implicit", + ConfChangeTransition::Explicit => "Explicit", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Auto" => Some(Self::Auto), + "Implicit" => Some(Self::Implicit), + "Explicit" => Some(Self::Explicit), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ConfChangeType { + AddNode = 0, + RemoveNode = 1, + AddLearnerNode = 2, +} +impl ConfChangeType { + /// 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 { + ConfChangeType::AddNode => "AddNode", + ConfChangeType::RemoveNode => "RemoveNode", + ConfChangeType::AddLearnerNode => "AddLearnerNode", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "AddNode" => Some(Self::AddNode), + "RemoveNode" => Some(Self::RemoveNode), + "AddLearnerNode" => Some(Self::AddLearnerNode), + _ => None, + } + } +} diff --git a/src/generated/errorpb.rs b/src/generated/errorpb.rs new file mode 100644 index 00000000..77a54057 --- /dev/null +++ b/src/generated/errorpb.rs @@ -0,0 +1,187 @@ +/// NotLeader is the error variant that tells a request be handle by raft leader +/// is sent to raft follower or learner. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NotLeader { + /// The requested region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Region leader of the requested region + #[prost(message, optional, tag = "2")] + pub leader: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DiskFull { + /// The requested store ID + #[prost(uint64, repeated, tag = "1")] + pub store_id: ::prost::alloc::vec::Vec, + /// The detailed info + #[prost(string, tag = "2")] + pub reason: ::prost::alloc::string::String, +} +/// StoreNotMatch is the error variant that tells the request is sent to wrong store. +/// (i.e. inconsistency of the store ID that request shows and the real store ID of this server.) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreNotMatch { + /// Store id in request + #[prost(uint64, tag = "1")] + pub request_store_id: u64, + /// Actual store id + #[prost(uint64, tag = "2")] + pub actual_store_id: u64, +} +/// RegionNotFound is the error variant that tells there isn't any region in this TiKV +/// matches the requested region ID. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionNotFound { + /// The requested region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +/// RegionNotInitialized is the error variant that tells there isn't any initialized peer +/// matchesthe request region ID. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionNotInitialized { + /// The request region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +/// KeyNotInRegion is the error variant that tells the key the request requires isn't present in +/// this region. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyNotInRegion { + /// The requested key + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + /// The requested region ID + #[prost(uint64, tag = "2")] + pub region_id: u64, + /// Start key of the requested region + #[prost(bytes = "vec", tag = "3")] + pub start_key: ::prost::alloc::vec::Vec, + /// Snd key of the requested region + #[prost(bytes = "vec", tag = "4")] + pub end_key: ::prost::alloc::vec::Vec, +} +/// EpochNotMatch is the error variant that tells a region has been updated. +/// (e.g. by splitting / merging, or raft Confchange.) +/// Hence, a command is based on a stale version of a region. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EpochNotMatch { + /// Available regions that may be siblings of the requested one. + #[prost(message, repeated, tag = "1")] + pub current_regions: ::prost::alloc::vec::Vec, +} +/// ServerIsBusy is the error variant that tells the server is too busy to response. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ServerIsBusy { + #[prost(string, tag = "1")] + pub reason: ::prost::alloc::string::String, + /// The suggested backoff time + #[prost(uint64, tag = "2")] + pub backoff_ms: u64, +} +/// StaleCommand is the error variant that tells the command is stale, that is, +/// the current request term is lower than current raft term. +/// This can be retried at most time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StaleCommand {} +/// RaftEntryTooLarge is the error variant that tells the request is too large to be serialized to a +/// reasonable small raft entry. +/// (i.e. greater than the configured value `raft_entry_max_size` in `raftstore`) +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftEntryTooLarge { + /// The requested region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, + /// Size of the raft entry + #[prost(uint64, tag = "2")] + pub entry_size: u64, +} +/// MaxTimestampNotSynced is the error variant that tells the peer has just become a leader and +/// updating the max timestamp in the concurrency manager from PD TSO is ongoing. In this case, +/// the prewrite of an async commit transaction cannot succeed. The client can backoff and +/// resend the request. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MaxTimestampNotSynced {} +/// ReadIndexNotReady is the error variant that tells the read index request is not ready, that is, +/// the current region is in a status that not ready to serve the read index request. For example, +/// region is in splitting or merging status. +/// This can be retried at most time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReadIndexNotReady { + /// The reason why the region is not ready to serve read index request + #[prost(string, tag = "1")] + pub reason: ::prost::alloc::string::String, + /// The requested region ID + #[prost(uint64, tag = "2")] + pub region_id: u64, +} +/// ProposalInMergingMode is the error variant that tells the proposal is rejected because raft is +/// in the merging mode. This may happen when BR/Lightning try to ingest SST. +/// This can be retried at most time. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalInMergingMode { + /// The requested region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DataIsNotReady { + /// The requested region ID + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint64, tag = "2")] + pub peer_id: u64, + #[prost(uint64, tag = "3")] + pub safe_ts: u64, +} +/// Error wraps all region errors, indicates an error encountered by a request. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + /// The error message + #[prost(string, tag = "1")] + pub message: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub not_leader: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region_not_found: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub key_not_in_region: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub epoch_not_match: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub server_is_busy: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub stale_command: ::core::option::Option, + #[prost(message, optional, tag = "8")] + pub store_not_match: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub raft_entry_too_large: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub max_timestamp_not_synced: ::core::option::Option, + #[prost(message, optional, tag = "11")] + pub read_index_not_ready: ::core::option::Option, + #[prost(message, optional, tag = "12")] + pub proposal_in_merging_mode: ::core::option::Option, + #[prost(message, optional, tag = "13")] + pub data_is_not_ready: ::core::option::Option, + #[prost(message, optional, tag = "14")] + pub region_not_initialized: ::core::option::Option, + #[prost(message, optional, tag = "15")] + pub disk_full: ::core::option::Option, +} diff --git a/src/generated/google.api.rs b/src/generated/google.api.rs new file mode 100644 index 00000000..774c07f7 --- /dev/null +++ b/src/generated/google.api.rs @@ -0,0 +1,379 @@ +/// 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 +/// to one or more HTTP REST API methods. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Http { + /// A list of HTTP configuration rules that apply to individual API methods. + /// + /// **NOTE:** All service configuration rules follow "last one wins" order. + #[prost(message, repeated, tag = "1")] + pub rules: ::prost::alloc::vec::Vec, + /// When set to true, URL path parameters will be fully URI-decoded except in + /// cases of single segment matches in reserved expansion, where "%2F" will be + /// left encoded. + /// + /// The default behavior is to not decode RFC 6570 reserved characters in multi + /// segment matches. + #[prost(bool, tag = "2")] + pub fully_decode_reserved_expansion: bool, +} +/// # gRPC Transcoding +/// +/// gRPC Transcoding is a feature for mapping between a gRPC method and one or +/// more HTTP REST endpoints. It allows developers to build a single API service +/// that supports both gRPC APIs and REST APIs. Many systems, including [Google +/// APIs](), +/// [Cloud Endpoints](), [gRPC +/// Gateway](), +/// and \[Envoy\]() proxy support this feature +/// and use it for large scale production services. +/// +/// `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies +/// how different portions of the gRPC request message are mapped to the URL +/// path, URL query parameters, and HTTP request body. It also controls how the +/// gRPC response message is mapped to the HTTP response body. `HttpRule` is +/// typically specified as an `google.api.http` annotation on the gRPC method. +/// +/// Each mapping specifies a URL path template and an HTTP method. The path +/// template may refer to one or more fields in the gRPC request message, as long +/// as each field is a non-repeated field with a primitive (non-message) type. +/// The path template controls how fields of the request message are mapped to +/// the URL path. +/// +/// Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/{name=messages/*}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string name = 1; // Mapped to URL path. +/// } +/// message Message { +/// string text = 1; // The resource content. +/// } +/// +/// This enables an HTTP REST to gRPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` +/// +/// 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. +/// For example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get:"/v1/messages/{message_id}" +/// }; +/// } +/// } +/// message GetMessageRequest { +/// message SubMessage { +/// string subfield = 1; +/// } +/// string message_id = 1; // Mapped to URL path. +/// int64 revision = 2; // Mapped to URL query parameter `revision`. +/// SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. +/// } +/// +/// This enables a HTTP JSON to RPC mapping as below: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | +/// `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: +/// "foo"))` +/// +/// 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. +/// In the case of a repeated type, the parameter can be repeated in the URL +/// as `...?param=A¶m=B`. In the case of a message type, each field of the +/// message is mapped to a separate parameter, such as +/// `...?foo.a=A&foo.b=B&foo.c=C`. +/// +/// For HTTP methods that allow a request body, the `body` field +/// specifies the mapping. Consider a REST update method on the +/// message resource collection: +/// +/// service Messaging { +/// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "message" +/// }; +/// } +/// } +/// message UpdateMessageRequest { +/// string message_id = 1; // mapped to the URL +/// Message message = 2; // mapped to the body +/// } +/// +/// The following HTTP JSON to RPC mapping is enabled, where the +/// representation of the JSON in the request body is determined by +/// protos JSON encoding: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" message { text: "Hi!" })` +/// +/// 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 +/// request body. This enables the following alternative definition of +/// the update method: +/// +/// service Messaging { +/// rpc UpdateMessage(Message) returns (Message) { +/// option (google.api.http) = { +/// patch: "/v1/messages/{message_id}" +/// body: "*" +/// }; +/// } +/// } +/// message Message { +/// string message_id = 1; +/// string text = 2; +/// } +/// +/// +/// The following HTTP JSON to RPC mapping is enabled: +/// +/// HTTP | gRPC +/// -----|----- +/// `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: +/// "123456" text: "Hi!")` +/// +/// 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 +/// the body. This makes this option more rarely used in practice when +/// defining REST APIs. The common usage of `*` is in custom methods +/// which don't use the URL at all for transferring data. +/// +/// It is possible to define multiple HTTP methods for one RPC by using +/// the `additional_bindings` option. Example: +/// +/// service Messaging { +/// rpc GetMessage(GetMessageRequest) returns (Message) { +/// option (google.api.http) = { +/// get: "/v1/messages/{message_id}" +/// additional_bindings { +/// get: "/v1/users/{user_id}/messages/{message_id}" +/// } +/// }; +/// } +/// } +/// message GetMessageRequest { +/// string message_id = 1; +/// string user_id = 2; +/// } +/// +/// This enables the following two alternative HTTP JSON to RPC mappings: +/// +/// HTTP | gRPC +/// -----|----- +/// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +/// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: +/// "123456")` +/// +/// ## Rules for HTTP mapping +/// +/// 1. Leaf request fields (recursive expansion nested messages in the request +/// message) are classified into three categories: +/// - 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 +/// request body. +/// - All other fields are passed via the URL query parameters, and the +/// parameter name is the field path in the request message. A repeated +/// field can be represented as multiple query parameters under the same +/// name. +/// 2. 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. +/// 3. 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. +/// +/// ### Path template syntax +/// +/// Template = "/" Segments [ Verb ] ; +/// Segments = Segment { "/" Segment } ; +/// Segment = "*" | "**" | LITERAL | Variable ; +/// Variable = "{" FieldPath [ "=" Segments ] "}" ; +/// FieldPath = IDENT { "." IDENT } ; +/// Verb = ":" LITERAL ; +/// +/// 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 +/// except the `Verb`. +/// +/// The syntax `Variable` matches part of the URL path as specified by its +/// template. A variable template must not contain other variables. If a variable +/// matches a single path segment, its template may be omitted, e.g. `{var}` +/// is equivalent to `{var=*}`. +/// +/// The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` +/// contains any reserved character, such characters should be percent-encoded +/// before the matching. +/// +/// If a variable contains exactly one path segment, such as `"{var}"` or +/// `"{var=*}"`, when such a variable is expanded into a URL path on the client +/// side, all characters except `\[-_.~0-9a-zA-Z\]` are percent-encoded. The +/// server side does the reverse decoding. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{var}`. +/// +/// If a variable contains multiple path segments, such as `"{var=foo/*}"` +/// or `"{var=**}"`, when such a variable is expanded into a URL path on the +/// client side, all characters except `\[-_.~/0-9a-zA-Z\]` are percent-encoded. +/// The server side does the reverse decoding, except "%2F" and "%2f" are left +/// unchanged. Such variables show up in the +/// [Discovery +/// Document]() as +/// `{+var}`. +/// +/// ## Using gRPC API Service Configuration +/// +/// gRPC API Service Configuration (service config) is a configuration language +/// for configuring a gRPC service to become a user-facing product. The +/// service config is simply the YAML representation of the `google.api.Service` +/// proto message. +/// +/// As an alternative to annotating your proto file, you can configure gRPC +/// transcoding in your service config YAML files. You do this by specifying a +/// `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same +/// effect as the proto annotation. This can be particularly useful if you +/// have a proto that is reused in multiple services. Note that any transcoding +/// specified in the service config will override any matching transcoding +/// configuration in the proto. +/// +/// Example: +/// +/// http: +/// rules: +/// # Selects a gRPC method and applies HttpRule to it. +/// - selector: example.v1.Messaging.GetMessage +/// get: /v1/messages/{message_id}/{sub.subfield} +/// +/// ## Special notes +/// +/// When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the +/// proto to JSON conversion must follow the [proto3 +/// specification](). +/// +/// While the single segment variable follows the semantics of +/// [RFC 6570]() Section 3.2.2 Simple String +/// Expansion, the multi segment variable **does not** follow RFC 6570 Section +/// 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion +/// does not expand special characters like `?` and `#`, which would lead +/// to invalid URLs. As the result, gRPC Transcoding uses a custom encoding +/// for multi segment variables. +/// +/// The path variables **must not** refer to any repeated or mapped field, +/// because client libraries are not capable of handling such variable expansion. +/// +/// The path variables **must not** capture the leading "/" character. The reason +/// is that the most common use case "{var}" does not capture the leading "/" +/// character. For consistency, all path variables must share the same behavior. +/// +/// Repeated message fields must not be mapped to URL query parameters, because +/// no client library can support such complicated mapping. +/// +/// 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 +/// 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)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HttpRule { + /// Selects a method to which this rule applies. + /// + /// Refer to \[selector][google.api.DocumentationRule.selector\] for syntax details. + #[prost(string, tag = "1")] + pub selector: ::prost::alloc::string::String, + /// The name of the request field whose value is mapped to the HTTP request + /// body, or `*` for mapping all request fields not captured by the path + /// pattern to the HTTP body, or omitted for not having any HTTP request body. + /// + /// NOTE: the referred field must be present at the top-level of the request + /// message type. + #[prost(string, tag = "7")] + pub body: ::prost::alloc::string::String, + /// Optional. The name of the response field whose value is mapped to the HTTP + /// response body. When omitted, the entire response message will be used + /// as the HTTP response body. + /// + /// NOTE: The referred field must be present at the top-level of the response + /// message type. + #[prost(string, tag = "12")] + pub response_body: ::prost::alloc::string::String, + /// Additional HTTP bindings for the selector. Nested bindings must + /// not contain an `additional_bindings` field themselves (that is, + /// the nesting may only be one level deep). + #[prost(message, repeated, tag = "11")] + pub additional_bindings: ::prost::alloc::vec::Vec, + /// 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 + /// can be defined using the 'custom' field. + #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] + pub pattern: ::core::option::Option, +} +/// Nested message and enum types in `HttpRule`. +pub mod http_rule { + /// 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 + /// 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)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Pattern { + /// Maps to HTTP GET. Used for listing and getting information about + /// resources. + #[prost(string, tag = "2")] + Get(::prost::alloc::string::String), + /// Maps to HTTP PUT. Used for replacing a resource. + #[prost(string, tag = "3")] + Put(::prost::alloc::string::String), + /// Maps to HTTP POST. Used for creating a resource or performing an action. + #[prost(string, tag = "4")] + Post(::prost::alloc::string::String), + /// Maps to HTTP DELETE. Used for deleting a resource. + #[prost(string, tag = "5")] + Delete(::prost::alloc::string::String), + /// Maps to HTTP PATCH. Used for updating a resource. + #[prost(string, tag = "6")] + Patch(::prost::alloc::string::String), + /// 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 + /// HTTP method unspecified for this rule. The wild-card rule is useful + /// for services that provide content to Web (HTML) clients. + #[prost(message, tag = "8")] + Custom(super::CustomHttpPattern), + } +} +/// A custom pattern is used for defining custom HTTP verb. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CustomHttpPattern { + /// The name of this custom HTTP verb. + #[prost(string, tag = "1")] + pub kind: ::prost::alloc::string::String, + /// The path matched by this custom verb. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, +} diff --git a/src/generated/import_kvpb.rs b/src/generated/import_kvpb.rs new file mode 100644 index 00000000..2e212e55 --- /dev/null +++ b/src/generated/import_kvpb.rs @@ -0,0 +1,572 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchModeRequest { + #[prost(string, tag = "1")] + pub pd_addr: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub request: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchModeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenEngineRequest { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub key_prefix: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OpenEngineResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteHead { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Mutation { + #[prost(enumeration = "mutation::Op", tag = "1")] + pub op: i32, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Mutation`. +pub mod mutation { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Op { + Put = 0, + } + 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", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Put" => Some(Self::Put), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteBatch { + #[prost(uint64, tag = "1")] + pub commit_ts: u64, + #[prost(message, repeated, tag = "2")] + pub mutations: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteEngineRequest { + #[prost(oneof = "write_engine_request::Chunk", tags = "1, 2")] + pub chunk: ::core::option::Option, +} +/// Nested message and enum types in `WriteEngineRequest`. +pub mod write_engine_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Chunk { + #[prost(message, tag = "1")] + Head(super::WriteHead), + #[prost(message, tag = "2")] + Batch(super::WriteBatch), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KvPair { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteEngineV3Request { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "2")] + pub commit_ts: u64, + #[prost(message, repeated, tag = "3")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteEngineResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseEngineRequest { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CloseEngineResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ImportEngineRequest { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(string, tag = "2")] + pub pd_addr: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ImportEngineResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CleanupEngineRequest { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CleanupEngineResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactClusterRequest { + #[prost(string, tag = "1")] + pub pd_addr: ::prost::alloc::string::String, + #[prost(message, optional, tag = "2")] + pub request: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactClusterResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetVersionRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetVersionResponse { + #[prost(string, tag = "1")] + pub version: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub commit: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMetricsRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMetricsResponse { + #[prost(string, tag = "1")] + pub prometheus: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + /// This can happen if the client hasn't opened the engine, or the server + /// restarts while the client is writing or closing. An unclosed engine will + /// be removed on server restart, so the client should not continue but + /// restart the previous job in that case. + #[prost(message, optional, tag = "1")] + pub engine_not_found: ::core::option::Option, +} +/// Nested message and enum types in `Error`. +pub mod error { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct EngineNotFound { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, + } +} +/// Generated client implementations. +pub mod import_kv_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// ImportKV provides a service to import key-value pairs to TiKV. + /// + /// In order to import key-value pairs to TiKV, the user should: + /// 1. Open an engine identified by an UUID. + /// 2. Open write streams to write key-value batches to the opened engine. + /// Different streams/clients can write to the same engine concurrently. + /// 3. 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 once, and it can not be opened again + /// once it is closed. + /// 4. Import the data in the engine to the target cluster. Note that + /// the import process is not atomic, it requires the data to be + /// idempotent on retry. An engine can only be imported after it is + /// closed. An engine can be imported multiple times, but can not be + /// imported concurrently. + /// 5. 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 + /// writing or importing. + #[derive(Debug, Clone)] + pub struct ImportKvClient { + inner: tonic::client::Grpc, + } + impl ImportKvClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ImportKvClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ImportKvClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ImportKvClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Switch the target cluster to normal/import mode. + pub async fn switch_mode( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/SwitchMode", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "SwitchMode")); + self.inner.unary(req, path, codec).await + } + /// Open an engine. + pub async fn open_engine( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/OpenEngine", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "OpenEngine")); + self.inner.unary(req, path, codec).await + } + /// Open a write stream to the engine. + pub async fn write_engine( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::WriteEngineRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/WriteEngine", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "WriteEngine")); + self.inner.client_streaming(req, path, codec).await + } + /// Write to engine, single message version + pub async fn write_engine_v3( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/WriteEngineV3", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "WriteEngineV3")); + self.inner.unary(req, path, codec).await + } + /// Close the engine. + pub async fn close_engine( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/CloseEngine", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "CloseEngine")); + self.inner.unary(req, path, codec).await + } + /// Import the engine to the target cluster. + pub async fn import_engine( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/ImportEngine", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "ImportEngine")); + self.inner.unary(req, path, codec).await + } + /// Clean up the engine. + pub async fn cleanup_engine( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/CleanupEngine", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "CleanupEngine")); + self.inner.unary(req, path, codec).await + } + /// Compact the target cluster for better performance. + pub async fn compact_cluster( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/CompactCluster", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "CompactCluster")); + self.inner.unary(req, path, codec).await + } + /// Get current version and commit hash + pub async fn get_version( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/GetVersion", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "GetVersion")); + self.inner.unary(req, path, codec).await + } + /// Get importer metrics + pub async fn get_metrics( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_kvpb.ImportKV/GetMetrics", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_kvpb.ImportKV", "GetMetrics")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/import_sstpb.rs b/src/generated/import_sstpb.rs new file mode 100644 index 00000000..b4917cfa --- /dev/null +++ b/src/generated/import_sstpb.rs @@ -0,0 +1,730 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchModeRequest { + #[prost(enumeration = "SwitchMode", tag = "1")] + pub mode: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SwitchModeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Range { + #[prost(bytes = "vec", tag = "1")] + pub start: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub end: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SstMeta { + #[prost(bytes = "vec", tag = "1")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub range: ::core::option::Option, + #[prost(uint32, tag = "3")] + pub crc32: u32, + #[prost(uint64, tag = "4")] + pub length: u64, + #[prost(string, tag = "5")] + pub cf_name: ::prost::alloc::string::String, + #[prost(uint64, tag = "6")] + pub region_id: u64, + #[prost(message, optional, tag = "7")] + pub region_epoch: ::core::option::Option, + #[prost(bool, tag = "8")] + pub end_key_exclusive: bool, + /// total_kvs and total_bytes is equivalent to PD's approximate_keys and approximate_size + /// set these values can save time from tikv upload keys and size to PD through Heartbeat. + #[prost(uint64, tag = "9")] + pub total_kvs: u64, + #[prost(uint64, tag = "10")] + pub total_bytes: u64, + /// API version implies the encode of the key and value. + #[prost(enumeration = "super::kvrpcpb::ApiVersion", tag = "11")] + pub api_version: i32, + /// cipher_iv is used to encrypt/decrypt sst + #[prost(bytes = "vec", tag = "12")] + pub cipher_iv: ::prost::alloc::vec::Vec, +} +/// A rewrite rule is applied on the *encoded* keys (the internal storage +/// representation). +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RewriteRule { + #[prost(bytes = "vec", tag = "1")] + pub old_key_prefix: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub new_key_prefix: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub new_timestamp: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UploadRequest { + #[prost(oneof = "upload_request::Chunk", tags = "1, 2")] + pub chunk: ::core::option::Option, +} +/// Nested message and enum types in `UploadRequest`. +pub mod upload_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Chunk { + #[prost(message, tag = "1")] + Meta(super::SstMeta), + #[prost(bytes, tag = "2")] + Data(::prost::alloc::vec::Vec), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UploadResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngestRequest { + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub sst: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MultiIngestRequest { + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub ssts: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngestResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactRequest { + /// Compact files in the range and above the output level. + /// Compact all files if the range is not specified. + /// Compact all files to the bottommost level if the output level is -1. + #[prost(message, optional, tag = "1")] + pub range: ::core::option::Option, + #[prost(int32, tag = "2")] + pub output_level: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DownloadRequest { + /// The SST meta used to identify the downloaded file. + /// Must be the same among all nodes in the same Raft group. + /// Note: the "crc32" and "cf_name" fields are ignored in this request, + /// and the "range" field represents the closed key range after rewrite + /// (as origin keys in encoded representation). + #[prost(message, optional, tag = "2")] + pub sst: ::core::option::Option, + /// The file name of the SST file. + #[prost(string, tag = "9")] + pub name: ::prost::alloc::string::String, + /// Performs a key prefix rewrite after downloading the SST file. + /// All keys in the SST will be rewritten as: + /// + /// new_key = new_key_prefix + old_key\[len(old_key_prefix)..\] + /// + /// When used for TiDB, rewriting the prefix changes the table ID. Please + /// note that key-rewrite is applied on the origin keys in encoded + /// representation (the SST itself should still use data keys in encoded + /// representation). + /// + /// You need to ensure that the keys before and after rewriting are in the + /// same order, otherwise the RPC request will fail. + #[prost(message, optional, tag = "13")] + pub rewrite_rule: ::core::option::Option, + #[prost(message, optional, tag = "14")] + pub storage_backend: ::core::option::Option, + #[prost(bool, tag = "15")] + pub is_raw_kv: bool, + /// cipher_info is used to decrypt sst when download sst + #[prost(message, optional, tag = "16")] + pub cipher_info: ::core::option::Option, +} +/// For now it is just used for distinguishing the error of the request with the error +/// of gRPC, add more concrete types if it is necessary later. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(string, tag = "1")] + pub message: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DownloadResponse { + /// The actual key range (after rewrite) of the downloaded SST. The range is + /// inclusive in both ends. + #[prost(message, optional, tag = "1")] + pub range: ::core::option::Option, + /// Whether the SST is empty. An empty SST is prohibited in TiKV, do not + /// ingest if this field is true. + /// (Deprecated, should be replaced by checking `length == 0` in the future) + #[prost(bool, tag = "2")] + pub is_empty: bool, + #[prost(message, optional, tag = "3")] + pub error: ::core::option::Option, + /// The CRC32 checksum of the rewritten SST file (implementation can return + /// zero, indicating the CRC32 was not calculated). + #[prost(uint32, tag = "4")] + pub crc32: u32, + /// The actual length of the rewritten SST file. + #[prost(uint64, tag = "5")] + pub length: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetDownloadSpeedLimitRequest { + /// The download speed limit (bytes/second). Set to 0 for unlimited speed. + #[prost(uint64, tag = "1")] + pub speed_limit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetDownloadSpeedLimitResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Pair { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, + #[prost(enumeration = "pair::Op", tag = "3")] + pub op: i32, +} +/// Nested message and enum types in `Pair`. +pub mod pair { + #[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration + )] + #[repr(i32)] + pub enum Op { + Put = 0, + Delete = 1, + } + 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::Delete => "Delete", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Put" => Some(Self::Put), + "Delete" => Some(Self::Delete), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteBatch { + #[prost(uint64, tag = "1")] + pub commit_ts: u64, + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteRequest { + #[prost(oneof = "write_request::Chunk", tags = "1, 2")] + pub chunk: ::core::option::Option, +} +/// Nested message and enum types in `WriteRequest`. +pub mod write_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Chunk { + #[prost(message, tag = "1")] + Meta(super::SstMeta), + #[prost(message, tag = "2")] + Batch(super::WriteBatch), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WriteResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub metas: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RawWriteBatch { + #[prost(uint64, tag = "1")] + pub ttl: u64, + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RawWriteRequest { + #[prost(oneof = "raw_write_request::Chunk", tags = "1, 2")] + pub chunk: ::core::option::Option, +} +/// Nested message and enum types in `RawWriteRequest`. +pub mod raw_write_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Chunk { + #[prost(message, tag = "1")] + Meta(super::SstMeta), + #[prost(message, tag = "2")] + Batch(super::RawWriteBatch), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RawWriteResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub metas: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DuplicateDetectRequest { + #[prost(message, optional, tag = "1")] + pub context: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + /// Return only the keys found by scanning, not their values. + #[prost(bool, tag = "4")] + pub key_only: bool, + /// We only check the data whose timestamp is larger than `min_commit_ts`. `min_commit_ts` is exclueded. + #[prost(uint64, tag = "5")] + pub min_commit_ts: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KvPair { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub commit_ts: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DuplicateDetectResponse { + #[prost(message, optional, tag = "1")] + pub region_error: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub key_error: ::core::option::Option, + /// The these keys will be in asc order (but commit time is in desc order), + /// and the content is just like following: + /// [ + /// {key: "key1", value: "value11", commit_ts: 1005}, + /// {key: "key1", value: "value12", commit_ts: 1004}, + /// {key: "key1", value: "value13", commit_ts: 1001}, + /// {key: "key2", value: "value21", commit_ts: 1004}, + /// {key: "key2", value: "value22", commit_ts: 1002}, + /// ... + /// ] + #[prost(message, repeated, tag = "3")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SwitchMode { + Normal = 0, + Import = 1, +} +impl SwitchMode { + /// 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 { + SwitchMode::Normal => "Normal", + SwitchMode::Import => "Import", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Normal" => Some(Self::Normal), + "Import" => Some(Self::Import), + _ => None, + } + } +} +/// Generated client implementations. +pub mod import_sst_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// 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: + /// 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. + /// 3. 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 + /// the servers where the region's peers locate in, before issue the ingest + /// request to the region's leader. However, the region can be scheduled (so the + /// location of the region's peers will be changed) or split/merged (so the range + /// of the region will be changed), after the SST file is uploaded, but before + /// the SST file is ingested. So, the region's epoch is provided in the SST + /// file's metadata, to guarantee that the region's epoch must be the same + /// between the SST file is uploaded and ingested later. + #[derive(Debug, Clone)] + pub struct ImportSstClient { + inner: tonic::client::Grpc, + } + impl ImportSstClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ImportSstClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ImportSstClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ImportSstClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Switch to normal/import mode. + pub async fn switch_mode( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/SwitchMode", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "SwitchMode")); + self.inner.unary(req, path, codec).await + } + /// Upload an SST file to a server. + pub async fn upload( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/Upload", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "Upload")); + self.inner.client_streaming(req, path, codec).await + } + /// Ingest an uploaded SST file to a region. + pub async fn ingest( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/Ingest", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "Ingest")); + self.inner.unary(req, path, codec).await + } + /// Compact the specific range for better performance. + pub async fn compact( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/Compact", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "Compact")); + self.inner.unary(req, path, codec).await + } + pub async fn set_download_speed_limit( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/SetDownloadSpeedLimit", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("import_sstpb.ImportSST", "SetDownloadSpeedLimit"), + ); + self.inner.unary(req, path, codec).await + } + /// Download an SST file from an external storage, and performs key-rewrite + /// after downloading. + pub async fn download( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/Download", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "Download")); + self.inner.unary(req, path, codec).await + } + /// Open a write stream to generate sst files + pub async fn write( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/Write", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "Write")); + self.inner.client_streaming(req, path, codec).await + } + pub async fn raw_write( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/RawWrite", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "RawWrite")); + self.inner.client_streaming(req, path, codec).await + } + /// Ingest Multiple files in one request + pub async fn multi_ingest( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/MultiIngest", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "MultiIngest")); + self.inner.unary(req, path, codec).await + } + /// Collect duplicate data from TiKV. + pub async fn duplicate_detect( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/import_sstpb.ImportSST/DuplicateDetect", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("import_sstpb.ImportSST", "DuplicateDetect")); + self.inner.server_streaming(req, path, codec).await + } + } +} diff --git a/src/generated/kvrpcpb.rs b/src/generated/kvrpcpb.rs new file mode 100644 index 00000000..4e8519bf --- /dev/null +++ b/src/generated/kvrpcpb.rs @@ -0,0 +1,1885 @@ +/// 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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[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, + /// 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, + /// A successful result. + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + /// 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, +} +/// 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, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + /// 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, + /// 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, + /// Each KvPair may contain a key error. + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, + /// 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, +} +/// 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, + /// The data to be written to the database. + #[prost(message, repeated, tag = "2")] + pub mutations: ::prost::alloc::vec::Vec, + /// 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, + /// 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. + #[prost(bool, repeated, tag = "7")] + pub is_pessimistic_lock: ::prost::alloc::vec::Vec, + /// 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>, + /// 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, +} +#[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, + #[prost(message, repeated, tag = "2")] + pub errors: ::prost::alloc::vec::Vec, + /// 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, +} +/// 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, + /// In this case every `Op` of the mutations must be `PessimisticLock`. + #[prost(message, repeated, tag = "2")] + pub mutations: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub primary_lock: ::prost::alloc::vec::Vec, + #[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, +} +#[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, + #[prost(message, repeated, tag = "2")] + pub errors: ::prost::alloc::vec::Vec, + /// 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, + /// The values is set if 'return_values' is true in the request and no error. + /// If 'force' is true, this field is not used. + #[prost(bytes = "vec", repeated, tag = "5")] + pub values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// 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. + #[prost(bool, repeated, tag = "6")] + pub not_founds: ::prost::alloc::vec::Vec, +} +/// 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, + #[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>, +} +#[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, + #[prost(message, repeated, tag = "2")] + pub errors: ::prost::alloc::vec::Vec, +} +/// 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, + /// The key of the lock to update. + #[prost(bytes = "vec", tag = "2")] + pub primary_lock: ::prost::alloc::vec::Vec, + /// 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, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// The TTL actually set on the requested lock. + #[prost(uint64, tag = "3")] + pub lock_ttl: u64, +} +/// 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, + /// 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, + /// 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, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// 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, +} +/// 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, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + /// 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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// 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, + /// 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, +} +/// 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, + /// 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>, + /// Timestamp for the end of the transaction. Must be greater than `start_version`. + #[prost(uint64, tag = "4")] + pub commit_version: u64, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// If the commit ts is derived from min_commit_ts, this field should be set. + #[prost(uint64, tag = "3")] + pub commit_version: u64, +} +/// 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, + #[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, + #[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// 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, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[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, + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, + /// Time and scan details when processing the request. + #[prost(message, optional, tag = "4")] + pub exec_details_v2: ::core::option::Option, + /// 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, +} +/// 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, + /// 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>, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, +} +/// 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, + /// 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, + /// 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, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + /// Info on all locks found by the scan. + #[prost(message, repeated, tag = "3")] + pub locks: ::prost::alloc::vec::Vec, +} +/// 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, + #[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, + /// Only resolve specified keys. + #[prost(bytes = "vec", repeated, tag = "5")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, +} +/// 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, + #[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, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, +} +/// Delete a range of data from TiKV. +/// This message should not be used. +#[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, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + /// 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, + #[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[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, + #[prost(string, tag = "2")] + pub error: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + #[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, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[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, + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + #[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, + #[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, + #[prost(message, repeated, tag = "2")] + pub pairs: ::prost::alloc::vec::Vec, + #[prost(string, tag = "3")] + pub cf: ::prost::alloc::string::String, + /// 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 = "4")] + pub ttls: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "5")] + pub for_cas: bool, +} +#[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, + #[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[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, + #[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, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[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, + #[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, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[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, +} +#[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, + #[prost(message, repeated, tag = "2")] + pub kvs: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + #[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, + #[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, + /// scanning range + #[prost(message, repeated, tag = "2")] + pub ranges: ::prost::alloc::vec::Vec, + /// 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, + #[prost(message, repeated, tag = "2")] + pub kvs: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, +} +#[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, + #[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, + #[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, + #[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, +} +#[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, + #[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, + #[prost(uint64, tag = "2")] + pub max_ts: u64, + #[prost(bytes = "vec", tag = "3")] + pub start_key: ::prost::alloc::vec::Vec, + #[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, +} +/// 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, + #[deprecated] + #[prost(bytes = "vec", tag = "2")] + pub split_key: ::prost::alloc::vec::Vec, + /// 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>, + /// 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, + /// set when there are only 2 result regions. + #[deprecated] + #[prost(message, optional, tag = "2")] + pub left: ::core::option::Option, + /// set when there are only 2 result regions. + #[deprecated] + #[prost(message, optional, tag = "3")] + pub right: ::core::option::Option, + /// include all result regions. + #[prost(message, repeated, tag = "4")] + pub regions: ::prost::alloc::vec::Vec, +} +/// 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, + /// 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, +} +#[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, + #[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, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(string, tag = "2")] + pub error: ::prost::alloc::string::String, + #[prost(message, optional, tag = "3")] + pub info: ::core::option::Option, +} +#[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, + #[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, + #[prost(string, tag = "2")] + pub error: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "3")] + pub key: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "4")] + pub info: ::core::option::Option, +} +/// 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, + #[prost(message, optional, tag = "3")] + pub peer: ::core::option::Option, + #[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, + #[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, + /// 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, +} +#[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, + #[prost(uint64, tag = "2")] + pub lock_version: u64, + #[prost(bytes = "vec", tag = "3")] + pub key: ::prost::alloc::vec::Vec, + #[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>, +} +#[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, + /// 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, + /// Key already exists + #[prost(message, optional, tag = "5")] + pub already_exist: ::core::option::Option, + /// Deadlock is used in pessimistic transaction for single statement rollback. + #[prost(message, optional, tag = "6")] + pub deadlock: ::core::option::Option, + /// Commit ts is earlier than min commit ts of a transaction. + #[prost(message, optional, tag = "7")] + pub commit_ts_expired: ::core::option::Option, + /// Txn not found when checking txn status. + #[prost(message, optional, tag = "8")] + pub txn_not_found: ::core::option::Option, + /// Calculated commit TS exceeds the limit given by the user. + #[prost(message, optional, tag = "9")] + pub commit_ts_too_large: ::core::option::Option, + /// Assertion of a `Mutation` is evaluated as a failure. + #[prost(message, optional, tag = "10")] + pub assertion_failed: ::core::option::Option, +} +#[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, + #[prost(bytes = "vec", tag = "4")] + pub primary: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "5")] + pub conflict_commit_ts: u64, +} +#[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, +} +#[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, + #[prost(uint64, tag = "3")] + pub deadlock_key_hash: u64, + #[prost(message, repeated, tag = "4")] + pub wait_chain: ::prost::alloc::vec::Vec, +} +#[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, + #[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, +} +#[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, + #[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 TimeDetail { + /// Off-cpu wall time elapsed in TiKV side. Usually this includes queue waiting time and + /// other kind of waitings in series. + #[prost(int64, tag = "1")] + pub wait_wall_time_ms: i64, + /// 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(int64, tag = "2")] + pub process_wall_time_ms: i64, + /// KV read wall Time means the time used in key/value scan and get. + #[prost(int64, tag = "3")] + pub kv_read_wall_time_ms: i64, +} +#[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, + #[prost(message, optional, tag = "2")] + pub lock: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub data: ::core::option::Option, +} +#[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 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, +} +#[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, + /// Available when ctx.record_scan_stat = true or meet slow query. + #[prost(message, optional, tag = "2")] + pub scan_detail: ::core::option::Option, +} +#[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. + #[prost(message, optional, tag = "1")] + pub time_detail: ::core::option::Option, + /// Available when ctx.record_scan_stat = true or meet slow query. + #[prost(message, optional, tag = "2")] + pub scan_detail_v2: ::core::option::Option, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + #[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, + #[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, +} +#[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, +} +#[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, + #[prost(bytes = "vec", tag = "4")] + pub short_value: ::prost::alloc::vec::Vec, + #[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>, + #[prost(uint64, repeated, tag = "10")] + pub rollback_ts: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(message, repeated, tag = "2")] + pub writes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub values: ::prost::alloc::vec::Vec, +} +#[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, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub end_key: ::prost::alloc::vec::Vec, +} +#[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, + #[prost(message, optional, tag = "5")] + pub read_state: ::core::option::Option, +} +#[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, + #[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, + #[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, +} +#[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[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, + #[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, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "4")] + pub previous_not_exist: bool, + #[prost(bytes = "vec", tag = "5")] + pub previous_value: ::prost::alloc::vec::Vec, + #[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, + #[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, +} +#[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, +} +#[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, + #[prost(string, tag = "2")] + pub error: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub entries: ::prost::alloc::vec::Vec, +} +#[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, + #[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, + #[prost(bytes = "vec", tag = "5")] + pub data: ::prost::alloc::vec::Vec, +} +#[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, + /// 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, +} +#[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, + #[prost(enumeration = "ChecksumAlgorithm", tag = "2")] + pub algorithm: i32, + #[prost(message, repeated, tag = "3")] + pub ranges: ::prost::alloc::vec::Vec, +} +#[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, + #[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, +} +/// The API version the server and the client is using. +/// See more details in +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ApiVersion { + /// Mainly for TxnKV and not safe to use RawKV along with TxnKV. + /// + /// V1 server only accepts V1 requests. Except that the V1 raw requests with TTL + /// will be rejected. + V1 = 0, + /// 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. + /// + /// ------------------------------------------------------------ + /// | 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, + /// TxnKV keys start with `x{keyspace id}`, `m`, or `t`. + /// + /// RawKV keys must be in `default` CF and all start with `r{keyspace id}` prefix, + /// where the keyspace id is in varint format (little endian), whose bytes expect + /// the last one always sets the most significant bit to 1. + /// + /// The last byte in the raw value must be a meta flag. For example: + /// + /// -------------------------------------- + /// | User value | Meta flags | + /// -------------------------------------- + /// | 0x12 0x34 0x56 | 0x00 (0b00000000) | + /// -------------------------------------- + /// + /// 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 + /// meta flags. + /// + /// -------------------------------------------------------------------------------- + /// | User value | Expire Ts | Meta flags | + /// -------------------------------------------------------------------------------- + /// | 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 + /// 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 { + 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 { + 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, +} +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", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SI" => Some(Self::Si), + "RC" => Some(Self::Rc), + _ => 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + 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 { + match value { + "Crc64_Xor" => Some(Self::Crc64Xor), + _ => None, + } + } +} diff --git a/src/generated/metapb.rs b/src/generated/metapb.rs new file mode 100644 index 00000000..cddb895b --- /dev/null +++ b/src/generated/metapb.rs @@ -0,0 +1,167 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Cluster { + #[prost(uint64, tag = "1")] + pub id: u64, + /// max peer count for a region. + /// pd will do the auto-balance if region peer count mismatches. + /// + /// more attributes...... + #[prost(uint32, tag = "2")] + pub max_peer_count: u32, +} +/// Case insensitive key/value for replica constraints. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreLabel { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub value: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Store { + #[prost(uint64, tag = "1")] + pub id: u64, + /// Address to handle client requests (kv, cop, etc.) + #[prost(string, tag = "2")] + pub address: ::prost::alloc::string::String, + #[prost(enumeration = "StoreState", tag = "3")] + pub state: i32, + #[prost(message, repeated, tag = "4")] + pub labels: ::prost::alloc::vec::Vec, + #[prost(string, tag = "5")] + pub version: ::prost::alloc::string::String, + /// Address to handle peer requests (raft messages from other store). + /// Empty means same as address. + #[prost(string, tag = "6")] + pub peer_address: ::prost::alloc::string::String, + /// Status address provides the HTTP service for external components + #[prost(string, tag = "7")] + pub status_address: ::prost::alloc::string::String, + #[prost(string, tag = "8")] + pub git_hash: ::prost::alloc::string::String, + /// The start timestamp of the current store + #[prost(int64, tag = "9")] + pub start_timestamp: i64, + #[prost(string, tag = "10")] + pub deploy_path: ::prost::alloc::string::String, + /// The last heartbeat timestamp of the store. + #[prost(int64, tag = "11")] + pub last_heartbeat: i64, + /// If the store is physically destroyed, which means it can never up again. + #[prost(bool, tag = "12")] + pub physically_destroyed: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionEpoch { + /// Conf change version, auto increment when add or remove peer + #[prost(uint64, tag = "1")] + pub conf_ver: u64, + /// Region version, auto increment when split or merge + #[prost(uint64, tag = "2")] + pub version: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Region { + #[prost(uint64, tag = "1")] + pub id: u64, + /// Region key range [start_key, end_key). + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "4")] + pub region_epoch: ::core::option::Option, + #[prost(message, repeated, tag = "5")] + pub peers: ::prost::alloc::vec::Vec, + /// Encryption metadata for start_key and end_key. encryption_meta.iv is IV for start_key. + /// IV for end_key is calculated from (encryption_meta.iv + len(start_key)). + /// The field is only used by PD and should be ignored otherwise. + /// If encryption_meta is empty (i.e. nil), it means start_key and end_key are unencrypted. + #[prost(message, optional, tag = "6")] + pub encryption_meta: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Peer { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(uint64, tag = "2")] + pub store_id: u64, + #[prost(enumeration = "PeerRole", tag = "3")] + pub role: i32, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StoreState { + Up = 0, + Offline = 1, + Tombstone = 2, +} +impl StoreState { + /// 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 { + StoreState::Up => "Up", + StoreState::Offline => "Offline", + StoreState::Tombstone => "Tombstone", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Up" => Some(Self::Up), + "Offline" => Some(Self::Offline), + "Tombstone" => Some(Self::Tombstone), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum PeerRole { + /// Voter -> Voter + Voter = 0, + /// Learner/None -> Learner + Learner = 1, + /// Learner/None -> Voter + IncomingVoter = 2, + /// Voter -> Learner + /// + /// We forbid Voter -> None, it can introduce unavailability as discussed in + /// etcd-io/etcd#7625 + /// Learner -> None can be apply directly, doesn't need to be stored as + /// joint state. + DemotingVoter = 3, +} +impl PeerRole { + /// 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 { + PeerRole::Voter => "Voter", + PeerRole::Learner => "Learner", + PeerRole::IncomingVoter => "IncomingVoter", + PeerRole::DemotingVoter => "DemotingVoter", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Voter" => Some(Self::Voter), + "Learner" => Some(Self::Learner), + "IncomingVoter" => Some(Self::IncomingVoter), + "DemotingVoter" => Some(Self::DemotingVoter), + _ => None, + } + } +} diff --git a/src/generated/mod.rs b/src/generated/mod.rs new file mode 100644 index 00000000..09a476df --- /dev/null +++ b/src/generated/mod.rs @@ -0,0 +1,77 @@ +pub mod backup { + include!("backup.rs"); +} +pub mod cdcpb { + include!("cdcpb.rs"); +} +pub mod configpb { + include!("configpb.rs"); +} +pub mod coprocessor { + include!("coprocessor.rs"); +} +pub mod deadlock { + include!("deadlock.rs"); +} +pub mod debugpb { + include!("debugpb.rs"); +} +pub mod diagnosticspb { + include!("diagnosticspb.rs"); +} +pub mod disk_usage { + include!("disk_usage.rs"); +} +pub mod encryptionpb { + include!("encryptionpb.rs"); +} +pub mod enginepb { + include!("enginepb.rs"); +} +pub mod eraftpb { + include!("eraftpb.rs"); +} +pub mod errorpb { + include!("errorpb.rs"); +} +pub mod google { + pub mod api { + include!("google.api.rs"); + } +} +pub mod import_kvpb { + include!("import_kvpb.rs"); +} +pub mod import_sstpb { + include!("import_sstpb.rs"); +} +pub mod kvrpcpb { + include!("kvrpcpb.rs"); +} +pub mod metapb { + include!("metapb.rs"); +} +pub mod mpp { + include!("mpp.rs"); +} +pub mod pdpb { + include!("pdpb.rs"); +} +pub mod raft_cmdpb { + include!("raft_cmdpb.rs"); +} +pub mod raft_serverpb { + include!("raft_serverpb.rs"); +} +pub mod replication_modepb { + include!("replication_modepb.rs"); +} +pub mod resource_usage_agent { + include!("resource_usage_agent.rs"); +} +pub mod span { + include!("span.rs"); +} +pub mod tikvpb { + include!("tikvpb.rs"); +} diff --git a/src/generated/mpp.rs b/src/generated/mpp.rs new file mode 100644 index 00000000..8834980c --- /dev/null +++ b/src/generated/mpp.rs @@ -0,0 +1,97 @@ +/// TaskMeta contains meta of a mpp plan, including query's ts and task address. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TaskMeta { + /// start ts of a query + #[prost(uint64, tag = "1")] + pub start_ts: u64, + /// if task id is -1 , it indicates a tidb task. + #[prost(int64, tag = "2")] + pub task_id: i64, + /// Only used for hash partition + #[prost(int64, tag = "3")] + pub partition_id: i64, + /// target address of this task. + #[prost(string, tag = "4")] + pub address: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IsAliveRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IsAliveResponse { + #[prost(bool, tag = "1")] + pub available: bool, +} +/// Dipsatch the task request to different tiflash servers. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DispatchTaskRequest { + #[prost(message, optional, tag = "1")] + pub meta: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub encoded_plan: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "3")] + pub timeout: i64, + #[prost(message, repeated, tag = "4")] + pub regions: ::prost::alloc::vec::Vec, + /// If this task contains table scan, we still need their region info. + #[prost(int64, tag = "5")] + pub schema_ver: i64, +} +/// Get response of DispatchTaskRequest. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DispatchTaskResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub retry_regions: ::prost::alloc::vec::Vec, +} +/// CancelTaskRequest closes the execution of a task. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CancelTaskRequest { + #[prost(message, optional, tag = "1")] + pub meta: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CancelTaskResponse { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, +} +/// build connection between different tasks. Data is sent by the tasks that are closer to the data sources. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EstablishMppConnectionRequest { + /// node closer to the source + #[prost(message, optional, tag = "1")] + pub sender_meta: ::core::option::Option, + /// node closer to the tidb mpp gather. + #[prost(message, optional, tag = "2")] + pub receiver_meta: ::core::option::Option, +} +/// when TiFlash sends data to TiDB, Data packets wrap tipb.SelectResponse, i.e., serialize tipb.SelectResponse into data; +/// when TiFlash sends data to TiFlash, data blocks are serialized into chunks, and the execution_summaries in tipb.SelectResponse are serialized into data only for the last packet. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MppDataPacket { + #[prost(bytes = "vec", tag = "1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, + #[prost(bytes = "vec", repeated, tag = "3")] + pub chunks: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(int32, tag = "1")] + pub code: i32, + #[prost(string, tag = "2")] + pub msg: ::prost::alloc::string::String, +} diff --git a/src/generated/pdpb.rs b/src/generated/pdpb.rs new file mode 100644 index 00000000..745f5e83 --- /dev/null +++ b/src/generated/pdpb.rs @@ -0,0 +1,1866 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RequestHeader { + /// cluster_id is the ID of the cluster which be sent to. + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + /// sender_id is the ID of the sender server, also member ID or etcd ID. + #[prost(uint64, tag = "2")] + pub sender_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResponseHeader { + /// cluster_id is the ID of the cluster which sent the response. + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + #[prost(message, optional, tag = "2")] + pub error: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Error { + #[prost(enumeration = "ErrorType", tag = "1")] + pub r#type: i32, + #[prost(string, tag = "2")] + pub message: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TsoRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint32, tag = "2")] + pub count: u32, + #[prost(string, tag = "3")] + pub dc_location: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Timestamp { + #[prost(int64, tag = "1")] + pub physical: i64, + #[prost(int64, tag = "2")] + pub logical: i64, + /// Number of suffix bits used for global distinction, + /// PD client will use this to compute a TSO's logical part. + #[prost(uint32, tag = "3")] + pub suffix_bits: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TsoResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint32, tag = "2")] + pub count: u32, + #[prost(message, optional, tag = "3")] + pub timestamp: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BootstrapRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub store: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BootstrapResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub replication_status: ::core::option::Option< + super::replication_modepb::ReplicationStatus, + >, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IsBootstrappedRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IsBootstrappedResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bool, tag = "2")] + pub bootstrapped: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AllocIdRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AllocIdResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetStoreRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub store_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetStoreResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub store: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub stats: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutStoreRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub store: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutStoreResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub replication_status: ::core::option::Option< + super::replication_modepb::ReplicationStatus, + >, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllStoresRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Do NOT return tombstone stores if set to true. + #[prost(bool, tag = "2")] + pub exclude_tombstone_stores: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAllStoresResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub stores: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRegionRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub region_key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRegionResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub leader: ::core::option::Option, + /// Leader considers that these peers are down. + #[prost(message, repeated, tag = "5")] + pub down_peers: ::prost::alloc::vec::Vec, + /// Pending peers are the peers that the leader can't consider as + /// working followers. + #[prost(message, repeated, tag = "6")] + pub pending_peers: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRegionByIdRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScanRegionsRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + /// no limit when limit <= 0. + #[prost(int32, tag = "3")] + pub limit: i32, + /// end_key is +inf when it is empty. + #[prost(bytes = "vec", tag = "4")] + pub end_key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Region { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub leader: ::core::option::Option, + /// Leader considers that these peers are down. + #[prost(message, repeated, tag = "3")] + pub down_peers: ::prost::alloc::vec::Vec, + /// Pending peers are the peers that the leader can't consider as + /// working followers. + #[prost(message, repeated, tag = "4")] + pub pending_peers: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScanRegionsResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Keep for backword compatibability. + #[prost(message, repeated, tag = "2")] + pub region_metas: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "3")] + pub leaders: ::prost::alloc::vec::Vec, + /// Extended region info with down/pending peers. + #[prost(message, repeated, tag = "4")] + pub regions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetClusterConfigRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetClusterConfigResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub cluster: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutClusterConfigRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub cluster: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutClusterConfigResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Member { + /// name is the name of the PD member. + #[prost(string, tag = "1")] + pub name: ::prost::alloc::string::String, + /// member_id is the unique id of the PD member. + #[prost(uint64, tag = "2")] + pub member_id: u64, + #[prost(string, repeated, tag = "3")] + pub peer_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(string, repeated, tag = "4")] + pub client_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(int32, tag = "5")] + pub leader_priority: i32, + #[prost(string, tag = "6")] + pub deploy_path: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub binary_version: ::prost::alloc::string::String, + #[prost(string, tag = "8")] + pub git_hash: ::prost::alloc::string::String, + #[prost(string, tag = "9")] + pub dc_location: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMembersRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetMembersResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub members: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub leader: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub etcd_leader: ::core::option::Option, + #[prost(map = "string, message", tag = "5")] + pub tso_allocator_leaders: ::std::collections::HashMap< + ::prost::alloc::string::String, + Member, + >, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeerStats { + #[prost(message, optional, tag = "1")] + pub peer: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub down_seconds: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionHeartbeatRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region: ::core::option::Option, + /// Leader Peer sending the heartbeat. + #[prost(message, optional, tag = "3")] + pub leader: ::core::option::Option, + /// Leader considers that these peers are down. + #[prost(message, repeated, tag = "4")] + pub down_peers: ::prost::alloc::vec::Vec, + /// Pending peers are the peers that the leader can't consider as + /// working followers. + #[prost(message, repeated, tag = "5")] + pub pending_peers: ::prost::alloc::vec::Vec, + /// Bytes read/written during this period. + #[prost(uint64, tag = "6")] + pub bytes_written: u64, + #[prost(uint64, tag = "7")] + pub bytes_read: u64, + /// Keys read/written during this period. + #[prost(uint64, tag = "8")] + pub keys_written: u64, + #[prost(uint64, tag = "9")] + pub keys_read: u64, + /// Approximate region size. + #[prost(uint64, tag = "10")] + pub approximate_size: u64, + /// Actually reported time interval + #[prost(message, optional, tag = "12")] + pub interval: ::core::option::Option, + /// Approximate number of keys. + #[prost(uint64, tag = "13")] + pub approximate_keys: u64, + /// Term is the term of raft group. + #[prost(uint64, tag = "14")] + pub term: u64, + #[prost(message, optional, tag = "15")] + pub replication_status: ::core::option::Option< + super::replication_modepb::RegionReplicationStatus, + >, + /// QueryStats reported write query stats, and there are read query stats in store heartbeat + #[prost(message, optional, tag = "16")] + pub query_stats: ::core::option::Option, + /// cpu_usage is the CPU time usage of the leader region since the last heartbeat, + /// which is calculated by cpu_time_delta/heartbeat_reported_interval. + #[prost(uint64, tag = "17")] + pub cpu_usage: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeer { + #[prost(message, optional, tag = "1")] + pub peer: ::core::option::Option, + #[prost(enumeration = "super::eraftpb::ConfChangeType", tag = "2")] + pub change_type: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeerV2 { + /// If changes is empty, it means that to exit joint state. + #[prost(message, repeated, tag = "1")] + pub changes: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferLeader { + #[prost(message, optional, tag = "1")] + pub peer: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub peers: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Merge { + #[prost(message, optional, tag = "1")] + pub target: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitRegion { + #[prost(enumeration = "CheckPolicy", tag = "1")] + pub policy: i32, + #[prost(bytes = "vec", repeated, tag = "2")] + pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionHeartbeatResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// Notice, Pd only allows handling reported epoch >= current pd's. + /// Leader peer reports region status with RegionHeartbeatRequest + /// to pd regularly, pd will determine whether this region + /// should do ChangePeer or not. + /// E,g, max peer number is 3, region A, first only peer 1 in A. + /// 1. Pd region state -> Peers (1), ConfVer (1). + /// 2. Leader peer 1 reports region state to pd, pd finds the + /// peer number is < 3, so first changes its current region + /// state -> Peers (1, 2), ConfVer (1), and returns ChangePeer Adding 2. + /// 3. Leader does ChangePeer, then reports 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 + /// finished, pd stills responses ChangePeer Adding 2, of course, we must + /// guarantee the second ChangePeer can't be applied in TiKV. + #[prost(message, optional, tag = "2")] + pub change_peer: ::core::option::Option, + /// Pd can return transfer_leader to let TiKV does leader transfer itself. + #[prost(message, optional, tag = "3")] + pub transfer_leader: ::core::option::Option, + /// ID of the region + #[prost(uint64, tag = "4")] + pub region_id: u64, + #[prost(message, optional, tag = "5")] + pub region_epoch: ::core::option::Option, + /// Leader of the region at the moment of the corresponding request was made. + #[prost(message, optional, tag = "6")] + pub target_peer: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub merge: ::core::option::Option, + /// PD sends split_region to let TiKV split a region into two regions. + #[prost(message, optional, tag = "8")] + pub split_region: ::core::option::Option, + /// Multiple change peer operations atomically. + /// Note: PD can use both ChangePeer and ChangePeerV2 at the same time + /// (not in the same RegionHeartbeatResponse). + /// Now, PD use ChangePeerV2 only for replacing peers. + #[prost(message, optional, tag = "9")] + pub change_peer_v2: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AskSplitRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AskSplitResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// We split the region into two, first uses the origin + /// parent region id, and the second uses the new_region_id. + /// We must guarantee that the new_region_id is global unique. + #[prost(uint64, tag = "2")] + pub new_region_id: u64, + /// The peer ids for the new split region. + #[prost(uint64, repeated, tag = "3")] + pub new_peer_ids: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReportSplitRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub left: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub right: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReportSplitResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AskBatchSplitRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region: ::core::option::Option, + #[prost(uint32, tag = "3")] + pub split_count: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitId { + #[prost(uint64, tag = "1")] + pub new_region_id: u64, + #[prost(uint64, repeated, tag = "2")] + pub new_peer_ids: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AskBatchSplitResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub ids: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReportBatchSplitRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub regions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReportBatchSplitResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TimeInterval { + /// The unix timestamp in seconds of the start of this period. + #[prost(uint64, tag = "1")] + pub start_timestamp: u64, + /// The unix timestamp in seconds of the end of this period. + #[prost(uint64, tag = "2")] + pub end_timestamp: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RecordPair { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub value: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeerStat { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(uint64, tag = "2")] + pub read_keys: u64, + #[prost(uint64, tag = "3")] + pub read_bytes: u64, + #[prost(message, optional, tag = "4")] + pub query_stats: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreStats { + #[prost(uint64, tag = "1")] + pub store_id: u64, + /// Capacity for the store. + #[prost(uint64, tag = "2")] + pub capacity: u64, + /// Available size for the store. + #[prost(uint64, tag = "3")] + pub available: u64, + /// Total region count in this store. + #[prost(uint32, tag = "4")] + pub region_count: u32, + /// Current sending snapshot count. + #[prost(uint32, tag = "5")] + pub sending_snap_count: u32, + /// Current receiving snapshot count. + #[prost(uint32, tag = "6")] + pub receiving_snap_count: u32, + /// When the store is started (unix timestamp in seconds). + #[prost(uint32, tag = "7")] + pub start_time: u32, + /// How many region is applying snapshot. + #[prost(uint32, tag = "8")] + pub applying_snap_count: u32, + /// If the store is busy + #[prost(bool, tag = "9")] + pub is_busy: bool, + /// Actually used space by db + #[prost(uint64, tag = "10")] + pub used_size: u64, + /// Bytes written for the store during this period. + #[prost(uint64, tag = "11")] + pub bytes_written: u64, + /// Keys written for the store during this period. + #[prost(uint64, tag = "12")] + pub keys_written: u64, + /// Bytes read for the store during this period. + #[prost(uint64, tag = "13")] + pub bytes_read: u64, + /// Keys read for the store during this period. + #[prost(uint64, tag = "14")] + pub keys_read: u64, + /// Actually reported time interval + #[prost(message, optional, tag = "15")] + pub interval: ::core::option::Option, + /// Threads' CPU usages in the store + #[prost(message, repeated, tag = "16")] + pub cpu_usages: ::prost::alloc::vec::Vec, + /// Threads' read disk I/O rates in the store + #[prost(message, repeated, tag = "17")] + pub read_io_rates: ::prost::alloc::vec::Vec, + /// Threads' write disk I/O rates in the store + #[prost(message, repeated, tag = "18")] + pub write_io_rates: ::prost::alloc::vec::Vec, + /// Operations' latencies in the store + #[prost(message, repeated, tag = "19")] + pub op_latencies: ::prost::alloc::vec::Vec, + /// Hot peer stat in the store + #[prost(message, repeated, tag = "20")] + pub peer_stats: ::prost::alloc::vec::Vec, + /// Store query stats + #[prost(message, optional, tag = "21")] + pub query_stats: ::core::option::Option, + /// Score that represents the speed of the store, ranges in [1, 100], lower is better. + #[prost(uint64, tag = "22")] + pub slow_score: u64, + /// Damaged regions on the store that need to be removed by PD. + #[prost(uint64, repeated, tag = "23")] + pub damaged_regions_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PeerReport { + #[prost(message, optional, tag = "1")] + pub raft_state: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub region_state: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreReport { + #[prost(message, repeated, tag = "1")] + pub peer_reports: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreHeartbeatRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub stats: ::core::option::Option, + /// Detailed store report that is only filled up on PD's demand for online unsafe recover. + #[prost(message, optional, tag = "3")] + pub store_report: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RecoveryPlan { + #[prost(message, repeated, tag = "1")] + pub creates: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "2")] + pub updates: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "3")] + pub deletes: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreHeartbeatResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub replication_status: ::core::option::Option< + super::replication_modepb::ReplicationStatus, + >, + #[prost(string, tag = "3")] + pub cluster_version: ::prost::alloc::string::String, + #[prost(bool, tag = "4")] + pub require_detailed_report: bool, + #[prost(message, optional, tag = "5")] + pub plan: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScatterRegionRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[deprecated] + #[prost(uint64, tag = "2")] + pub region_id: u64, + /// PD will use these region information if it can't find the region. + /// For example, the region is just split and hasn't report to PD yet. + #[prost(message, optional, tag = "3")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub leader: ::core::option::Option, + /// If group is defined, the regions with the same group would be scattered as a whole group. + /// If not defined, the regions would be scattered in a cluster level. + #[prost(string, tag = "5")] + pub group: ::prost::alloc::string::String, + /// If regions_id is defined, the region_id would be ignored. + #[prost(uint64, repeated, tag = "6")] + pub regions_id: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "7")] + pub retry_limit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ScatterRegionResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub finished_percentage: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetGcSafePointRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetGcSafePointResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub safe_point: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateGcSafePointRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub safe_point: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateGcSafePointResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub new_safe_point: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateServiceGcSafePointRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub service_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "3")] + pub ttl: i64, + #[prost(uint64, tag = "4")] + pub safe_point: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateServiceGcSafePointResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub service_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag = "3")] + pub ttl: i64, + #[prost(uint64, tag = "4")] + pub min_safe_point: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionStat { + /// Bytes read/written during this period. + #[prost(uint64, tag = "1")] + pub bytes_written: u64, + #[prost(uint64, tag = "2")] + pub bytes_read: u64, + /// Keys read/written during this period. + #[prost(uint64, tag = "3")] + pub keys_written: u64, + #[prost(uint64, tag = "4")] + pub keys_read: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncRegionRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub member: ::core::option::Option, + /// the follower PD will use the start index to locate historical changes + /// that require synchronization. + #[prost(uint64, tag = "3")] + pub start_index: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncRegionResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// the leader PD will send the repsonds include + /// changed regions records and the index of the first record. + #[prost(message, repeated, tag = "2")] + pub regions: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub start_index: u64, + #[prost(message, repeated, tag = "4")] + pub region_stats: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "5")] + pub region_leaders: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperatorRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub region_id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetOperatorResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub region_id: u64, + #[prost(bytes = "vec", tag = "3")] + pub desc: ::prost::alloc::vec::Vec, + #[prost(enumeration = "OperatorStatus", tag = "4")] + pub status: i32, + #[prost(bytes = "vec", tag = "5")] + pub kind: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncMaxTsRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub max_ts: ::core::option::Option, + /// If skip_check is true, the sync will try to write the max_ts without checking whether it's bigger. + #[prost(bool, tag = "3")] + pub skip_check: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SyncMaxTsResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub max_local_ts: ::core::option::Option, + #[prost(string, repeated, tag = "3")] + pub synced_dcs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitRegionsRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", repeated, tag = "2")] + pub split_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(uint64, tag = "3")] + pub retry_limit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitRegionsResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub finished_percentage: u64, + #[prost(uint64, repeated, tag = "3")] + pub regions_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitAndScatterRegionsRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(bytes = "vec", repeated, tag = "2")] + pub split_keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(string, tag = "3")] + pub group: ::prost::alloc::string::String, + #[prost(uint64, tag = "4")] + pub retry_limit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitAndScatterRegionsResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub split_finished_percentage: u64, + #[prost(uint64, tag = "3")] + pub scatter_finished_percentage: u64, + #[prost(uint64, repeated, tag = "4")] + pub regions_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDcLocationInfoRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(string, tag = "2")] + pub dc_location: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetDcLocationInfoResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// suffix sign + #[prost(int32, tag = "2")] + pub suffix: i32, + /// max_ts will be included into this response if PD leader think the receiver needs, + /// which it's set when the number of the max suffix bits changes. + #[prost(message, optional, tag = "3")] + pub max_ts: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryStats { + #[prost(uint64, tag = "1")] + pub gc: u64, + #[prost(uint64, tag = "2")] + pub get: u64, + #[prost(uint64, tag = "3")] + pub scan: u64, + #[prost(uint64, tag = "4")] + pub coprocessor: u64, + #[prost(uint64, tag = "5")] + pub delete: u64, + #[prost(uint64, tag = "6")] + pub delete_range: u64, + #[prost(uint64, tag = "7")] + pub put: u64, + #[prost(uint64, tag = "8")] + pub prewrite: u64, + #[prost(uint64, tag = "9")] + pub acquire_pessimistic_lock: u64, + #[prost(uint64, tag = "10")] + pub commit: u64, + #[prost(uint64, tag = "11")] + pub rollback: u64, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ErrorType { + Ok = 0, + Unknown = 1, + NotBootstrapped = 2, + StoreTombstone = 3, + AlreadyBootstrapped = 4, + IncompatibleVersion = 5, + RegionNotFound = 6, +} +impl ErrorType { + /// 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 { + ErrorType::Ok => "OK", + ErrorType::Unknown => "UNKNOWN", + ErrorType::NotBootstrapped => "NOT_BOOTSTRAPPED", + ErrorType::StoreTombstone => "STORE_TOMBSTONE", + ErrorType::AlreadyBootstrapped => "ALREADY_BOOTSTRAPPED", + ErrorType::IncompatibleVersion => "INCOMPATIBLE_VERSION", + ErrorType::RegionNotFound => "REGION_NOT_FOUND", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "OK" => Some(Self::Ok), + "UNKNOWN" => Some(Self::Unknown), + "NOT_BOOTSTRAPPED" => Some(Self::NotBootstrapped), + "STORE_TOMBSTONE" => Some(Self::StoreTombstone), + "ALREADY_BOOTSTRAPPED" => Some(Self::AlreadyBootstrapped), + "INCOMPATIBLE_VERSION" => Some(Self::IncompatibleVersion), + "REGION_NOT_FOUND" => Some(Self::RegionNotFound), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum CheckPolicy { + Scan = 0, + Approximate = 1, + Usekey = 2, +} +impl CheckPolicy { + /// 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 { + CheckPolicy::Scan => "SCAN", + CheckPolicy::Approximate => "APPROXIMATE", + CheckPolicy::Usekey => "USEKEY", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCAN" => Some(Self::Scan), + "APPROXIMATE" => Some(Self::Approximate), + "USEKEY" => Some(Self::Usekey), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum OperatorStatus { + Success = 0, + Timeout = 1, + Cancel = 2, + Replace = 3, + Running = 4, +} +impl OperatorStatus { + /// 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 { + OperatorStatus::Success => "SUCCESS", + OperatorStatus::Timeout => "TIMEOUT", + OperatorStatus::Cancel => "CANCEL", + OperatorStatus::Replace => "REPLACE", + OperatorStatus::Running => "RUNNING", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCCESS" => Some(Self::Success), + "TIMEOUT" => Some(Self::Timeout), + "CANCEL" => Some(Self::Cancel), + "REPLACE" => Some(Self::Replace), + "RUNNING" => Some(Self::Running), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum QueryKind { + Others = 0, + Gc = 1, + Get = 2, + Scan = 3, + Coprocessor = 4, + Delete = 5, + DeleteRange = 6, + Put = 7, + Prewrite = 8, + AcquirePessimisticLock = 9, + Commit = 10, + Rollback = 11, +} +impl QueryKind { + /// 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 { + QueryKind::Others => "Others", + QueryKind::Gc => "GC", + QueryKind::Get => "Get", + QueryKind::Scan => "Scan", + QueryKind::Coprocessor => "Coprocessor", + QueryKind::Delete => "Delete", + QueryKind::DeleteRange => "DeleteRange", + QueryKind::Put => "Put", + QueryKind::Prewrite => "Prewrite", + QueryKind::AcquirePessimisticLock => "AcquirePessimisticLock", + QueryKind::Commit => "Commit", + QueryKind::Rollback => "Rollback", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Others" => Some(Self::Others), + "GC" => Some(Self::Gc), + "Get" => Some(Self::Get), + "Scan" => Some(Self::Scan), + "Coprocessor" => Some(Self::Coprocessor), + "Delete" => Some(Self::Delete), + "DeleteRange" => Some(Self::DeleteRange), + "Put" => Some(Self::Put), + "Prewrite" => Some(Self::Prewrite), + "AcquirePessimisticLock" => Some(Self::AcquirePessimisticLock), + "Commit" => Some(Self::Commit), + "Rollback" => Some(Self::Rollback), + _ => None, + } + } +} +/// Generated client implementations. +pub mod pd_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + #[derive(Debug, Clone)] + pub struct PdClient { + inner: tonic::client::Grpc, + } + impl PdClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl PdClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> PdClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + PdClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// GetMembers get the member list of this cluster. It does not require + /// the cluster_id in request matchs the id of this cluster. + pub async fn get_members( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetMembers"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetMembers")); + self.inner.unary(req, path, codec).await + } + pub async fn tso( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/Tso"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "Tso")); + self.inner.streaming(req, path, codec).await + } + pub async fn bootstrap( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/Bootstrap"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "Bootstrap")); + self.inner.unary(req, path, codec).await + } + pub async fn is_bootstrapped( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/IsBootstrapped"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "IsBootstrapped")); + self.inner.unary(req, path, codec).await + } + pub async fn alloc_id( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/AllocID"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "AllocID")); + self.inner.unary(req, path, codec).await + } + pub async fn get_store( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetStore"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetStore")); + self.inner.unary(req, path, codec).await + } + pub async fn put_store( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/PutStore"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "PutStore")); + self.inner.unary(req, path, codec).await + } + pub async fn get_all_stores( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetAllStores"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetAllStores")); + self.inner.unary(req, path, codec).await + } + pub async fn store_heartbeat( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/StoreHeartbeat"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "StoreHeartbeat")); + self.inner.unary(req, path, codec).await + } + pub async fn region_heartbeat( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::RegionHeartbeatRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/RegionHeartbeat"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "RegionHeartbeat")); + self.inner.streaming(req, path, codec).await + } + pub async fn get_region( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetRegion"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetRegion")); + self.inner.unary(req, path, codec).await + } + pub async fn get_prev_region( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetPrevRegion"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetPrevRegion")); + self.inner.unary(req, path, codec).await + } + pub async fn get_region_by_id( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetRegionByID"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetRegionByID")); + self.inner.unary(req, path, codec).await + } + pub async fn scan_regions( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/ScanRegions"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "ScanRegions")); + self.inner.unary(req, path, codec).await + } + pub async fn ask_split( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/AskSplit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "AskSplit")); + self.inner.unary(req, path, codec).await + } + pub async fn report_split( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/ReportSplit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "ReportSplit")); + self.inner.unary(req, path, codec).await + } + pub async fn ask_batch_split( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/AskBatchSplit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "AskBatchSplit")); + self.inner.unary(req, path, codec).await + } + pub async fn report_batch_split( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/ReportBatchSplit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "ReportBatchSplit")); + self.inner.unary(req, path, codec).await + } + pub async fn get_cluster_config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetClusterConfig"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetClusterConfig")); + self.inner.unary(req, path, codec).await + } + pub async fn put_cluster_config( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/PutClusterConfig"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "PutClusterConfig")); + self.inner.unary(req, path, codec).await + } + pub async fn scatter_region( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/ScatterRegion"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "ScatterRegion")); + self.inner.unary(req, path, codec).await + } + pub async fn get_gc_safe_point( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetGCSafePoint"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetGCSafePoint")); + self.inner.unary(req, path, codec).await + } + pub async fn update_gc_safe_point( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/pdpb.PD/UpdateGCSafePoint", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "UpdateGCSafePoint")); + self.inner.unary(req, path, codec).await + } + pub async fn update_service_gc_safe_point( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/pdpb.PD/UpdateServiceGCSafePoint", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("pdpb.PD", "UpdateServiceGCSafePoint")); + self.inner.unary(req, path, codec).await + } + pub async fn sync_regions( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/SyncRegions"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "SyncRegions")); + self.inner.streaming(req, path, codec).await + } + pub async fn get_operator( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/GetOperator"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetOperator")); + self.inner.unary(req, path, codec).await + } + pub async fn sync_max_ts( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/SyncMaxTS"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "SyncMaxTS")); + self.inner.unary(req, path, codec).await + } + pub async fn split_regions( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/pdpb.PD/SplitRegions"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "SplitRegions")); + self.inner.unary(req, path, codec).await + } + pub async fn split_and_scatter_regions( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/pdpb.PD/SplitAndScatterRegions", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("pdpb.PD", "SplitAndScatterRegions")); + self.inner.unary(req, path, codec).await + } + pub async fn get_dc_location_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/pdpb.PD/GetDCLocationInfo", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("pdpb.PD", "GetDCLocationInfo")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/generated/raft_cmdpb.rs b/src/generated/raft_cmdpb.rs new file mode 100644 index 00000000..da108826 --- /dev/null +++ b/src/generated/raft_cmdpb.rs @@ -0,0 +1,598 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetRequest { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetResponse { + #[prost(bytes = "vec", tag = "1")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutRequest { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PutResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRequest { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub key: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRangeRequest { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub end_key: ::prost::alloc::vec::Vec, + #[prost(bool, tag = "4")] + pub notify_only: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteRangeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapResponse { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrewriteRequest { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub lock: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrewriteResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngestSstRequest { + #[prost(message, optional, tag = "1")] + pub sst: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IngestSstResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReadIndexRequest { + /// In replica read, leader uses start_ts and key_ranges to check memory locks. + #[prost(uint64, tag = "1")] + pub start_ts: u64, + #[prost(message, repeated, tag = "2")] + pub key_ranges: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReadIndexResponse { + #[prost(uint64, tag = "1")] + pub read_index: u64, + /// The memory lock blocking this read at the leader + #[prost(message, optional, tag = "2")] + pub locked: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Request { + #[prost(enumeration = "CmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub get: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub put: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub delete: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub snap: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub prewrite: ::core::option::Option, + #[prost(message, optional, tag = "8")] + pub delete_range: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub ingest_sst: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub read_index: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Response { + #[prost(enumeration = "CmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub get: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub put: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub delete: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub snap: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub prewrite: ::core::option::Option, + #[prost(message, optional, tag = "8")] + pub delte_range: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub ingest_sst: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub read_index: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeerRequest { + /// This can be only called in internal RaftStore now. + #[prost(enumeration = "super::eraftpb::ConfChangeType", tag = "1")] + pub change_type: i32, + #[prost(message, optional, tag = "2")] + pub peer: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeerResponse { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeerV2Request { + #[prost(message, repeated, tag = "1")] + pub changes: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChangePeerV2Response { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitRequest { + /// This can be only called in internal RaftStore now. + /// The split_key must be in the been splitting region. + #[prost(bytes = "vec", tag = "1")] + pub split_key: ::prost::alloc::vec::Vec, + /// We split the region into two, first uses the origin + /// parent region id, and the second uses the new_region_id. + /// We must guarantee that the new_region_id is global unique. + #[prost(uint64, tag = "2")] + pub new_region_id: u64, + /// The peer ids for the new split region. + #[prost(uint64, repeated, tag = "3")] + pub new_peer_ids: ::prost::alloc::vec::Vec, + /// If true, right region derive the origin region_id, + /// left region use new_region_id. + /// Will be ignored in batch split, use `BatchSplitRequest::right_derive` instead. + #[deprecated] + #[prost(bool, tag = "4")] + pub right_derive: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SplitResponse { + #[prost(message, optional, tag = "1")] + pub left: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub right: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchSplitRequest { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, + /// If true, the last region derive the origin region_id, + /// other regions use new ids. + #[prost(bool, tag = "2")] + pub right_derive: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchSplitResponse { + #[prost(message, repeated, tag = "1")] + pub regions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactLogRequest { + #[prost(uint64, tag = "1")] + pub compact_index: u64, + #[prost(uint64, tag = "2")] + pub compact_term: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CompactLogResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferLeaderRequest { + #[prost(message, optional, tag = "1")] + pub peer: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub peers: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferLeaderResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ComputeHashRequest { + #[prost(bytes = "vec", tag = "1")] + pub context: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerifyHashRequest { + #[prost(uint64, tag = "1")] + pub index: u64, + #[prost(bytes = "vec", tag = "2")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub context: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VerifyHashResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrepareMergeRequest { + #[prost(uint64, tag = "1")] + pub min_index: u64, + #[prost(message, optional, tag = "2")] + pub target: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrepareMergeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitMergeRequest { + #[prost(message, optional, tag = "1")] + pub source: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub commit: u64, + #[prost(message, repeated, tag = "3")] + pub entries: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitMergeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RollbackMergeRequest { + #[prost(uint64, tag = "1")] + pub commit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RollbackMergeResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AdminRequest { + #[prost(enumeration = "AdminCmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub change_peer: ::core::option::Option, + #[deprecated] + #[prost(message, optional, tag = "3")] + pub split: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub compact_log: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub transfer_leader: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub verify_hash: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub prepare_merge: ::core::option::Option, + #[prost(message, optional, tag = "8")] + pub commit_merge: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub rollback_merge: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub splits: ::core::option::Option, + #[prost(message, optional, tag = "11")] + pub change_peer_v2: ::core::option::Option, + #[prost(message, optional, tag = "12")] + pub compute_hash: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AdminResponse { + #[prost(enumeration = "AdminCmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub change_peer: ::core::option::Option, + #[deprecated] + #[prost(message, optional, tag = "3")] + pub split: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub compact_log: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub transfer_leader: ::core::option::Option, + #[prost(message, optional, tag = "6")] + pub verify_hash: ::core::option::Option, + #[prost(message, optional, tag = "7")] + pub prepare_merge: ::core::option::Option, + #[prost(message, optional, tag = "8")] + pub commit_merge: ::core::option::Option, + #[prost(message, optional, tag = "9")] + pub rollback_merge: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub splits: ::core::option::Option, + #[prost(message, optional, tag = "11")] + pub change_peer_v2: ::core::option::Option, +} +/// For get the leader of the region. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionLeaderRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionLeaderResponse { + #[prost(message, optional, tag = "1")] + pub leader: ::core::option::Option, +} +/// For getting more information of the region. +/// We add some admin operations (ChangePeer, Split...) into the pb job list, +/// then pd server will peek the first one, handle it and then pop it from the job lib. +/// But sometimes, the pd server may crash before popping. When another pd server +/// starts and finds the job is running but not finished, it will first check whether +/// the raft server already has handled this job. +/// E,g, for ChangePeer, if we add Peer10 into region1 and find region1 has already had +/// Peer10, we can think this ChangePeer is finished, and can pop this job from job list +/// directly. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionDetailRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionDetailResponse { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub leader: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusRequest { + #[prost(enumeration = "StatusCmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub region_leader: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region_detail: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StatusResponse { + #[prost(enumeration = "StatusCmdType", tag = "1")] + pub cmd_type: i32, + #[prost(message, optional, tag = "2")] + pub region_leader: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub region_detail: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftRequestHeader { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub peer: ::core::option::Option, + /// true for read linearization + #[prost(bool, tag = "3")] + pub read_quorum: bool, + /// 16 bytes, to distinguish request. + #[prost(bytes = "vec", tag = "4")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "5")] + pub region_epoch: ::core::option::Option, + #[prost(uint64, tag = "6")] + pub term: u64, + #[prost(bool, tag = "7")] + pub sync_log: bool, + #[prost(bool, tag = "8")] + pub replica_read: bool, + /// Read requests can be responsed directly after the Raft applys to `applied_index`. + #[prost(uint64, tag = "9")] + pub applied_index: u64, + /// Custom flags for this raft request. + #[prost(uint64, tag = "10")] + pub flags: u64, + #[prost(bytes = "vec", tag = "11")] + pub flag_data: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftResponseHeader { + #[prost(message, optional, tag = "1")] + pub error: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub uuid: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "3")] + pub current_term: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftCmdRequest { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + /// We can't enclose normal requests and administrator request + /// at same time. + #[prost(message, repeated, tag = "2")] + pub requests: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub admin_request: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub status_request: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftCmdResponse { + #[prost(message, optional, tag = "1")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag = "2")] + pub responses: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "3")] + pub admin_response: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub status_response: ::core::option::Option, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum CmdType { + Invalid = 0, + Get = 1, + Put = 3, + Delete = 4, + Snap = 5, + Prewrite = 6, + DeleteRange = 7, + IngestSst = 8, + ReadIndex = 9, +} +impl CmdType { + /// 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 { + CmdType::Invalid => "Invalid", + CmdType::Get => "Get", + CmdType::Put => "Put", + CmdType::Delete => "Delete", + CmdType::Snap => "Snap", + CmdType::Prewrite => "Prewrite", + CmdType::DeleteRange => "DeleteRange", + CmdType::IngestSst => "IngestSST", + CmdType::ReadIndex => "ReadIndex", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Invalid" => Some(Self::Invalid), + "Get" => Some(Self::Get), + "Put" => Some(Self::Put), + "Delete" => Some(Self::Delete), + "Snap" => Some(Self::Snap), + "Prewrite" => Some(Self::Prewrite), + "DeleteRange" => Some(Self::DeleteRange), + "IngestSST" => Some(Self::IngestSst), + "ReadIndex" => Some(Self::ReadIndex), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AdminCmdType { + InvalidAdmin = 0, + ChangePeer = 1, + /// Use `BatchSplit` instead. + Split = 2, + CompactLog = 3, + TransferLeader = 4, + ComputeHash = 5, + VerifyHash = 6, + PrepareMerge = 7, + CommitMerge = 8, + RollbackMerge = 9, + BatchSplit = 10, + ChangePeerV2 = 11, +} +impl AdminCmdType { + /// 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 { + AdminCmdType::InvalidAdmin => "InvalidAdmin", + AdminCmdType::ChangePeer => "ChangePeer", + AdminCmdType::Split => "Split", + AdminCmdType::CompactLog => "CompactLog", + AdminCmdType::TransferLeader => "TransferLeader", + AdminCmdType::ComputeHash => "ComputeHash", + AdminCmdType::VerifyHash => "VerifyHash", + AdminCmdType::PrepareMerge => "PrepareMerge", + AdminCmdType::CommitMerge => "CommitMerge", + AdminCmdType::RollbackMerge => "RollbackMerge", + AdminCmdType::BatchSplit => "BatchSplit", + AdminCmdType::ChangePeerV2 => "ChangePeerV2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "InvalidAdmin" => Some(Self::InvalidAdmin), + "ChangePeer" => Some(Self::ChangePeer), + "Split" => Some(Self::Split), + "CompactLog" => Some(Self::CompactLog), + "TransferLeader" => Some(Self::TransferLeader), + "ComputeHash" => Some(Self::ComputeHash), + "VerifyHash" => Some(Self::VerifyHash), + "PrepareMerge" => Some(Self::PrepareMerge), + "CommitMerge" => Some(Self::CommitMerge), + "RollbackMerge" => Some(Self::RollbackMerge), + "BatchSplit" => Some(Self::BatchSplit), + "ChangePeerV2" => Some(Self::ChangePeerV2), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StatusCmdType { + InvalidStatus = 0, + RegionLeader = 1, + RegionDetail = 2, +} +impl StatusCmdType { + /// 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 { + StatusCmdType::InvalidStatus => "InvalidStatus", + StatusCmdType::RegionLeader => "RegionLeader", + StatusCmdType::RegionDetail => "RegionDetail", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "InvalidStatus" => Some(Self::InvalidStatus), + "RegionLeader" => Some(Self::RegionLeader), + "RegionDetail" => Some(Self::RegionDetail), + _ => None, + } + } +} diff --git a/src/generated/raft_serverpb.rs b/src/generated/raft_serverpb.rs new file mode 100644 index 00000000..a9aedfd5 --- /dev/null +++ b/src/generated/raft_serverpb.rs @@ -0,0 +1,225 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftMessage { + #[prost(uint64, tag = "1")] + pub region_id: u64, + #[prost(message, optional, tag = "2")] + pub from_peer: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub to_peer: ::core::option::Option, + #[prost(message, optional, tag = "4")] + pub message: ::core::option::Option, + #[prost(message, optional, tag = "5")] + pub region_epoch: ::core::option::Option, + /// true means to_peer is a tombstone peer and it should remove itself. + #[prost(bool, tag = "6")] + pub is_tombstone: bool, + /// Region key range [start_key, end_key). + #[prost(bytes = "vec", tag = "7")] + pub start_key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "8")] + pub end_key: ::prost::alloc::vec::Vec, + /// If it has value, to_peer should be removed if merge is never going to complete. + #[prost(message, optional, tag = "9")] + pub merge_target: ::core::option::Option, + #[prost(message, optional, tag = "10")] + pub extra_msg: ::core::option::Option, + #[prost(bytes = "vec", tag = "11")] + pub extra_ctx: ::prost::alloc::vec::Vec, + #[prost(enumeration = "super::disk_usage::DiskUsage", tag = "12")] + pub disk_usage: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftTruncatedState { + #[prost(uint64, tag = "1")] + pub index: u64, + #[prost(uint64, tag = "2")] + pub term: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotCfFile { + #[prost(string, tag = "1")] + pub cf: ::prost::alloc::string::String, + #[prost(uint64, tag = "2")] + pub size: u64, + #[prost(uint32, tag = "3")] + pub checksum: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotMeta { + #[prost(message, repeated, tag = "1")] + pub cf_files: ::prost::alloc::vec::Vec, + /// true means this snapshot is triggered for load balance + #[prost(bool, tag = "2")] + pub for_balance: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SnapshotChunk { + #[prost(message, optional, tag = "1")] + pub message: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub data: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Done {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct KeyValue { + #[prost(bytes = "vec", tag = "1")] + pub key: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftSnapshotData { + #[prost(message, optional, tag = "1")] + pub region: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub file_size: u64, + #[prost(message, repeated, tag = "3")] + pub data: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "4")] + pub version: u64, + #[prost(message, optional, tag = "5")] + pub meta: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StoreIdent { + #[prost(uint64, tag = "1")] + pub cluster_id: u64, + #[prost(uint64, tag = "2")] + pub store_id: u64, + #[prost(enumeration = "super::kvrpcpb::ApiVersion", tag = "3")] + pub api_version: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftLocalState { + #[prost(message, optional, tag = "1")] + pub hard_state: ::core::option::Option, + #[prost(uint64, tag = "2")] + pub last_index: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RaftApplyState { + #[prost(uint64, tag = "1")] + pub applied_index: u64, + #[prost(uint64, tag = "3")] + pub last_commit_index: u64, + #[prost(uint64, tag = "4")] + pub commit_index: u64, + #[prost(uint64, tag = "5")] + pub commit_term: u64, + #[prost(message, optional, tag = "2")] + pub truncated_state: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MergeState { + #[prost(uint64, tag = "1")] + pub min_index: u64, + #[prost(message, optional, tag = "2")] + pub target: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub commit: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionLocalState { + #[prost(enumeration = "PeerState", tag = "1")] + pub state: i32, + #[prost(message, optional, tag = "2")] + pub region: ::core::option::Option, + #[prost(message, optional, tag = "3")] + pub merge_state: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExtraMessage { + #[prost(enumeration = "ExtraMessageType", tag = "1")] + pub r#type: i32, + #[prost(uint64, tag = "2")] + pub premerge_commit: u64, + #[prost(message, repeated, tag = "3")] + pub check_peers: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum PeerState { + Normal = 0, + Applying = 1, + Tombstone = 2, + Merging = 3, +} +impl PeerState { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + PeerState::Normal => "Normal", + PeerState::Applying => "Applying", + PeerState::Tombstone => "Tombstone", + PeerState::Merging => "Merging", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Normal" => Some(Self::Normal), + "Applying" => Some(Self::Applying), + "Tombstone" => Some(Self::Tombstone), + "Merging" => Some(Self::Merging), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ExtraMessageType { + MsgRegionWakeUp = 0, + MsgWantRollbackMerge = 1, + MsgCheckStalePeer = 2, + MsgCheckStalePeerResponse = 3, + /// If leader is going to sleep, it will send requests to all its followers + /// to make sure they all agree to sleep. + MsgHibernateRequest = 4, + MsgHibernateResponse = 5, +} +impl ExtraMessageType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ExtraMessageType::MsgRegionWakeUp => "MsgRegionWakeUp", + ExtraMessageType::MsgWantRollbackMerge => "MsgWantRollbackMerge", + ExtraMessageType::MsgCheckStalePeer => "MsgCheckStalePeer", + ExtraMessageType::MsgCheckStalePeerResponse => "MsgCheckStalePeerResponse", + ExtraMessageType::MsgHibernateRequest => "MsgHibernateRequest", + ExtraMessageType::MsgHibernateResponse => "MsgHibernateResponse", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MsgRegionWakeUp" => Some(Self::MsgRegionWakeUp), + "MsgWantRollbackMerge" => Some(Self::MsgWantRollbackMerge), + "MsgCheckStalePeer" => Some(Self::MsgCheckStalePeer), + "MsgCheckStalePeerResponse" => Some(Self::MsgCheckStalePeerResponse), + "MsgHibernateRequest" => Some(Self::MsgHibernateRequest), + "MsgHibernateResponse" => Some(Self::MsgHibernateResponse), + _ => None, + } + } +} diff --git a/src/generated/replication_modepb.rs b/src/generated/replication_modepb.rs new file mode 100644 index 00000000..1f57b9e6 --- /dev/null +++ b/src/generated/replication_modepb.rs @@ -0,0 +1,127 @@ +/// The replication status sync from PD to TiKV. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReplicationStatus { + #[prost(enumeration = "ReplicationMode", tag = "1")] + pub mode: i32, + #[prost(message, optional, tag = "2")] + pub dr_auto_sync: ::core::option::Option, +} +/// The status of dr-autosync mode. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DrAutoSync { + /// The key of the label that used for distinguish different DC. + #[prost(string, tag = "1")] + pub label_key: ::prost::alloc::string::String, + #[prost(enumeration = "DrAutoSyncState", tag = "2")] + pub state: i32, + /// Unique ID of the state, it increases after each state transfer. + #[prost(uint64, tag = "3")] + pub state_id: u64, + /// Duration to wait before switching to SYNC by force (in seconds) + #[prost(int32, tag = "4")] + pub wait_sync_timeout_hint: i32, +} +/// The replication status sync from TiKV to PD. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct RegionReplicationStatus { + #[prost(enumeration = "RegionReplicationState", tag = "1")] + pub state: i32, + /// Unique ID of the state, it increases after each state transfer. + #[prost(uint64, tag = "2")] + pub state_id: u64, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ReplicationMode { + /// The standard mode. Replicate logs to majority peer. + Majority = 0, + /// DR mode. Replicate logs among 2 DCs. + DrAutoSync = 1, +} +impl ReplicationMode { + /// 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 { + ReplicationMode::Majority => "MAJORITY", + ReplicationMode::DrAutoSync => "DR_AUTO_SYNC", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "MAJORITY" => Some(Self::Majority), + "DR_AUTO_SYNC" => Some(Self::DrAutoSync), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum DrAutoSyncState { + /// Raft logs need to sync between different DCs + Sync = 0, + /// Raft logs need to sync to majority peers + Async = 1, + /// Switching from ASYNC to SYNC mode + SyncRecover = 2, +} +impl DrAutoSyncState { + /// 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 { + DrAutoSyncState::Sync => "SYNC", + DrAutoSyncState::Async => "ASYNC", + DrAutoSyncState::SyncRecover => "SYNC_RECOVER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SYNC" => Some(Self::Sync), + "ASYNC" => Some(Self::Async), + "SYNC_RECOVER" => Some(Self::SyncRecover), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum RegionReplicationState { + /// The region's state is unknown + Unknown = 0, + /// Logs sync to majority peers + SimpleMajority = 1, + /// Logs sync to different DCs + IntegrityOverLabel = 2, +} +impl RegionReplicationState { + /// 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 { + RegionReplicationState::Unknown => "UNKNOWN", + RegionReplicationState::SimpleMajority => "SIMPLE_MAJORITY", + RegionReplicationState::IntegrityOverLabel => "INTEGRITY_OVER_LABEL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNKNOWN" => Some(Self::Unknown), + "SIMPLE_MAJORITY" => Some(Self::SimpleMajority), + "INTEGRITY_OVER_LABEL" => Some(Self::IntegrityOverLabel), + _ => None, + } + } +} diff --git a/src/generated/resource_usage_agent.rs b/src/generated/resource_usage_agent.rs new file mode 100644 index 00000000..325e8f25 --- /dev/null +++ b/src/generated/resource_usage_agent.rs @@ -0,0 +1,305 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CpuTimeRecord { + #[prost(bytes = "vec", tag = "1")] + pub resource_group_tag: ::prost::alloc::vec::Vec, + /// UNIX timestamp in second. + #[prost(uint64, repeated, tag = "2")] + pub record_list_timestamp_sec: ::prost::alloc::vec::Vec, + /// The value can be greater than 1000ms if the requests are running parallelly. + #[prost(uint32, repeated, tag = "3")] + pub record_list_cpu_time_ms: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResourceUsageRecord { + #[prost(bytes = "vec", tag = "1")] + pub resource_group_tag: ::prost::alloc::vec::Vec, + /// UNIX timestamp in second. + #[prost(uint64, repeated, tag = "2")] + pub record_list_timestamp_sec: ::prost::alloc::vec::Vec, + /// The value can be greater than 1000ms if the requests are running parallelly. + #[prost(uint32, repeated, tag = "3")] + pub record_list_cpu_time_ms: ::prost::alloc::vec::Vec, + /// The number of reads of keys associated with resource_group_tag. + #[prost(uint32, repeated, tag = "4")] + pub record_list_read_keys: ::prost::alloc::vec::Vec, + /// The number of writes of keys associated with resource_group_tag. + #[prost(uint32, repeated, tag = "5")] + pub record_list_write_keys: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EmptyResponse {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ResourceMeteringRequest {} +/// Generated client implementations. +pub mod resource_usage_agent_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// ResourceUsageAgent is the service for storing resource usage records. + #[derive(Debug, Clone)] + pub struct ResourceUsageAgentClient { + inner: tonic::client::Grpc, + } + impl ResourceUsageAgentClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ResourceUsageAgentClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ResourceUsageAgentClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ResourceUsageAgentClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// DEPRECATED: We now use `Report` to report not only CPU time. + /// + /// Report the CPU time records. By default, the records with the same + /// resource group tag will be batched by minute. + pub async fn report_cpu_time( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/resource_usage_agent.ResourceUsageAgent/ReportCPUTime", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "resource_usage_agent.ResourceUsageAgent", + "ReportCPUTime", + ), + ); + self.inner.client_streaming(req, path, codec).await + } + /// Report the resource usage records. By default, the records with the same + /// resource group tag will be batched by minute. + pub async fn report( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::ResourceUsageRecord, + >, + ) -> std::result::Result, tonic::Status> { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/resource_usage_agent.ResourceUsageAgent/Report", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("resource_usage_agent.ResourceUsageAgent", "Report"), + ); + self.inner.client_streaming(req, path, codec).await + } + } +} +/// Generated client implementations. +pub mod resource_metering_pub_sub_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// TiKV implements ResourceMeteringPubSub service for clients to subscribe to resource metering records. + #[derive(Debug, Clone)] + pub struct ResourceMeteringPubSubClient { + inner: tonic::client::Grpc, + } + impl ResourceMeteringPubSubClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ResourceMeteringPubSubClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ResourceMeteringPubSubClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + ResourceMeteringPubSubClient::new( + InterceptedService::new(inner, interceptor), + ) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Clients subscribe to resource metering records through this RPC, and TiKV periodically (e.g. per minute) + /// publishes resource metering records to clients via gRPC stream. + pub async fn subscribe( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/resource_usage_agent.ResourceMeteringPubSub/Subscribe", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "resource_usage_agent.ResourceMeteringPubSub", + "Subscribe", + ), + ); + self.inner.server_streaming(req, path, codec).await + } + } +} diff --git a/src/generated/span.rs b/src/generated/span.rs new file mode 100644 index 00000000..5fedadf5 --- /dev/null +++ b/src/generated/span.rs @@ -0,0 +1,60 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpanSet { + #[prost(uint64, tag = "1")] + pub start_time_ns: u64, + #[prost(uint64, tag = "2")] + pub cycles_per_sec: u64, + #[prost(message, repeated, tag = "3")] + pub spans: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "4")] + pub create_time_ns: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Root {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Parent { + #[prost(uint64, tag = "1")] + pub id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Continue { + #[prost(uint64, tag = "1")] + pub id: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Link { + #[prost(oneof = "link::Link", tags = "1, 2, 3")] + pub link: ::core::option::Option, +} +/// Nested message and enum types in `Link`. +pub mod link { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Link { + #[prost(message, tag = "1")] + Root(super::Root), + #[prost(message, tag = "2")] + Parent(super::Parent), + #[prost(message, tag = "3")] + Continue(super::Continue), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Span { + #[prost(uint64, tag = "1")] + pub id: u64, + #[prost(message, optional, tag = "2")] + pub link: ::core::option::Option, + #[prost(uint64, tag = "3")] + pub begin_cycles: u64, + #[prost(uint64, tag = "4")] + pub end_cycles: u64, + #[prost(uint32, tag = "5")] + pub event: u32, +} diff --git a/src/generated/tikvpb.rs b/src/generated/tikvpb.rs new file mode 100644 index 00000000..a0391c10 --- /dev/null +++ b/src/generated/tikvpb.rs @@ -0,0 +1,1595 @@ +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchCommandsRequest { + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "2")] + pub request_ids: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `BatchCommandsRequest`. +pub mod batch_commands_request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Request { + #[prost( + oneof = "request::Cmd", + tags = "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, 33, 34, 255" + )] + pub cmd: ::core::option::Option, + } + /// Nested message and enum types in `Request`. + pub mod request { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Cmd { + #[prost(message, tag = "1")] + Get(super::super::super::kvrpcpb::GetRequest), + #[prost(message, tag = "2")] + Scan(super::super::super::kvrpcpb::ScanRequest), + #[prost(message, tag = "3")] + Prewrite(super::super::super::kvrpcpb::PrewriteRequest), + #[prost(message, tag = "4")] + Commit(super::super::super::kvrpcpb::CommitRequest), + #[prost(message, tag = "5")] + Import(super::super::super::kvrpcpb::ImportRequest), + #[prost(message, tag = "6")] + Cleanup(super::super::super::kvrpcpb::CleanupRequest), + #[prost(message, tag = "7")] + BatchGet(super::super::super::kvrpcpb::BatchGetRequest), + #[prost(message, tag = "8")] + BatchRollback(super::super::super::kvrpcpb::BatchRollbackRequest), + #[prost(message, tag = "9")] + ScanLock(super::super::super::kvrpcpb::ScanLockRequest), + #[prost(message, tag = "10")] + ResolveLock(super::super::super::kvrpcpb::ResolveLockRequest), + #[prost(message, tag = "11")] + Gc(super::super::super::kvrpcpb::GcRequest), + #[prost(message, tag = "12")] + DeleteRange(super::super::super::kvrpcpb::DeleteRangeRequest), + #[prost(message, tag = "13")] + RawGet(super::super::super::kvrpcpb::RawGetRequest), + #[prost(message, tag = "14")] + RawBatchGet(super::super::super::kvrpcpb::RawBatchGetRequest), + #[prost(message, tag = "15")] + RawPut(super::super::super::kvrpcpb::RawPutRequest), + #[prost(message, tag = "16")] + RawBatchPut(super::super::super::kvrpcpb::RawBatchPutRequest), + #[prost(message, tag = "17")] + RawDelete(super::super::super::kvrpcpb::RawDeleteRequest), + #[prost(message, tag = "18")] + RawBatchDelete(super::super::super::kvrpcpb::RawBatchDeleteRequest), + #[prost(message, tag = "19")] + RawScan(super::super::super::kvrpcpb::RawScanRequest), + #[prost(message, tag = "20")] + RawDeleteRange(super::super::super::kvrpcpb::RawDeleteRangeRequest), + #[prost(message, tag = "21")] + RawBatchScan(super::super::super::kvrpcpb::RawBatchScanRequest), + #[prost(message, tag = "22")] + Coprocessor(super::super::super::coprocessor::Request), + #[prost(message, tag = "23")] + PessimisticLock(super::super::super::kvrpcpb::PessimisticLockRequest), + #[prost(message, tag = "24")] + PessimisticRollback( + super::super::super::kvrpcpb::PessimisticRollbackRequest, + ), + #[prost(message, tag = "25")] + CheckTxnStatus(super::super::super::kvrpcpb::CheckTxnStatusRequest), + #[prost(message, tag = "26")] + TxnHeartBeat(super::super::super::kvrpcpb::TxnHeartBeatRequest), + #[prost(message, tag = "33")] + CheckSecondaryLocks( + super::super::super::kvrpcpb::CheckSecondaryLocksRequest, + ), + #[prost(message, tag = "34")] + RawCoprocessor(super::super::super::kvrpcpb::RawCoprocessorRequest), + /// For some test cases. + #[prost(message, tag = "255")] + Empty(super::super::BatchCommandsEmptyRequest), + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchCommandsResponse { + #[prost(message, repeated, tag = "1")] + pub responses: ::prost::alloc::vec::Vec, + #[prost(uint64, repeated, tag = "2")] + pub request_ids: ::prost::alloc::vec::Vec, + /// 280 means TiKV gRPC cpu usage is 280%. + #[prost(uint64, tag = "3")] + pub transport_layer_load: u64, +} +/// Nested message and enum types in `BatchCommandsResponse`. +pub mod batch_commands_response { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct Response { + #[prost( + oneof = "response::Cmd", + tags = "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, 33, 34, 255" + )] + pub cmd: ::core::option::Option, + } + /// Nested message and enum types in `Response`. + pub mod response { + #[allow(clippy::derive_partial_eq_without_eq)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Cmd { + #[prost(message, tag = "1")] + Get(super::super::super::kvrpcpb::GetResponse), + #[prost(message, tag = "2")] + Scan(super::super::super::kvrpcpb::ScanResponse), + #[prost(message, tag = "3")] + Prewrite(super::super::super::kvrpcpb::PrewriteResponse), + #[prost(message, tag = "4")] + Commit(super::super::super::kvrpcpb::CommitResponse), + #[prost(message, tag = "5")] + Import(super::super::super::kvrpcpb::ImportResponse), + #[prost(message, tag = "6")] + Cleanup(super::super::super::kvrpcpb::CleanupResponse), + #[prost(message, tag = "7")] + BatchGet(super::super::super::kvrpcpb::BatchGetResponse), + #[prost(message, tag = "8")] + BatchRollback(super::super::super::kvrpcpb::BatchRollbackResponse), + #[prost(message, tag = "9")] + ScanLock(super::super::super::kvrpcpb::ScanLockResponse), + #[prost(message, tag = "10")] + ResolveLock(super::super::super::kvrpcpb::ResolveLockResponse), + #[prost(message, tag = "11")] + Gc(super::super::super::kvrpcpb::GcResponse), + #[prost(message, tag = "12")] + DeleteRange(super::super::super::kvrpcpb::DeleteRangeResponse), + #[prost(message, tag = "13")] + RawGet(super::super::super::kvrpcpb::RawGetResponse), + #[prost(message, tag = "14")] + RawBatchGet(super::super::super::kvrpcpb::RawBatchGetResponse), + #[prost(message, tag = "15")] + RawPut(super::super::super::kvrpcpb::RawPutResponse), + #[prost(message, tag = "16")] + RawBatchPut(super::super::super::kvrpcpb::RawBatchPutResponse), + #[prost(message, tag = "17")] + RawDelete(super::super::super::kvrpcpb::RawDeleteResponse), + #[prost(message, tag = "18")] + RawBatchDelete(super::super::super::kvrpcpb::RawBatchDeleteResponse), + #[prost(message, tag = "19")] + RawScan(super::super::super::kvrpcpb::RawScanResponse), + #[prost(message, tag = "20")] + RawDeleteRange(super::super::super::kvrpcpb::RawDeleteRangeResponse), + #[prost(message, tag = "21")] + RawBatchScan(super::super::super::kvrpcpb::RawBatchScanResponse), + #[prost(message, tag = "22")] + Coprocessor(super::super::super::coprocessor::Response), + #[prost(message, tag = "23")] + PessimisticLock(super::super::super::kvrpcpb::PessimisticLockResponse), + #[prost(message, tag = "24")] + PessimisticRollback( + super::super::super::kvrpcpb::PessimisticRollbackResponse, + ), + #[prost(message, tag = "25")] + CheckTxnStatus(super::super::super::kvrpcpb::CheckTxnStatusResponse), + #[prost(message, tag = "26")] + TxnHeartBeat(super::super::super::kvrpcpb::TxnHeartBeatResponse), + #[prost(message, tag = "33")] + CheckSecondaryLocks( + super::super::super::kvrpcpb::CheckSecondaryLocksResponse, + ), + #[prost(message, tag = "34")] + RawCoprocessor(super::super::super::kvrpcpb::RawCoprocessorResponse), + /// For some test cases. + #[prost(message, tag = "255")] + Empty(super::super::BatchCommandsEmptyResponse), + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchRaftMessage { + #[prost(message, repeated, tag = "1")] + pub msgs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchCommandsEmptyRequest { + /// ID of the test request. + #[prost(uint64, tag = "1")] + pub test_id: u64, + /// TiKV needs to delay at least such a time to response the client. + #[prost(uint64, tag = "2")] + pub delay_time: u64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BatchCommandsEmptyResponse { + /// ID of the test request. + #[prost(uint64, tag = "1")] + pub test_id: u64, +} +/// Generated client implementations. +pub mod tikv_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + use tonic::codegen::http::Uri; + /// Key/value store API for TiKV. + #[derive(Debug, Clone)] + pub struct TikvClient { + inner: tonic::client::Grpc, + } + impl TikvClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl TikvClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + Send + 'static, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> TikvClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + , + >>::Error: Into + Send + Sync, + { + TikvClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Commands using a transactional interface. + pub async fn kv_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvGet"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvGet")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_scan( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvScan"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvScan")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_prewrite( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvPrewrite"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvPrewrite")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_pessimistic_lock( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::PessimisticLockRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvPessimisticLock", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KvPessimisticLock")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_pessimistic_rollback( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::PessimisticRollbackRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KVPessimisticRollback", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KVPessimisticRollback")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_txn_heart_beat( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvTxnHeartBeat", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KvTxnHeartBeat")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_check_txn_status( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::CheckTxnStatusRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvCheckTxnStatus", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KvCheckTxnStatus")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_check_secondary_locks( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::CheckSecondaryLocksRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvCheckSecondaryLocks", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KvCheckSecondaryLocks")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_commit( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvCommit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvCommit")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_import( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvImport"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvImport")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_cleanup( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvCleanup"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvCleanup")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_batch_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvBatchGet"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvBatchGet")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_batch_rollback( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvBatchRollback", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "KvBatchRollback")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_scan_lock( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvScanLock"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvScanLock")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_resolve_lock( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvResolveLock", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvResolveLock")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_gc( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/KvGC"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvGC")); + self.inner.unary(req, path, codec).await + } + pub async fn kv_delete_range( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/KvDeleteRange", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "KvDeleteRange")); + self.inner.unary(req, path, codec).await + } + /// Raw commands; no transaction support. + pub async fn raw_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawGet"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawGet")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_batch_get( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawBatchGet"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawBatchGet")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_put( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawPut"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawPut")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_batch_put( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawBatchPut"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawBatchPut")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_delete( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawDelete"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawDelete")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_batch_delete( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::RawBatchDeleteRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RawBatchDelete", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RawBatchDelete")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_scan( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawScan"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawScan")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_delete_range( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::RawDeleteRangeRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RawDeleteRange", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RawDeleteRange")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_batch_scan( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawBatchScan"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawBatchScan")); + self.inner.unary(req, path, codec).await + } + /// Get TTL of the key. Returns 0 if TTL is not set for the key. + pub async fn raw_get_key_ttl( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawGetKeyTTL"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawGetKeyTTL")); + self.inner.unary(req, path, codec).await + } + /// Compare if the value in database equals to `RawCASRequest.previous_value` before putting the new value. If not, this request will have no effect and the value in the database will be returned. + pub async fn raw_compare_and_swap( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RawCompareAndSwap", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RawCompareAndSwap")); + self.inner.unary(req, path, codec).await + } + pub async fn raw_checksum( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/RawChecksum"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "RawChecksum")); + self.inner.unary(req, path, codec).await + } + /// Store commands (sent to a each TiKV node in a cluster, rather than a certain region). + pub async fn unsafe_destroy_range( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::UnsafeDestroyRangeRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/UnsafeDestroyRange", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "UnsafeDestroyRange")); + self.inner.unary(req, path, codec).await + } + pub async fn register_lock_observer( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::RegisterLockObserverRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RegisterLockObserver", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RegisterLockObserver")); + self.inner.unary(req, path, codec).await + } + pub async fn check_lock_observer( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::CheckLockObserverRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/CheckLockObserver", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "CheckLockObserver")); + self.inner.unary(req, path, codec).await + } + pub async fn remove_lock_observer( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::RemoveLockObserverRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RemoveLockObserver", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RemoveLockObserver")); + self.inner.unary(req, path, codec).await + } + pub async fn physical_scan_lock( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::PhysicalScanLockRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/PhysicalScanLock", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "PhysicalScanLock")); + self.inner.unary(req, path, codec).await + } + /// Commands for executing SQL in the TiKV coprocessor (i.e., 'pushed down' to TiKV rather than + /// executed in TiDB). + pub async fn coprocessor( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/Coprocessor"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "Coprocessor")); + self.inner.unary(req, path, codec).await + } + pub async fn coprocessor_stream( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/CoprocessorStream", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "CoprocessorStream")); + self.inner.server_streaming(req, path, codec).await + } + pub async fn batch_coprocessor( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response< + tonic::codec::Streaming, + >, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/BatchCoprocessor", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "BatchCoprocessor")); + self.inner.server_streaming(req, path, codec).await + } + /// Command for executing custom user requests in TiKV coprocessor_v2. + pub async fn raw_coprocessor( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::RawCoprocessorRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/RawCoprocessor", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "RawCoprocessor")); + self.inner.unary(req, path, codec).await + } + /// Raft commands (sent between TiKV nodes). + pub async fn raft( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::super::raft_serverpb::RaftMessage, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/Raft"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "Raft")); + self.inner.client_streaming(req, path, codec).await + } + pub async fn batch_raft( + &mut self, + request: impl tonic::IntoStreamingRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/BatchRaft"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "BatchRaft")); + self.inner.client_streaming(req, path, codec).await + } + pub async fn snapshot( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::super::raft_serverpb::SnapshotChunk, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/Snapshot"); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "Snapshot")); + self.inner.client_streaming(req, path, codec).await + } + /// Sent from PD or TiDB to a TiKV node. + pub async fn split_region( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/SplitRegion"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "SplitRegion")); + self.inner.unary(req, path, codec).await + } + /// Sent from TiFlash or TiKV to a TiKV node. + pub async fn read_index( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/ReadIndex"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "ReadIndex")); + self.inner.unary(req, path, codec).await + } + /// Commands for debugging transactions. + pub async fn mvcc_get_by_key( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/MvccGetByKey"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "MvccGetByKey")); + self.inner.unary(req, path, codec).await + } + pub async fn mvcc_get_by_start_ts( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::MvccGetByStartTsRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/MvccGetByStartTs", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "MvccGetByStartTs")); + self.inner.unary(req, path, codec).await + } + /// Batched commands. + pub async fn batch_commands( + &mut self, + request: impl tonic::IntoStreamingRequest< + Message = super::BatchCommandsRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/BatchCommands", + ); + let mut req = request.into_streaming_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "BatchCommands")); + self.inner.streaming(req, path, codec).await + } + /// These are for mpp execution. + pub async fn dispatch_mpp_task( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/DispatchMPPTask", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "DispatchMPPTask")); + self.inner.unary(req, path, codec).await + } + pub async fn cancel_mpp_task( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/CancelMPPTask", + ); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "CancelMPPTask")); + self.inner.unary(req, path, codec).await + } + pub async fn establish_mpp_connection( + &mut self, + request: impl tonic::IntoRequest< + super::super::mpp::EstablishMppConnectionRequest, + >, + ) -> std::result::Result< + tonic::Response>, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/EstablishMPPConnection", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "EstablishMPPConnection")); + self.inner.server_streaming(req, path, codec).await + } + pub async fn is_alive( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/IsAlive"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "IsAlive")); + self.inner.unary(req, path, codec).await + } + /// / CheckLeader sends all information (includes region term and epoch) to other stores. + /// / Once a store receives a request, it checks term and epoch for each region, and sends the regions whose + /// / term and epoch match with local information in the store. + /// / After the client collected all responses from all stores, it checks if got a quorum of responses from + /// / other stores for every region, and decides to advance resolved ts from these regions. + pub async fn check_leader( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/tikvpb.Tikv/CheckLeader"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("tikvpb.Tikv", "CheckLeader")); + self.inner.unary(req, path, codec).await + } + /// / Get the minimal `safe_ts` from regions at the store + pub async fn get_store_safe_ts( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/GetStoreSafeTS", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "GetStoreSafeTS")); + self.inner.unary(req, path, codec).await + } + /// / Get the information about lock waiting from TiKV. + pub async fn get_lock_wait_info( + &mut self, + request: impl tonic::IntoRequest< + super::super::kvrpcpb::GetLockWaitInfoRequest, + >, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/tikvpb.Tikv/GetLockWaitInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("tikvpb.Tikv", "GetLockWaitInfo")); + self.inner.unary(req, path, codec).await + } + } +} diff --git a/src/lib.rs b/src/lib.rs index e273bad7..60dc2956 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,8 +90,6 @@ //! # })} //! ``` -// To support both prost & rust-protobuf. -#![cfg_attr(feature = "prost-codec", allow(clippy::useless_conversion))] #![allow(clippy::field_reassign_with_default)] pub mod backoff; diff --git a/src/proto.rs b/src/proto.rs index 29c9e661..30f699f9 100644 --- a/src/proto.rs +++ b/src/proto.rs @@ -6,5 +6,5 @@ pub use protos::*; mod protos { - include!(concat!(env!("OUT_DIR"), "/mod.rs")); + include!("generated/mod.rs"); }