Skip to content

Commit

Permalink
Merge branch 'master' into fix-secalert
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby authored Feb 19, 2024
2 parents 3762376 + ae35535 commit 1624284
Show file tree
Hide file tree
Showing 76 changed files with 4,408 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-crate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish rust crate to crates.io
env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.73.0
RUST_VERSION: 1.74.0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust_version: [ "1.56.0", "1.73.0" ]
rust_version: [ "1.56.0", "1.74.0" ]

services:
ydb:
Expand Down
2 changes: 1 addition & 1 deletion ydb-example-urlshortener/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ tokio={version="1.18", features=["macros", "rt-multi-thread", "net"]}
tracing = "0.1"
tracing-subscriber = "0.3"
warp="0.3.6"
ydb = { version = "0.6.2", path="../ydb"}
ydb = { version = "0.7.0", path="../ydb"}
2 changes: 1 addition & 1 deletion ydb-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
publish = true
name = "ydb-grpc"
version = "0.0.13"
version = "0.0.14"
authors = ["rekby <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
6 changes: 4 additions & 2 deletions ydb-grpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use walkdir::WalkDir;
const DST_FOLDER: &str = "src/generated";

const COMPILE_FILES: &[&str] = &[
"ydb_scheme_v1.proto",
"ydb_auth_v1.proto",
"ydb_coordination_v1.proto",
"ydb_discovery_v1.proto",
"ydb_scheme_v1.proto",
"ydb_table_v1.proto",
"ydb_topic_v1.proto"
"ydb_topic_v1.proto",
];

const INCLUDE_DIRS: &[&str] = &["ydb-api-protos"];
Expand Down
Binary file modified ydb-grpc/src/descriptors.bin
Binary file not shown.
518 changes: 502 additions & 16 deletions ydb-grpc/src/generated/google.protobuf.rs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions ydb-grpc/src/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ pub mod google {
}
}
pub mod ydb {
pub mod auth {
pub mod v1 {
include!("ydb.auth.v1.rs");
}
include!("ydb.auth.rs");
}
pub mod coordination {
pub mod v1 {
include!("ydb.coordination.v1.rs");
}
include!("ydb.coordination.rs");
}
pub mod discovery {
pub mod v1 {
include!("ydb.discovery.v1.rs");
Expand Down
23 changes: 23 additions & 0 deletions ydb-grpc/src/generated/ydb.auth.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#[derive(serde::Serialize, serde::Deserialize)]
#[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,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[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>,
}
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoginResult {
#[prost(string, tag = "1")]
pub token: ::prost::alloc::string::String,
}
90 changes: 90 additions & 0 deletions ydb-grpc/src/generated/ydb.auth.v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/// 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: std::convert::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
}
/// Perform login using built-in auth system
pub async fn login(
&mut self,
request: impl tonic::IntoRequest<super::super::LoginRequest>,
) -> 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",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}
Loading

0 comments on commit 1624284

Please sign in to comment.