Skip to content

Commit 66fffdd

Browse files
committed
update grpc-proto to 22.2 with null type, empty list, etc.
1 parent 0331887 commit 66fffdd

32 files changed

+2345
-72
lines changed

ydb-grpc/build.rs

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use ydb_grpc_helpers::ProtoModule;
21
use std::cmp::Ordering;
32
use std::collections::HashMap;
4-
use std::fs;
5-
use std::io::{Read, Write};
3+
use std::fs::OpenOptions;
4+
use std::io::{Read, Seek, SeekFrom, Write};
5+
use std::{fs, io};
6+
use walkdir::WalkDir;
7+
use ydb_grpc_helpers::ProtoModule;
68

79
const COMPILE_DIRS: &[(&str, &str)] = &[
810
// src, dst
@@ -20,12 +22,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
2022

2123
if std::env::var("CARGO_FEATURE_REGENERATE_SOURCES").unwrap_or("0".into()) != "1" {
2224
println!("skip regenerate sources");
23-
return Ok(())
25+
return Ok(());
2426
}
2527

2628
for (src, dst) in COMPILE_DIRS {
2729
clean_dst_dir(dst)?;
2830
compile_proto_dir(src, INCLUDE_DIRS, dst)?;
31+
rewrite_generated_files(dst)?;
2932
generate_mod_file(dst)?;
3033
}
3134

@@ -59,6 +62,46 @@ fn compile_files(files: &[&str], include_dirs: &[&str], dst_dir: &str) {
5962
.expect("failed to compile protobuf");
6063
}
6164

65+
fn rewrite_generated_file(fpath: &std::path::Path) -> io::Result<()> {
66+
println!("rewrite file: '{}'", fpath.to_str().unwrap_or("<empty>"));
67+
let mut f = OpenOptions::new().read(true).write(true).open(fpath)?;
68+
let mut contents = String::new();
69+
let _ = f.read_to_string(&mut contents).unwrap();
70+
71+
let lines: Vec<&str> = contents
72+
.split_terminator("\n")
73+
.filter(|line| line.trim() != "///")
74+
.collect();
75+
76+
println!("1");
77+
let contents = lines.join("\n");
78+
f.seek(SeekFrom::Start(0))?;
79+
f.set_len(0)?;
80+
println!("2");
81+
f.write_all(contents.as_bytes())?;
82+
println!("3");
83+
return Ok(());
84+
}
85+
86+
fn rewrite_generated_files(dir: &str) -> io::Result<()> {
87+
for item in WalkDir::new(dir) {
88+
let item = item?;
89+
let item_path = item.path().to_str().unwrap_or("<empty>");
90+
if !item.path().ends_with(".rs") {
91+
println!("skip rewrite file: '{}'", item_path)
92+
}
93+
if !item.metadata()?.is_file() {
94+
println!("skip not file: '{}'", item_path);
95+
continue;
96+
}
97+
println!("rewrite file '{}'", item_path);
98+
99+
rewrite_generated_file(item.path())?;
100+
}
101+
102+
return Ok(());
103+
}
104+
62105
fn compile_proto_dir(
63106
src_dir: &str,
64107
include_dirs: &[&str],
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

ydb-grpc/src/generated/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ pub mod ydb {
2929
include!("ydb.export.v1.rs");
3030
}
3131
}
32+
pub mod formats {
33+
include!("ydb.formats.rs");
34+
}
3235
pub mod import {
3336
include!("ydb.import.rs");
3437
pub mod v1 {
@@ -52,6 +55,14 @@ pub mod ydb {
5255
pub mod operations {
5356
include!("ydb.operations.rs");
5457
}
58+
pub mod pers_queue {
59+
pub mod cluster_discovery {
60+
include!("ydb.pers_queue.cluster_discovery.rs");
61+
}
62+
pub mod v1 {
63+
include!("ydb.pers_queue.v1.rs");
64+
}
65+
}
5566
pub mod rate_limiter {
5667
include!("ydb.rate_limiter.rs");
5768
pub mod v1 {

ydb-grpc/src/generated/ydb.cms.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,6 @@ pub struct DatabaseOptions {
6868
#[prost(uint32, tag = "3")]
6969
pub plan_resolution: u32,
7070
}
71-
#[derive(Clone, PartialEq, ::prost::Message)]
72-
pub struct Attribute {
73-
#[prost(string, tag = "1")]
74-
pub name: ::prost::alloc::string::String,
75-
#[prost(string, tag = "2")]
76-
pub value: ::prost::alloc::string::String,
77-
}
7871
/// A set of quotas for schema operations
7972
#[derive(Clone, PartialEq, ::prost::Message)]
8073
pub struct SchemaOperationQuotas {
@@ -110,6 +103,13 @@ pub struct DatabaseQuotas {
110103
/// A maximum count of shards in all data streams.
111104
#[prost(uint64, tag = "3")]
112105
pub data_stream_shards_quota: u64,
106+
/// A maximum storage that will be reserved for all data stream shards.
107+
#[prost(uint64, tag = "5")]
108+
pub data_stream_reserved_storage_quota: u64,
109+
/// A minimum value of `TtlSettings.run_interval_seconds` that can be specified.
110+
/// Default is 1800 (15 minutes).
111+
#[prost(uint32, tag = "4")]
112+
pub ttl_min_run_internal_seconds: u32,
113113
}
114114
/// Request to create a new database. For successfull creation
115115
/// specified database shouldn't exist. At least one storage
@@ -125,8 +125,9 @@ pub struct CreateDatabaseRequest {
125125
#[prost(message, optional, tag = "4")]
126126
pub options: ::core::option::Option<DatabaseOptions>,
127127
/// Attach attributes to database.
128-
#[prost(message, repeated, tag = "5")]
129-
pub attributes: ::prost::alloc::vec::Vec<Attribute>,
128+
#[prost(map = "string, string", tag = "5")]
129+
pub attributes:
130+
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
130131
/// Optional quotas for schema operations
131132
#[prost(message, optional, tag = "8")]
132133
pub schema_operation_quotas: ::core::option::Option<SchemaOperationQuotas>,
@@ -261,6 +262,10 @@ pub struct AlterDatabaseRequest {
261262
/// Change quotas for the database
262263
#[prost(message, optional, tag = "11")]
263264
pub database_quotas: ::core::option::Option<DatabaseQuotas>,
265+
/// Alter attributes. Leave the value blank to drop an attribute.
266+
#[prost(map = "string, string", tag = "12")]
267+
pub alter_attributes:
268+
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
264269
}
265270
#[derive(Clone, PartialEq, ::prost::Message)]
266271
pub struct AlterDatabaseResponse {
@@ -345,4 +350,4 @@ pub struct DescribeDatabaseOptionsResult {
345350
pub availability_zones: ::prost::alloc::vec::Vec<AvailabilityZoneDescription>,
346351
#[prost(message, repeated, tag = "3")]
347352
pub computational_units: ::prost::alloc::vec::Vec<ComputationalUnitDescription>,
348-
}
353+
}

ydb-grpc/src/generated/ydb.cms.v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,4 @@ pub mod cms_service_client {
156156
self.inner.unary(request.into_request(), path, codec).await
157157
}
158158
}
159-
}
159+
}

ydb-grpc/src/generated/ydb.coordination.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
///*
22
/// Stub for unsupported messages
3-
///
43
/// Intentionally empty
54
#[derive(Clone, PartialEq, ::prost::Message)]
65
pub struct Unsupported {}
@@ -14,7 +13,7 @@ pub struct Config {
1413
/// Period in milliseconds for self-checks (default 1 second)
1514
#[prost(uint32, tag = "2")]
1615
pub self_check_period_millis: u32,
17-
/// Grace period for sessions on master change (default 10 seconds)
16+
/// Grace period for sessions on leader change (default 10 seconds)
1817
#[prost(uint32, tag = "3")]
1918
pub session_grace_period_millis: u32,
2019
/// Concistency mode for read operations
@@ -137,15 +136,12 @@ pub mod session_request {
137136
}
138137
///*
139138
/// Last message used to cleanly stop session before its timeout expires
140-
///
141139
/// nothing
142140
#[derive(Clone, PartialEq, ::prost::Message)]
143141
pub struct SessionStop {}
144142
///*
145143
/// Used to acquire a semaphore
146-
///
147144
/// WARNING: a single session cannot acquire the same semaphore multiple times
148-
///
149145
/// Later requests override previous operations with the same semaphore,
150146
/// e.g. to reduce acquired count, change timeout or attached data.
151147
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -173,9 +169,7 @@ pub mod session_request {
173169
}
174170
///*
175171
/// Used to release a semaphore
176-
///
177172
/// WARNING: a single session cannot release the same semaphore multiple times
178-
///
179173
/// The release operation will either remove current session from waiters
180174
/// queue or release an already owned semaphore.
181175
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -189,7 +183,6 @@ pub mod session_request {
189183
}
190184
///*
191185
/// Used to describe semaphores and watch them for changes
192-
///
193186
/// WARNING: a describe operation will cancel previous watches on the same semaphore
194187
#[derive(Clone, PartialEq, ::prost::Message)]
195188
pub struct DescribeSemaphore {
@@ -539,7 +532,7 @@ pub struct DescribeNodeResult {
539532
pub enum ConsistencyMode {
540533
/// The default or current value
541534
Unset = 0,
542-
/// Strict mode makes sure operations may only complete on current master
535+
/// Strict mode makes sure operations may only complete on current leader
543536
Strict = 1,
544537
/// Relaxed mode allows operations to complete on stale masters
545538
Relaxed = 2,
@@ -555,4 +548,4 @@ pub enum RateLimiterCountersMode {
555548
Aggregated = 1,
556549
/// Counters on every resource
557550
Detailed = 2,
558-
}
551+
}

ydb-grpc/src/generated/ydb.coordination.v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,4 @@ pub mod coordination_service_client {
156156
self.inner.unary(request.into_request(), path, codec).await
157157
}
158158
}
159-
}
159+
}

ydb-grpc/src/generated/ydb.discovery.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub struct ListEndpointsRequest {
77
}
88
#[derive(Clone, PartialEq, ::prost::Message)]
99
pub struct EndpointInfo {
10+
/// This is an address (usually fqdn) and port of this node's grpc endpoint
1011
#[prost(string, tag = "1")]
1112
pub address: ::prost::alloc::string::String,
1213
#[prost(uint32, tag = "2")]
@@ -21,6 +22,18 @@ pub struct EndpointInfo {
2122
pub location: ::prost::alloc::string::String,
2223
#[prost(uint32, tag = "7")]
2324
pub node_id: u32,
25+
/// Optional ipv4 and/or ipv6 addresses of the endpoint, which clients may
26+
/// use instead of a dns name in the address field.
27+
#[prost(string, repeated, tag = "8")]
28+
pub ip_v4: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
29+
#[prost(string, repeated, tag = "9")]
30+
pub ip_v6: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
31+
/// Optional value for grpc.ssl_target_name_override option that must be
32+
/// used when connecting to this endpoint. This may be specified when an ssl
33+
/// endpoint is using certificate chain valid for a balancer hostname, and
34+
/// not this specific node hostname.
35+
#[prost(string, tag = "10")]
36+
pub ssl_target_name_override: ::prost::alloc::string::String,
2437
}
2538
#[derive(Clone, PartialEq, ::prost::Message)]
2639
pub struct ListEndpointsResult {
@@ -53,4 +66,4 @@ pub struct WhoAmIResult {
5366
pub struct WhoAmIResponse {
5467
#[prost(message, optional, tag = "1")]
5568
pub operation: ::core::option::Option<super::operations::Operation>,
56-
}
69+
}

ydb-grpc/src/generated/ydb.discovery.v1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ pub mod discovery_service_client {
9090
self.inner.unary(request.into_request(), path, codec).await
9191
}
9292
}
93-
}
93+
}

ydb-grpc/src/generated/ydb.export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ pub struct ExportToS3Response {
161161
/// operation.metadata = ExportToS3Metadata
162162
#[prost(message, optional, tag = "1")]
163163
pub operation: ::core::option::Option<super::operations::Operation>,
164-
}
164+
}

0 commit comments

Comments
 (0)