Коммит eb3c4db6 создал по автору Баринов Сергей Владимирович's avatar Баринов Сергей Владимирович
Просмотр файлов

autogenerated

владелец 037318ae
[submodule "ydb-api-protos"]
path = ydb-api-protos
url = https://github.com/ydb-platform/ydb-api-protos.git
......@@ -92,12 +92,6 @@ dependencies = [
"tower-service",
]
[[package]]
name = "base64"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
[[package]]
name = "base64"
version = "0.21.0"
......@@ -134,16 +128,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "core-foundation"
version = "0.9.3"
......@@ -289,9 +273,9 @@ dependencies = [
[[package]]
name = "h2"
version = "0.3.17"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f"
checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21"
dependencies = [
"bytes",
"fnv",
......@@ -530,25 +514,6 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
[[package]]
name = "num-integer"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
dependencies = [
"autocfg",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
version = "1.15.0"
......@@ -594,43 +559,6 @@ dependencies = [
"windows-sys 0.45.0",
]
[[package]]
name = "pbjson"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "048f9ac93c1eab514f9470c4bc8d97ca2a0a236b84f45cc19d69a59fc11467f6"
dependencies = [
"base64 0.13.1",
"serde",
]
[[package]]
name = "pbjson-build"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdbb7b706f2afc610f3853550cdbbf6372fd324824a087806bd4480ea4996e24"
dependencies = [
"heck",
"itertools",
"prost",
"prost-types",
]
[[package]]
name = "pbjson-types"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a88c8d87f99a4ac14325e7a4c24af190fca261956e3b82dd7ed67e77e6c7043"
dependencies = [
"bytes",
"chrono",
"pbjson",
"pbjson-build",
"prost",
"prost-build",
"serde",
]
[[package]]
name = "percent-encoding"
version = "2.2.0"
......@@ -867,14 +795,14 @@ dependencies = [
[[package]]
name = "rustls"
version = "0.20.8"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f"
checksum = "07180898a28ed6a7f7ba2311594308f595e3dd2e3c3812fa0a80a47b45f17e5d"
dependencies = [
"log",
"ring",
"rustls-webpki",
"sct",
"webpki",
]
[[package]]
......@@ -895,7 +823,17 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
dependencies = [
"base64 0.21.0",
"base64",
]
[[package]]
name = "rustls-webpki"
version = "0.100.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b"
dependencies = [
"ring",
"untrusted",
]
[[package]]
......@@ -966,20 +904,6 @@ name = "serde"
version = "1.0.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.15",
]
[[package]]
name = "signal-hook-registry"
......@@ -1104,13 +1028,12 @@ dependencies = [
[[package]]
name = "tokio-rustls"
version = "0.23.4"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59"
checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5"
dependencies = [
"rustls",
"tokio",
"webpki",
]
[[package]]
......@@ -1140,14 +1063,14 @@ dependencies = [
[[package]]
name = "tonic"
version = "0.8.3"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb"
checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a"
dependencies = [
"async-stream",
"async-trait",
"axum",
"base64 0.13.1",
"base64",
"bytes",
"futures-core",
"futures-util",
......@@ -1159,26 +1082,22 @@ dependencies = [
"percent-encoding",
"pin-project",
"prost",
"prost-derive",
"rustls-native-certs",
"rustls-pemfile",
"tokio",
"tokio-rustls",
"tokio-stream",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
"tracing",
"tracing-futures",
"webpki-roots",
]
[[package]]
name = "tonic-build"
version = "0.8.4"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4"
checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07"
dependencies = [
"prettyplease",
"proc-macro2",
......@@ -1252,16 +1171,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "tracing-futures"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
dependencies = [
"pin-project",
"tracing",
]
[[package]]
name = "try-lock"
version = "0.2.4"
......@@ -1370,25 +1279,6 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "webpki"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd"
dependencies = [
"ring",
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
dependencies = [
"webpki",
]
[[package]]
name = "which"
version = "4.4.0"
......@@ -1578,34 +1468,18 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "ydb-grpc"
version = "0.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ca1f496e29aee11fb48569965dfec718afba08ac191d3a203e7c16c54d68c7a"
dependencies = [
"pbjson",
"pbjson-build",
"pbjson-types",
"prost",
"prost-build",
"prost-types",
"serde",
"tonic",
"tonic-build",
"walkdir",
]
[[package]]
name = "ydb-unofficial"
version = "0.1.0"
dependencies = [
"async-trait",
"base64",
"ctor",
"deadpool",
"prost",
"tokio",
"tonic",
"tonic-build",
"tower",
"ydb-grpc",
"walkdir",
]
......@@ -6,11 +6,16 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ydb-grpc = "0.0.13"
tonic = "0.8"
#ydb-grpc = "0.0.13"
tonic = { versoin = "0.9", features = ["tls-roots"] }
tokio = { version = "1.27.0", features = ["full"] }
prost = "0.11.2"
ctor = "0.2.0"
deadpool = "0.9.5"
async-trait = "0.1.68"
tower = { version = "0.4.13", features = ["balance"] }
base64 = { version = "0.21.0", features = ["alloc"] }
[build-dependencies]
tonic-build = "0.9"
walkdir = "*"
use std::error::Error;
use std::path::PathBuf;
use walkdir::{WalkDir, DirEntry};
const DST_FOLDER: &str = "src/generated";
const COMPILE_FILES: &[&str] = &[
"ydb_scheme_v1.proto",
"ydb_discovery_v1.proto",
"ydb_table_v1.proto",
"ydb_topic_v1.proto",
"ydb_auth_v1.proto"
];
const INCLUDE_DIRS: &[&str] = &["ydb-api-protos"];
fn main() -> Result<(), Box<dyn Error>> {
if std::env::var("CARGO_FEATURE_REGENERATE_SOURCES").unwrap_or_else(|_| "0".into()) != "1" {
println!("skip regenerate sources");
return Ok(());
};
println!("cargo:rerun-if-changed=ydb-api-protos");
//clean_dst_dir(DST_FOLDER)?;
let descriptor_file = PathBuf::from(DST_FOLDER).join("../descriptors.bin");
tonic_build::compile_protos("ydb-api-protos/ydb_auth_v1.proto")?;
/*
let mut cfg = prost_build::Config::default();
cfg.compile_well_known_types()
.type_attribute(".Ydb", "#[derive(serde::Serialize, serde::Deserialize)]")
// .extern_path(".google.protobuf", "::pbjson_types")
.file_descriptor_set_path(&descriptor_file);
tonic_build::configure()
.build_server(false)
.out_dir(DST_FOLDER)
.compile_well_known_types(true)
.compile_with_config(config, protos, includes);*/
tonic_build::configure()
.build_server(false)
.build_client(true)
.out_dir(DST_FOLDER)
//.include_file("mod.rs")
.compile_well_known_types(true)
.extern_path(".ydb.auth.v1", "ydb::auth::v1")
/*
// the serialize attributes is workaround
// in future need to find/write good serialization for the types
.type_attribute(
"google.protobuf.Timestamp",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"google.protobuf.Empty",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"google.protobuf.Duration",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"google.protobuf.Any",
"#[derive(serde::Serialize, serde::Deserialize)]",
)*/
.compile(COMPILE_FILES, INCLUDE_DIRS)?;
make_modules()?;
Ok(())
}
fn make_modules() -> Result<(), Box<dyn Error>> {
for entry in WalkDir::new(DST_FOLDER) {
let entry = entry?;
let metadata = entry.metadata()?;
if metadata.is_file() {
let name = entry.file_name().to_string_lossy();
if name.ends_with(".rs") && name != "mod.rs" {
let module_name: String = name.chars().take(name.len()-3).collect();
let module_path = DST_FOLDER.to_owned() + "/" + module_name.split('.').collect::<Vec<_>>().join("/").as_str() + "/mod.rs";
safety_move(entry, &module_path)?;
attach_mod(&module_path)?;
}
}
}
Ok(())
}
fn safety_move(entry: DirEntry, module_file: &str) -> Result<(), Box<dyn Error>> {
use std::fs::{create_dir_all, rename};
let path = PathBuf::from(module_file);
if let Some(dir) = path.parent() {
create_dir_all(dir)?;
}
rename(entry.path(), path)?;
Ok(())
}
fn attach_mod(module_file: &str) -> Result<(), Box<dyn Error>> {
let path = PathBuf::from(module_file);
let module_folder = path.parent().unwrap();
let module_name = module_folder.file_name().unwrap().to_string_lossy();
let mut parent = module_folder.parent().unwrap().to_path_buf();
parent.push("mod.rs");
println!("update file: {}", parent.to_string_lossy());
let mut file = std::fs::OpenOptions::new()
.create(true)
.append(true)
.open(parent)
.unwrap();
use std::io::prelude::*;
writeln!(file, "\npub mod {module_name};")?;
Ok(())
}
\ Нет новой строки в конце файла
......@@ -5,7 +5,10 @@ use prost::Message;
use tonic::codegen::InterceptedService;
use tonic::service::Interceptor;
use tonic::transport::{Endpoint, Channel, Uri};
use ydb_grpc::ydb_proto::discovery::{v1::discovery_service_client::DiscoveryServiceClient, WhoAmIRequest, WhoAmIResponse, ListEndpointsRequest, WhoAmIResult, ListEndpointsResult};
use crate::generated::ydb::discovery::v1::DiscoveryServiceClient;
use crate::generated::ydb::discovery::{ListEndpointsResult, ListEndpointsRequest};
//use ydb_grpc::ydb_proto::discovery::{v1::discovery_service_client::DiscoveryServiceClient, WhoAmIRequest, WhoAmIResponse, ListEndpointsRequest, WhoAmIResult, ListEndpointsResult};
pub type AsciiValue = tonic::metadata::MetadataValue<tonic::metadata::Ascii>;
......
use tonic::{transport::Channel, service::Interceptor};
use tower::ServiceBuilder;
use ydb_grpc::ydb_proto::discovery::{v1::discovery_service_client::DiscoveryServiceClient, WhoAmIResponse, WhoAmIResult, ListEndpointsResponse, ListEndpointsResult};
use crate::generated::ydb::{discovery::{WhoAmIResponse, WhoAmIResult, ListEndpointsResponse, ListEndpointsResult}, table::{CreateSessionResponse, CreateSessionResult}};
//use ydb_grpc::ydb_proto::{discovery::{v1::discovery_service_client::DiscoveryServiceClient, WhoAmIResponse, WhoAmIResult, ListEndpointsResponse, ListEndpointsResult}, table::{CreateSessionResponse, CreateSessionResult}};
......@@ -48,4 +50,5 @@ macro_rules! payloaded {
payloaded!(WhoAmIResponse , WhoAmIResult);
payloaded!(ListEndpointsResponse , ListEndpointsResult);
\ Нет новой строки в конце файла
payloaded!(ListEndpointsResponse , ListEndpointsResult);
payloaded!(CreateSessionResponse, CreateSessionResult);
\ Нет новой строки в конце файла
Это отличие свёрнуто
pub mod ydb;
pub mod google;
pub use ydb::discovery::v1::DiscoveryServiceClient;
\ Нет новой строки в конце файла
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub user: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub password: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginResponse {
/// After successfull completion must contain LoginResult.
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginResult {
#[prost(string, tag = "1")]
pub token: ::prost::alloc::string::String,
}
pub mod v1;
/// Generated client implementations.
pub mod auth_service_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 AuthServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AuthServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AuthServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
inner: T,
interceptor: F,
) -> AuthServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
AuthServiceClient::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
}
/// Perform login using built-in auth system
pub async fn login(
&mut self,
request: impl tonic::IntoRequest<super::super::LoginRequest>,
) -> std::result::Result<
tonic::Response<super::super::LoginResponse>,
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(
"/Ydb.Auth.V1.AuthService/Login",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("Ydb.Auth.V1.AuthService", "Login"));
self.inner.unary(req, path, codec).await
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEndpointsRequest {
#[prost(string, tag = "1")]
pub database: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub service: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EndpointInfo {
/// This is an address (usually fqdn) and port of this node's grpc endpoint
#[prost(string, tag = "1")]
pub address: ::prost::alloc::string::String,
#[prost(uint32, tag = "2")]
pub port: u32,
#[prost(float, tag = "3")]
pub load_factor: f32,
#[prost(bool, tag = "4")]
pub ssl: bool,
#[prost(string, repeated, tag = "5")]
pub service: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "6")]
pub location: ::prost::alloc::string::String,
#[prost(uint32, tag = "7")]
pub node_id: u32,
/// Optional ipv4 and/or ipv6 addresses of the endpoint, which clients may
/// use instead of a dns name in the address field.
#[prost(string, repeated, tag = "8")]
pub ip_v4: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "9")]
pub ip_v6: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Optional value for grpc.ssl_target_name_override option that must be
/// used when connecting to this endpoint. This may be specified when an ssl
/// endpoint is using certificate chain valid for a balancer hostname, and
/// not this specific node hostname.
#[prost(string, tag = "10")]
pub ssl_target_name_override: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEndpointsResult {
#[prost(message, repeated, tag = "1")]
pub endpoints: ::prost::alloc::vec::Vec<EndpointInfo>,
#[prost(string, tag = "2")]
pub self_location: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListEndpointsResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WhoAmIRequest {
/// Include user groups in response
#[prost(bool, tag = "1")]
pub include_groups: bool,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WhoAmIResult {
/// User SID (Security ID)
#[prost(string, tag = "1")]
pub user: ::prost::alloc::string::String,
/// List of group SIDs (Security IDs) for the user
#[prost(string, repeated, tag = "2")]
pub groups: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WhoAmIResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
pub mod v1;
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct DiscoveryServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DiscoveryServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DiscoveryServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
inner: T,
interceptor: F,
) -> DiscoveryServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
DiscoveryServiceClient::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 list_endpoints(
&mut self,
request: impl tonic::IntoRequest<super::ListEndpointsRequest>,
) -> std::result::Result<
tonic::Response<super::ListEndpointsResponse>,
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(
"/Ydb.Discovery.V1.DiscoveryService/ListEndpoints",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("Ydb.Discovery.V1.DiscoveryService", "ListEndpoints"),
);
self.inner.unary(req, path, codec).await
}
pub async fn who_am_i(
&mut self,
request: impl tonic::IntoRequest<super::WhoAmIRequest>,
) -> std::result::Result<
tonic::Response<super::WhoAmIResponse>,
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(
"/Ydb.Discovery.V1.DiscoveryService/WhoAmI",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("Ydb.Discovery.V1.DiscoveryService", "WhoAmI"));
self.inner.unary(req, path, codec).await
}
}
pub struct MyStruct<T>(T);
impl<T> MyStruct<T> where T: tonic::client::GrpcService<tonic::body::BoxBody>,
//T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(obj: T) -> Self {
MyStruct(obj)
}
pub fn some_text(&self) -> String {
"bugoga".to_owned()
}
}
\ Нет новой строки в конце файла
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArrowBatchSettings {
#[prost(bytes = "vec", tag = "1")]
pub schema: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CsvSettings {
/// Number of rows to skip before CSV data. It should be present only in the first upsert of CSV file.
#[prost(uint32, tag = "1")]
pub skip_rows: u32,
/// Fields delimiter in CSV file. It's "," if not set.
#[prost(bytes = "vec", tag = "2")]
pub delimiter: ::prost::alloc::vec::Vec<u8>,
/// String value that would be interpreted as NULL.
#[prost(bytes = "vec", tag = "3")]
pub null_value: ::prost::alloc::vec::Vec<u8>,
/// First not skipped line is a CSV header (list of column names).
#[prost(bool, tag = "4")]
pub header: bool,
}
/// IssueMessage is a transport format for ydb/library/yql/public/issue library
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct IssueMessage {
#[prost(message, optional, tag = "1")]
pub position: ::core::option::Option<issue_message::Position>,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub end_position: ::core::option::Option<issue_message::Position>,
#[prost(uint32, tag = "4")]
pub issue_code: u32,
/// Severity values from ydb/library/yql/public/issue/protos/issue_severity.proto
/// FATAL = 0;
/// ERROR = 1;
/// WARNING = 2;
/// INFO = 3;
#[prost(uint32, tag = "5")]
pub severity: u32,
#[prost(message, repeated, tag = "6")]
pub issues: ::prost::alloc::vec::Vec<IssueMessage>,
}
/// Nested message and enum types in `IssueMessage`.
pub mod issue_message {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Position {
#[prost(uint32, tag = "1")]
pub row: u32,
#[prost(uint32, tag = "2")]
pub column: u32,
#[prost(string, tag = "3")]
pub file: ::prost::alloc::string::String,
}
}
Это отличие свёрнуто
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OperationParams {
#[prost(enumeration = "operation_params::OperationMode", tag = "1")]
pub operation_mode: i32,
/// Indicates that client is no longer interested in the result of operation after the specified duration
/// starting from the time operation arrives at the server.
/// Server will try to stop the execution of operation and if no result is currently available the operation
/// will receive TIMEOUT status code, which will be sent back to client if it was waiting for the operation result.
/// Timeout of operation does not tell anything about its result, it might be completed successfully
/// or cancelled on server.
#[prost(message, optional, tag = "2")]
pub operation_timeout: ::core::option::Option<
super::super::google::protobuf::Duration,
>,
/// Server will try to cancel the operation after the specified duration starting from the time
/// the operation arrives at server.
/// In case of successful cancellation operation will receive CANCELLED status code, which will be
/// sent back to client if it was waiting for the operation result.
/// In case when cancellation isn't possible, no action will be performed.
#[prost(message, optional, tag = "3")]
pub cancel_after: ::core::option::Option<super::super::google::protobuf::Duration>,
/// User-defined labels of operation.
#[prost(map = "string, string", tag = "4")]
pub labels: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// If enabled, server will report cost information, if supported by the operation.
/// This flag is mostly useful for SYNC operations, to get the cost information in the response.
#[prost(enumeration = "super::feature_flag::Status", tag = "5")]
pub report_cost_info: i32,
}
/// Nested message and enum types in `OperationParams`.
pub mod operation_params {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum OperationMode {
Unspecified = 0,
/// Server will only reply once operation is finished (ready=true), and operation object won't be
/// accessible after the reply. This is a basic request-response mode.
Sync = 1,
Async = 2,
}
impl OperationMode {
/// 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 {
OperationMode::Unspecified => "OPERATION_MODE_UNSPECIFIED",
OperationMode::Sync => "SYNC",
OperationMode::Async => "ASYNC",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"OPERATION_MODE_UNSPECIFIED" => Some(Self::Unspecified),
"SYNC" => Some(Self::Sync),
"ASYNC" => Some(Self::Async),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOperationRequest {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetOperationResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<Operation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOperationRequest {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CancelOperationResponse {
#[prost(enumeration = "super::status_ids::StatusCode", tag = "1")]
pub status: i32,
#[prost(message, repeated, tag = "2")]
pub issues: ::prost::alloc::vec::Vec<super::issue::IssueMessage>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ForgetOperationRequest {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ForgetOperationResponse {
#[prost(enumeration = "super::status_ids::StatusCode", tag = "1")]
pub status: i32,
#[prost(message, repeated, tag = "2")]
pub issues: ::prost::alloc::vec::Vec<super::issue::IssueMessage>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOperationsRequest {
#[prost(string, tag = "1")]
pub kind: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub page_size: u64,
#[prost(string, tag = "3")]
pub page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListOperationsResponse {
#[prost(enumeration = "super::status_ids::StatusCode", tag = "1")]
pub status: i32,
#[prost(message, repeated, tag = "2")]
pub issues: ::prost::alloc::vec::Vec<super::issue::IssueMessage>,
#[prost(message, repeated, tag = "3")]
pub operations: ::prost::alloc::vec::Vec<Operation>,
#[prost(string, tag = "4")]
pub next_page_token: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Operation {
/// Identifier of the operation, empty value means no active operation object is present (it was forgotten or
/// not created in the first place, as in SYNC operation mode).
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
/// true - this operation has beed finished (doesn't matter successful or not),
/// so Status field has status code, and Result field can contains result data.
/// false - this operation still running. You can repeat request using operation Id.
#[prost(bool, tag = "2")]
pub ready: bool,
#[prost(enumeration = "super::status_ids::StatusCode", tag = "3")]
pub status: i32,
#[prost(message, repeated, tag = "4")]
pub issues: ::prost::alloc::vec::Vec<super::issue::IssueMessage>,
/// Result data
#[prost(message, optional, tag = "5")]
pub result: ::core::option::Option<super::super::google::protobuf::Any>,
#[prost(message, optional, tag = "6")]
pub metadata: ::core::option::Option<super::super::google::protobuf::Any>,
/// Contains information about the cost of the operation.
/// For completed operations, it shows the final cost of the operation.
/// For operations in progress, it might indicate the current cost of the operation (if supported).
#[prost(message, optional, tag = "7")]
pub cost_info: ::core::option::Option<super::CostInfo>,
}
/// Create directory.
/// All intermediate directories must be created
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MakeDirectoryRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub path: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MakeDirectoryResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
/// Remove directory
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveDirectoryRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub path: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveDirectoryResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
/// List directory
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDirectoryRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub path: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDirectoryResponse {
/// Holds ListDirectoryResult in case of successful call
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Permissions {
/// SID (Security ID) of user or group
#[prost(string, tag = "1")]
pub subject: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub permission_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entry {
/// Name of scheme entry (dir2 of /dir1/dir2)
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// SID (Security ID) of user or group
#[prost(string, tag = "2")]
pub owner: ::prost::alloc::string::String,
#[prost(enumeration = "entry::Type", tag = "5")]
pub r#type: i32,
#[prost(message, repeated, tag = "6")]
pub effective_permissions: ::prost::alloc::vec::Vec<Permissions>,
#[prost(message, repeated, tag = "7")]
pub permissions: ::prost::alloc::vec::Vec<Permissions>,
/// Size of entry in bytes. Currently filled for:
/// - TABLE;
/// - DATABASE.
/// Empty (zero) in other cases.
#[prost(uint64, tag = "8")]
pub size_bytes: u64,
/// Virtual timestamp when the object was created
#[prost(message, optional, tag = "9")]
pub created_at: ::core::option::Option<super::VirtualTimestamp>,
}
/// Nested message and enum types in `Entry`.
pub mod entry {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
Unspecified = 0,
Directory = 1,
Table = 2,
PersQueueGroup = 3,
Database = 4,
RtmrVolume = 5,
BlockStoreVolume = 6,
CoordinationNode = 7,
ColumnStore = 12,
ColumnTable = 13,
Sequence = 15,
Replication = 16,
Topic = 17,
}
impl Type {
/// 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 {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::Directory => "DIRECTORY",
Type::Table => "TABLE",
Type::PersQueueGroup => "PERS_QUEUE_GROUP",
Type::Database => "DATABASE",
Type::RtmrVolume => "RTMR_VOLUME",
Type::BlockStoreVolume => "BLOCK_STORE_VOLUME",
Type::CoordinationNode => "COORDINATION_NODE",
Type::ColumnStore => "COLUMN_STORE",
Type::ColumnTable => "COLUMN_TABLE",
Type::Sequence => "SEQUENCE",
Type::Replication => "REPLICATION",
Type::Topic => "TOPIC",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"DIRECTORY" => Some(Self::Directory),
"TABLE" => Some(Self::Table),
"PERS_QUEUE_GROUP" => Some(Self::PersQueueGroup),
"DATABASE" => Some(Self::Database),
"RTMR_VOLUME" => Some(Self::RtmrVolume),
"BLOCK_STORE_VOLUME" => Some(Self::BlockStoreVolume),
"COORDINATION_NODE" => Some(Self::CoordinationNode),
"COLUMN_STORE" => Some(Self::ColumnStore),
"COLUMN_TABLE" => Some(Self::ColumnTable),
"SEQUENCE" => Some(Self::Sequence),
"REPLICATION" => Some(Self::Replication),
"TOPIC" => Some(Self::Topic),
_ => None,
}
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDirectoryResult {
#[prost(message, optional, tag = "1")]
pub self_: ::core::option::Option<Entry>,
#[prost(message, repeated, tag = "2")]
pub children: ::prost::alloc::vec::Vec<Entry>,
}
/// Returns information about object with given path
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribePathRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub path: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribePathResponse {
/// Holds DescribePathResult in case of DescribePathResult
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribePathResult {
#[prost(message, optional, tag = "1")]
pub self_: ::core::option::Option<Entry>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PermissionsAction {
#[prost(oneof = "permissions_action::Action", tags = "1, 2, 3, 4")]
pub action: ::core::option::Option<permissions_action::Action>,
}
/// Nested message and enum types in `PermissionsAction`.
pub mod permissions_action {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Action {
/// Grant permissions
#[prost(message, tag = "1")]
Grant(super::Permissions),
/// Revoke permissions
#[prost(message, tag = "2")]
Revoke(super::Permissions),
/// Rewrite permissions for given subject (last set win in case of multiple set for one subject)
#[prost(message, tag = "3")]
Set(super::Permissions),
/// New owner for object
#[prost(string, tag = "4")]
ChangeOwner(::prost::alloc::string::String),
}
}
/// Modify permissions of given object
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyPermissionsRequest {
#[prost(message, optional, tag = "1")]
pub operation_params: ::core::option::Option<super::operations::OperationParams>,
#[prost(string, tag = "2")]
pub path: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub actions: ::prost::alloc::vec::Vec<PermissionsAction>,
/// Clear all permissions on the object for all subjects
#[prost(bool, tag = "4")]
pub clear_permissions: bool,
#[prost(oneof = "modify_permissions_request::Inheritance", tags = "5")]
pub inheritance: ::core::option::Option<modify_permissions_request::Inheritance>,
}
/// Nested message and enum types in `ModifyPermissionsRequest`.
pub mod modify_permissions_request {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Inheritance {
#[prost(bool, tag = "5")]
InterruptInheritance(bool),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModifyPermissionsResponse {
#[prost(message, optional, tag = "1")]
pub operation: ::core::option::Option<super::operations::Operation>,
}
pub mod v1;
/// Generated client implementations.
pub mod scheme_service_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 SchemeServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SchemeServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SchemeServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
inner: T,
interceptor: F,
) -> SchemeServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
SchemeServiceClient::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
}
/// Make Directory.
pub async fn make_directory(
&mut self,
request: impl tonic::IntoRequest<super::super::MakeDirectoryRequest>,
) -> std::result::Result<
tonic::Response<super::super::MakeDirectoryResponse>,
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(
"/Ydb.Scheme.V1.SchemeService/MakeDirectory",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("Ydb.Scheme.V1.SchemeService", "MakeDirectory"));
self.inner.unary(req, path, codec).await
}
/// Remove Directory.
pub async fn remove_directory(
&mut self,
request: impl tonic::IntoRequest<super::super::RemoveDirectoryRequest>,
) -> std::result::Result<
tonic::Response<super::super::RemoveDirectoryResponse>,
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(
"/Ydb.Scheme.V1.SchemeService/RemoveDirectory",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("Ydb.Scheme.V1.SchemeService", "RemoveDirectory"),
);
self.inner.unary(req, path, codec).await
}
/// Returns information about given directory and objects inside it.
pub async fn list_directory(
&mut self,
request: impl tonic::IntoRequest<super::super::ListDirectoryRequest>,
) -> std::result::Result<
tonic::Response<super::super::ListDirectoryResponse>,
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(
"/Ydb.Scheme.V1.SchemeService/ListDirectory",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("Ydb.Scheme.V1.SchemeService", "ListDirectory"));
self.inner.unary(req, path, codec).await
}
/// Returns information about object with given path.
pub async fn describe_path(
&mut self,
request: impl tonic::IntoRequest<super::super::DescribePathRequest>,
) -> std::result::Result<
tonic::Response<super::super::DescribePathResponse>,
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(
"/Ydb.Scheme.V1.SchemeService/DescribePath",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("Ydb.Scheme.V1.SchemeService", "DescribePath"));
self.inner.unary(req, path, codec).await
}
/// Modify permissions.
pub async fn modify_permissions(
&mut self,
request: impl tonic::IntoRequest<super::super::ModifyPermissionsRequest>,
) -> std::result::Result<
tonic::Response<super::super::ModifyPermissionsResponse>,
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(
"/Ydb.Scheme.V1.SchemeService/ModifyPermissions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("Ydb.Scheme.V1.SchemeService", "ModifyPermissions"),
);
self.inner.unary(req, path, codec).await
}
}
}
Это отличие свёрнуто
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать