diff --git a/.github/workflows/publish-crate.yml b/.github/workflows/publish-crate.yml index 0309a38e..9c13c1e1 100644 --- a/.github/workflows/publish-crate.yml +++ b/.github/workflows/publish-crate.yml @@ -1,7 +1,7 @@ name: Publish rust crate to crates.io env: CARGO_TERM_COLOR: always - RUST_VERSION: 1.79.0 + RUST_VERSION: 1.81.0 CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse on: diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index 9db5c54e..a3b75e13 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -12,7 +12,7 @@ env: CARGO_TERM_COLOR: always CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse RUST_VERSION_OLD: "1.60.0" - RUST_VERSION_NEW: "1.79.0" + RUST_VERSION_NEW: "1.81.0" jobs: tests: @@ -65,6 +65,6 @@ jobs: run: cargo test --verbose --workspace -- --include-ignored - name: Linter - if: matrix.rust_version == 'NEW' + if: matrix.rust_version == 'RUST_VERSION_NEW' run: | - cargo clippy --workspace --all-targets -- -D warnings + cargo clippy --workspace --all-targets --no-deps --exclude=ydb-grpc -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 60f6665e..992b87bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2550,7 +2550,7 @@ dependencies = [ [[package]] name = "ydb" -version = "0.9.2" +version = "0.9.3" dependencies = [ "async-trait", "async_once", diff --git a/ydb-example-urlshortener/Cargo.toml b/ydb-example-urlshortener/Cargo.toml index 5916429a..aa726aad 100644 --- a/ydb-example-urlshortener/Cargo.toml +++ b/ydb-example-urlshortener/Cargo.toml @@ -16,4 +16,4 @@ tokio = { version = "1.18", features = ["macros", "rt-multi-thread", "net"] } tracing = "0.1" tracing-subscriber = "0.3" warp = "0.3.2" -ydb = { version = "0.9.2", path="../ydb"} +ydb = { version = "0.9.3", path="../ydb"} diff --git a/ydb-grpc/Cargo.toml b/ydb-grpc/Cargo.toml index 8a521908..37536371 100644 --- a/ydb-grpc/Cargo.toml +++ b/ydb-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] publish = true name = "ydb-grpc" -version = "0.0.14" +version = "0.1.0" authors = ["rekby "] edition = "2021" license = "Apache-2.0" diff --git a/ydb-grpc/src/descriptors.bin b/ydb-grpc/src/descriptors.bin index daad359e..1334e116 100644 Binary files a/ydb-grpc/src/descriptors.bin and b/ydb-grpc/src/descriptors.bin differ diff --git a/ydb-grpc/src/generated/google.protobuf.rs b/ydb-grpc/src/generated/google.protobuf.rs index f1bd03f6..82e92b65 100644 --- a/ydb-grpc/src/generated/google.protobuf.rs +++ b/ydb-grpc/src/generated/google.protobuf.rs @@ -211,9 +211,9 @@ pub struct FileDescriptorProto { /// If `edition` is present, this value must be "editions". #[prost(string, optional, tag = "12")] pub syntax: ::core::option::Option<::prost::alloc::string::String>, - /// The edition of the proto file, which is an opaque string. - #[prost(string, optional, tag = "13")] - pub edition: ::core::option::Option<::prost::alloc::string::String>, + /// The edition of the proto file. + #[prost(enumeration = "Edition", optional, tag = "14")] + pub edition: ::core::option::Option, } /// Describes a message type. #[derive(Clone, PartialEq, ::prost::Message)] @@ -281,7 +281,7 @@ pub struct ExtensionRangeOptions { #[prost(message, optional, tag = "50")] pub features: ::core::option::Option, /// The verification state of the range. - /// TODO(b/278783756): flip the default to DECLARATION once all empty ranges + /// TODO: flip the default to DECLARATION once all empty ranges /// are marked as UNVERIFIED. #[prost( enumeration = "extension_range_options::VerificationState", @@ -441,9 +441,10 @@ pub mod field_descriptor_proto { Bool = 8, String = 9, /// Tag-delimited aggregate. - /// Group type is deprecated and not supported in proto3. However, Proto3 + /// Group type is deprecated and not supported after google.protobuf. However, Proto3 /// implementations should still be able to parse the group wire format and - /// treat group fields as unknown fields. + /// treat group fields as unknown fields. In Editions, the group wire format + /// can be enabled via the `message_encoding` feature. Group = 10, /// Length-delimited aggregate. Message = 11, @@ -500,8 +501,11 @@ pub mod field_descriptor_proto { pub enum Label { /// 0 is reserved for errors Optional = 1, - Required = 2, Repeated = 3, + /// The required label is only allowed in google.protobuf. In proto3 and Editions + /// it's explicitly prohibited. In Editions, the `field_presence` feature + /// can be used to get this behavior. + Required = 2, } impl Label { /// String value of the enum field names used in the ProtoBuf definition. @@ -510,8 +514,8 @@ pub mod field_descriptor_proto { pub fn as_str_name(&self) -> &'static str { match self { Label::Optional => "LABEL_OPTIONAL", - Label::Required => "LABEL_REQUIRED", Label::Repeated => "LABEL_REPEATED", + Label::Required => "LABEL_REQUIRED", } } } @@ -811,7 +815,7 @@ pub struct MessageOptions { /// well. /// This should only be used as a temporary measure against broken builds due /// to the change in behavior for JSON field name conflicts. - /// TODO(b/261750190) This is legacy behavior we plan to remove once downstream + /// TODO This is legacy behavior we plan to remove once downstream /// teams have had time to migrate. #[deprecated] #[prost(bool, optional, tag = "11")] @@ -842,7 +846,9 @@ pub struct FieldOptions { /// a more efficient representation on the wire. Rather than repeatedly /// writing the tag and type for each element, the entire array is encoded as /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. + /// false will avoid using packed encoding. This option is prohibited in + /// Editions, but the `repeated_field_encoding` feature can be used to control + /// the behavior. #[prost(bool, optional, tag = "2")] pub packed: ::core::option::Option, /// The jstype option determines the JavaScript type used for values of the @@ -930,8 +936,8 @@ pub struct FieldOptions { pub mod field_options { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EditionDefault { - #[prost(string, optional, tag = "1")] - pub edition: ::core::option::Option<::prost::alloc::string::String>, + #[prost(enumeration = "super::Edition", optional, tag = "3")] + pub edition: ::core::option::Option, /// Textproto value. #[prost(string, optional, tag = "2")] pub value: ::core::option::Option<::prost::alloc::string::String>, @@ -1111,7 +1117,7 @@ pub struct EnumOptions { /// and strips underscored from the fields before comparison in proto3 only. /// The new behavior takes `json_name` into account and applies to proto2 as /// well. - /// TODO(b/261750190) Remove this legacy behavior once downstream teams have + /// TODO Remove this legacy behavior once downstream teams have /// had time to migrate. #[deprecated] #[prost(bool, optional, tag = "6")] @@ -1257,7 +1263,7 @@ pub mod uninterpreted_option { pub is_extension: bool, } } -/// TODO(b/274655146) Enums in C++ gencode (and potentially other languages) are +/// TODO Enums in C++ gencode (and potentially other languages) are /// not well scoped. This means that each of the feature enums below can clash /// with each other. The short names we've chosen maximize call-site /// readability, but leave us very open to this scenario. A future feature will @@ -1271,14 +1277,12 @@ pub struct FeatureSet { pub enum_type: ::core::option::Option, #[prost(enumeration = "feature_set::RepeatedFieldEncoding", optional, tag = "3")] pub repeated_field_encoding: ::core::option::Option, - #[prost(enumeration = "feature_set::StringFieldValidation", optional, tag = "4")] - pub string_field_validation: ::core::option::Option, + #[prost(enumeration = "feature_set::Utf8Validation", optional, tag = "4")] + pub utf8_validation: ::core::option::Option, #[prost(enumeration = "feature_set::MessageEncoding", optional, tag = "5")] pub message_encoding: ::core::option::Option, #[prost(enumeration = "feature_set::JsonFormat", optional, tag = "6")] pub json_format: ::core::option::Option, - #[prost(message, optional, boxed, tag = "999")] - pub raw_features: ::core::option::Option<::prost::alloc::boxed::Box>, } /// Nested message and enum types in `FeatureSet`. pub mod feature_set { @@ -1383,22 +1387,20 @@ pub mod feature_set { ::prost::Enumeration )] #[repr(i32)] - pub enum StringFieldValidation { + pub enum Utf8Validation { Unknown = 0, - Mandatory = 1, - Hint = 2, - None = 3, + None = 1, + Verify = 2, } - impl StringFieldValidation { + impl Utf8Validation { /// 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 { - StringFieldValidation::Unknown => "STRING_FIELD_VALIDATION_UNKNOWN", - StringFieldValidation::Mandatory => "MANDATORY", - StringFieldValidation::Hint => "HINT", - StringFieldValidation::None => "NONE", + Utf8Validation::Unknown => "UTF8_VALIDATION_UNKNOWN", + Utf8Validation::None => "NONE", + Utf8Validation::Verify => "VERIFY", } } } @@ -1461,6 +1463,39 @@ pub mod feature_set { } } } +/// A compiled specification for the defaults of a set of features. These +/// messages are generated from FeatureSet extensions and can be used to seed +/// feature resolution. The resolution with this object becomes a simple search +/// for the closest matching edition, followed by proto merges. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FeatureSetDefaults { + #[prost(message, repeated, tag = "1")] + pub defaults: ::prost::alloc::vec::Vec< + feature_set_defaults::FeatureSetEditionDefault, + >, + /// The minimum supported edition (inclusive) when this was constructed. + /// Editions before this will not have defaults. + #[prost(enumeration = "Edition", optional, tag = "4")] + pub minimum_edition: ::core::option::Option, + /// The maximum known edition (inclusive) when this was constructed. Editions + /// after this will not have reliable defaults. + #[prost(enumeration = "Edition", optional, tag = "5")] + pub maximum_edition: ::core::option::Option, +} +/// Nested message and enum types in `FeatureSetDefaults`. +pub mod feature_set_defaults { + /// A map from every known edition with a unique set of defaults to its + /// defaults. Not all editions may be contained here. For a given edition, + /// the defaults at the closest matching edition ordered at or before it should + /// be used. This field must be in strict ascending order by edition. + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct FeatureSetEditionDefault { + #[prost(enumeration = "super::Edition", optional, tag = "3")] + pub edition: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub features: ::core::option::Option, + } +} /// Encapsulates information about the original source file from which a /// FileDescriptorProto was generated. #[derive(Clone, PartialEq, ::prost::Message)] @@ -1660,6 +1695,48 @@ pub mod generated_code_info { } } } +/// The full set of known editions. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum Edition { + /// A placeholder for an unknown edition value. + Unknown = 0, + /// Legacy syntax "editions". These pre-date editions, but behave much like + /// distinct editions. These can't be used to specify the edition of proto + /// files, but feature definitions must supply proto2/proto3 defaults for + /// backwards compatibility. + Proto2 = 998, + Proto3 = 999, + /// Editions that have been released. The specific values are arbitrary and + /// should not be depended on, but they will always be time-ordered for easy + /// comparison. + Edition2023 = 1000, + /// Placeholder editions for testing feature resolution. These should not be + /// used or relyed on outside of tests. + Edition1TestOnly = 1, + Edition2TestOnly = 2, + Edition99997TestOnly = 99997, + Edition99998TestOnly = 99998, + Edition99999TestOnly = 99999, +} +impl Edition { + /// 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 { + Edition::Unknown => "EDITION_UNKNOWN", + Edition::Proto2 => "EDITION_PROTO2", + Edition::Proto3 => "EDITION_PROTO3", + Edition::Edition2023 => "EDITION_2023", + Edition::Edition1TestOnly => "EDITION_1_TEST_ONLY", + Edition::Edition2TestOnly => "EDITION_2_TEST_ONLY", + Edition::Edition99997TestOnly => "EDITION_99997_TEST_ONLY", + Edition::Edition99998TestOnly => "EDITION_99998_TEST_ONLY", + Edition::Edition99999TestOnly => "EDITION_99999_TEST_ONLY", + } + } +} /// `Struct` represents a structured data value, consisting of fields /// which map to dynamically typed values. In some languages, `Struct` /// might be supported by a native representation. For example, in @@ -1736,15 +1813,6 @@ impl NullValue { } } } -/// A generic empty message that you can re-use to avoid defining duplicated -/// empty messages in your APIs. A typical example is to use it as the request -/// or the response type of an API method. For instance: -/// service Foo { -/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); -/// } -#[derive(serde::Serialize, serde::Deserialize)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Empty {} /// A Timestamp represents a point in time independent of any time zone or local /// calendar, encoded as a count of seconds and fractions of seconds at /// nanosecond resolution. The count is relative to an epoch at UTC midnight on @@ -1825,4 +1893,13 @@ pub struct Timestamp { /// inclusive. #[prost(int32, tag = "2")] pub nanos: i32, -} \ No newline at end of file +} +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Empty {} \ No newline at end of file diff --git a/ydb-grpc/src/generated/ydb.discovery.rs b/ydb-grpc/src/generated/ydb.discovery.rs index 5b0d0332..221d34af 100644 --- a/ydb-grpc/src/generated/ydb.discovery.rs +++ b/ydb-grpc/src/generated/ydb.discovery.rs @@ -73,4 +73,33 @@ pub struct WhoAmIResult { pub struct WhoAmIResponse { #[prost(message, optional, tag = "1")] pub operation: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NodeLocation { + /// compatibility section -- will be removed in future versions + #[deprecated] + #[prost(uint32, optional, tag = "1")] + pub data_center_num: ::core::option::Option, + #[deprecated] + #[prost(uint32, optional, tag = "2")] + pub room_num: ::core::option::Option, + #[deprecated] + #[prost(uint32, optional, tag = "3")] + pub rack_num: ::core::option::Option, + #[deprecated] + #[prost(uint32, optional, tag = "4")] + pub body_num: ::core::option::Option, + /// for compatibility with WalleLocation + #[deprecated] + #[prost(uint32, optional, tag = "100500")] + pub body: ::core::option::Option, + #[prost(string, optional, tag = "10")] + pub data_center: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag = "20")] + pub module: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag = "30")] + pub rack: ::core::option::Option<::prost::alloc::string::String>, + #[prost(string, optional, tag = "40")] + pub unit: ::core::option::Option<::prost::alloc::string::String>, } \ No newline at end of file diff --git a/ydb-grpc/src/generated/ydb.rs b/ydb-grpc/src/generated/ydb.rs index 8a4121c1..6252b630 100644 --- a/ydb-grpc/src/generated/ydb.rs +++ b/ydb-grpc/src/generated/ydb.rs @@ -84,6 +84,21 @@ pub struct CostInfo { } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct QuotaExceeded { + #[prost(bool, tag = "1")] + pub disk: bool, +} +/// Specifies a point in database time +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VirtualTimestamp { + #[prost(uint64, tag = "1")] + pub plan_step: u64, + #[prost(uint64, tag = "2")] + pub tx_id: u64, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct StatusIds {} /// Nested message and enum types in `StatusIds`. pub mod status_ids { @@ -122,6 +137,7 @@ pub mod status_ids { Undetermined = 400170, Unsupported = 400180, SessionBusy = 400190, + ExternalError = 400200, } impl StatusCode { /// String value of the enum field names used in the ProtoBuf definition. @@ -149,6 +165,7 @@ pub mod status_ids { StatusCode::Undetermined => "UNDETERMINED", StatusCode::Unsupported => "UNSUPPORTED", StatusCode::SessionBusy => "SESSION_BUSY", + StatusCode::ExternalError => "EXTERNAL_ERROR", } } } @@ -228,10 +245,27 @@ pub struct TaggedType { } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct PgType { + #[prost(string, tag = "10")] + pub type_name: ::prost::alloc::string::String, + #[prost(string, tag = "11")] + pub type_modifier: ::prost::alloc::string::String, + /// pg object id of the type + /// full registry could be found here: + #[prost(uint32, tag = "1")] + pub oid: u32, + /// advanced type details useful for pg wire format proxying + #[prost(int32, tag = "2")] + pub typlen: i32, + #[prost(int32, tag = "3")] + pub typmod: i32, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct Type { #[prost( oneof = "r#type::Type", - tags = "1, 2, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204" + tags = "1, 2, 101, 102, 103, 104, 105, 106, 107, 201, 202, 203, 204, 205" )] pub r#type: ::core::option::Option, } @@ -345,6 +379,8 @@ pub mod r#type { EmptyListType(i32), #[prost(enumeration = "super::super::google::protobuf::NullValue", tag = "204")] EmptyDictType(i32), + #[prost(message, tag = "205")] + PgType(super::PgType), } } #[derive(serde::Serialize, serde::Deserialize)] diff --git a/ydb-grpc/src/generated/ydb.scheme.rs b/ydb-grpc/src/generated/ydb.scheme.rs index 0a5afa1b..f22eaa6a 100644 --- a/ydb-grpc/src/generated/ydb.scheme.rs +++ b/ydb-grpc/src/generated/ydb.scheme.rs @@ -75,6 +75,9 @@ pub struct Entry { /// 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, } /// Nested message and enum types in `Entry`. pub mod entry { @@ -100,9 +103,14 @@ pub mod entry { RtmrVolume = 5, BlockStoreVolume = 6, CoordinationNode = 7, + ColumnStore = 12, + ColumnTable = 13, Sequence = 15, Replication = 16, Topic = 17, + ExternalTable = 18, + ExternalDataSource = 19, + View = 20, } impl Type { /// String value of the enum field names used in the ProtoBuf definition. @@ -118,9 +126,14 @@ pub mod entry { 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", + Type::ExternalTable => "EXTERNAL_TABLE", + Type::ExternalDataSource => "EXTERNAL_DATA_SOURCE", + Type::View => "VIEW", } } } @@ -193,6 +206,17 @@ pub struct ModifyPermissionsRequest { /// 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, +} +/// Nested message and enum types in `ModifyPermissionsRequest`. +pub mod modify_permissions_request { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Inheritance { + #[prost(bool, tag = "5")] + InterruptInheritance(bool), + } } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/ydb-grpc/src/generated/ydb.table.rs b/ydb-grpc/src/generated/ydb.table.rs index a3a97ee4..ae936ba4 100644 --- a/ydb-grpc/src/generated/ydb.table.rs +++ b/ydb-grpc/src/generated/ydb.table.rs @@ -42,6 +42,9 @@ pub struct GlobalIndex {} #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GlobalAsyncIndex {} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GlobalUniqueIndex {} /// Represent secondary index #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -56,7 +59,7 @@ pub struct TableIndex { #[prost(string, repeated, tag = "5")] pub data_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// Type of index - #[prost(oneof = "table_index::Type", tags = "3, 4")] + #[prost(oneof = "table_index::Type", tags = "3, 4, 6")] pub r#type: ::core::option::Option, } /// Nested message and enum types in `TableIndex`. @@ -69,6 +72,8 @@ pub mod table_index { GlobalIndex(super::GlobalIndex), #[prost(message, tag = "4")] GlobalAsyncIndex(super::GlobalAsyncIndex), + #[prost(message, tag = "6")] + GlobalUniqueIndex(super::GlobalUniqueIndex), } } /// Represent secondary index with index state @@ -90,7 +95,7 @@ pub struct TableIndexDescription { #[prost(uint64, tag = "7")] pub size_bytes: u64, /// Type of index - #[prost(oneof = "table_index_description::Type", tags = "3, 5")] + #[prost(oneof = "table_index_description::Type", tags = "3, 5, 8")] pub r#type: ::core::option::Option, } /// Nested message and enum types in `TableIndexDescription`. @@ -135,6 +140,8 @@ pub mod table_index_description { GlobalIndex(super::GlobalIndex), #[prost(message, tag = "5")] GlobalAsyncIndex(super::GlobalAsyncIndex), + #[prost(message, tag = "8")] + GlobalUniqueIndex(super::GlobalUniqueIndex), } } /// State of index building operation @@ -272,7 +279,12 @@ pub mod changefeed_format { #[repr(i32)] pub enum Format { Unspecified = 0, + /// Change record in JSON format for common (row oriented) tables Json = 1, + /// Change record in JSON format for document (DynamoDB-compatible) tables + DynamodbStreamsJson = 2, + /// Debezium-like change record JSON format for common (row oriented) tables + DebeziumJson = 3, } impl Format { /// String value of the enum field names used in the ProtoBuf definition. @@ -282,6 +294,8 @@ pub mod changefeed_format { match self { Format::Unspecified => "FORMAT_UNSPECIFIED", Format::Json => "FORMAT_JSON", + Format::DynamodbStreamsJson => "FORMAT_DYNAMODB_STREAMS_JSON", + Format::DebeziumJson => "FORMAT_DEBEZIUM_JSON", } } } @@ -298,6 +312,36 @@ pub struct Changefeed { /// Format of the data #[prost(enumeration = "changefeed_format::Format", tag = "3")] pub format: i32, + /// How long data in changefeed's underlying topic should be stored + #[prost(message, optional, tag = "4")] + pub retention_period: ::core::option::Option< + super::super::google::protobuf::Duration, + >, + /// Emit virtual timestamps of changes along with data or not + #[prost(bool, tag = "5")] + pub virtual_timestamps: bool, + /// Initial scan will output the current state of the table first + #[prost(bool, tag = "6")] + pub initial_scan: bool, + /// Attributes. Total size is limited to 10 KB. + #[prost(map = "string, string", tag = "7")] + pub attributes: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// Value that will be emitted in the `awsRegion` field of the record in DYNAMODB_STREAMS_JSON format + #[prost(string, tag = "8")] + pub aws_region: ::prost::alloc::string::String, + /// Periodically emit resolved timestamps. If unspecified, resolved timestamps are not emitted. + #[prost(message, optional, tag = "9")] + pub resolved_timestamps_interval: ::core::option::Option< + super::super::google::protobuf::Duration, + >, + /// Partitioning settings of underlying topic. + #[prost(message, optional, tag = "10")] + pub topic_partitioning_settings: ::core::option::Option< + super::topic::PartitioningSettings, + >, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -314,6 +358,23 @@ pub struct ChangefeedDescription { /// State of the feed #[prost(enumeration = "changefeed_description::State", tag = "4")] pub state: i32, + /// State of emitting of virtual timestamps along with data + #[prost(bool, tag = "5")] + pub virtual_timestamps: bool, + /// Attributes + #[prost(map = "string, string", tag = "6")] + pub attributes: ::std::collections::HashMap< + ::prost::alloc::string::String, + ::prost::alloc::string::String, + >, + /// Value that will be emitted in the `awsRegion` field of the record in DYNAMODB_STREAMS_JSON format + #[prost(string, tag = "7")] + pub aws_region: ::prost::alloc::string::String, + /// Interval of emitting of resolved timestamps. If unspecified, resolved timestamps are not emitted. + #[prost(message, optional, tag = "8")] + pub resolved_timestamps_interval: ::core::option::Option< + super::super::google::protobuf::Duration, + >, } /// Nested message and enum types in `ChangefeedDescription`. pub mod changefeed_description { @@ -332,8 +393,14 @@ pub mod changefeed_description { #[repr(i32)] pub enum State { Unspecified = 0, + /// Normal state, from this state changefeed can be disabled Enabled = 1, + /// No new change records are generated, but the old ones remain available + /// From this state changefeed cannot be switched to any other state Disabled = 2, + /// An initial scan is being performed. + /// After its completion changefeed will switch to the normal state + InitialScan = 3, } impl State { /// String value of the enum field names used in the ProtoBuf definition. @@ -344,6 +411,7 @@ pub mod changefeed_description { State::Unspecified => "STATE_UNSPECIFIED", State::Enabled => "STATE_ENABLED", State::Disabled => "STATE_DISABLED", + State::InitialScan => "STATE_INITIAL_SCAN", } } } @@ -586,6 +654,45 @@ pub struct TableProfile { } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct SequenceDescription { + /// mandatorys + #[prost(string, optional, tag = "1")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + /// minimum value, defaults to 1 or Min + #[prost(sint64, optional, tag = "2")] + pub min_value: ::core::option::Option, + /// maximum value, defaults to Max or -1 + #[prost(sint64, optional, tag = "3")] + pub max_value: ::core::option::Option, + /// start value, defaults to min_value + #[prost(sint64, optional, tag = "4")] + pub start_value: ::core::option::Option, + /// number of items to cache, defaults to 1 + #[prost(uint64, optional, tag = "5")] + pub cache: ::core::option::Option, + /// increment at each call, defaults to 1 + #[prost(sint64, optional, tag = "6")] + pub increment: ::core::option::Option, + /// true when cycle on overflow is allowed + #[prost(bool, optional, tag = "7")] + pub cycle: ::core::option::Option, + /// set_val(next_value, next_used) is executed atomically when creating + #[prost(message, optional, tag = "8")] + pub set_val: ::core::option::Option, +} +/// Nested message and enum types in `SequenceDescription`. +pub mod sequence_description { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct SetVal { + #[prost(sint64, optional, tag = "1")] + pub next_value: ::core::option::Option, + #[prost(bool, optional, tag = "2")] + pub next_used: ::core::option::Option, + } +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct ColumnMeta { /// Name of column #[prost(string, tag = "1")] @@ -596,6 +703,24 @@ pub struct ColumnMeta { /// Column family name of the column #[prost(string, tag = "3")] pub family: ::prost::alloc::string::String, + /// Column nullability + #[prost(bool, optional, tag = "4")] + pub not_null: ::core::option::Option, + /// Column default value option + #[prost(oneof = "column_meta::DefaultValue", tags = "5, 6")] + pub default_value: ::core::option::Option, +} +/// Nested message and enum types in `ColumnMeta`. +pub mod column_meta { + /// Column default value option + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum DefaultValue { + #[prost(message, tag = "5")] + FromLiteral(super::super::TypedValue), + #[prost(message, tag = "6")] + FromSequence(super::SequenceDescription), + } } /// The row will be considered as expired at the moment of time, when the value /// stored in is less than or equal to the current time (in epoch @@ -764,6 +889,9 @@ pub mod column_family { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PartitioningSettings { + /// List of columns to partition by + #[prost(string, repeated, tag = "1")] + pub partition_by: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// Enable auto partitioning on reaching upper or lower partition size bound #[prost(enumeration = "super::feature_flag::Status", tag = "2")] pub partitioning_by_size: i32, @@ -866,6 +994,15 @@ pub struct CreateTableRequest { /// Read replicas settings for table #[prost(message, optional, tag = "17")] pub read_replicas_settings: ::core::option::Option, + /// Tiering rules name. It specifies how data migrates from one tier (logical storage) to another. + #[prost(string, tag = "18")] + pub tiering: ::prost::alloc::string::String, + /// Is temporary table + #[prost(bool, tag = "19")] + pub temporary: bool, + /// Is table column or row oriented + #[prost(enumeration = "StoreType", tag = "20")] + pub store_type: i32, /// Either one of the following partitions options can be specified #[prost(oneof = "create_table_request::Partitions", tags = "13, 14")] pub partitions: ::core::option::Option, @@ -990,6 +1127,9 @@ pub struct AlterTableRequest { /// Setup or remove time to live settings #[prost(oneof = "alter_table_request::TtlAction", tags = "7, 8")] pub ttl_action: ::core::option::Option, + /// Setup or remove tiering + #[prost(oneof = "alter_table_request::TieringAction", tags = "22, 23")] + pub tiering_action: ::core::option::Option, } /// Nested message and enum types in `AlterTableRequest`. pub mod alter_table_request { @@ -1002,6 +1142,15 @@ pub mod alter_table_request { #[prost(message, tag = "8")] DropTtlSettings(super::super::super::google::protobuf::Empty), } + /// Setup or remove tiering + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum TieringAction { + #[prost(string, tag = "22")] + SetTiering(::prost::alloc::string::String), + #[prost(message, tag = "23")] + DropTiering(super::super::super::google::protobuf::Empty), + } } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1172,6 +1321,15 @@ pub struct DescribeTableResult { /// List of changefeeds #[prost(message, repeated, tag = "15")] pub changefeeds: ::prost::alloc::vec::Vec, + /// Tiering rules name + #[prost(string, tag = "16")] + pub tiering: ::prost::alloc::string::String, + /// Is temporary table + #[prost(bool, tag = "17")] + pub temporary: bool, + /// Is table column or row oriented + #[prost(enumeration = "StoreType", tag = "18")] + pub store_type: i32, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1398,6 +1556,8 @@ pub struct ExplainDataQueryRequest { pub yql_text: ::prost::alloc::string::String, #[prost(message, optional, tag = "3")] pub operation_params: ::core::option::Option, + #[prost(bool, tag = "4")] + pub collect_full_diagnostics: bool, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1413,6 +1573,8 @@ pub struct ExplainQueryResult { pub query_ast: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub query_plan: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub query_full_diagnostics: ::prost::alloc::string::String, } /// Prepare given program to execute #[derive(serde::Serialize, serde::Deserialize)] @@ -1781,6 +1943,16 @@ pub struct ReadTableRequest { /// Use a server-side snapshot #[prost(enumeration = "super::feature_flag::Status", tag = "7")] pub use_snapshot: i32, + /// Server-side best-effort policy. Can be used as a hint to limit the size + /// of batches sent from a server. If both are specified, the server chooses + /// the smaller one. The limits are not strict, so batch size can be slightly + /// greater than any of the limits + #[prost(uint64, tag = "8")] + pub batch_limit_bytes: u64, + #[prost(uint64, tag = "9")] + pub batch_limit_rows: u64, + #[prost(enumeration = "super::feature_flag::Status", tag = "10")] + pub return_not_null_data_as_optional: i32, } /// ReadTable doesn't use Operation, returns result directly #[derive(serde::Serialize, serde::Deserialize)] @@ -1792,6 +1964,9 @@ pub struct ReadTableResponse { /// Issues #[prost(message, repeated, tag = "2")] pub issues: ::prost::alloc::vec::Vec, + /// Optional snapshot that corresponds to the returned data + #[prost(message, optional, tag = "4")] + pub snapshot: ::core::option::Option, /// Read table result #[prost(message, optional, tag = "3")] pub result: ::core::option::Option, @@ -1806,6 +1981,36 @@ pub struct ReadTableResult { } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReadRowsRequest { + /// Session identifier + #[prost(string, tag = "1")] + pub session_id: ::prost::alloc::string::String, + /// Path to table to read + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, + /// Keys to read. Must be a list of structs where each stuct is a key + /// for one requested row and should contain all key columns + #[prost(message, optional, tag = "3")] + pub keys: ::core::option::Option, + /// Output columns. If empty all columns will be requested + #[prost(string, repeated, tag = "4")] + pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReadRowsResponse { + /// Status of request (same as other statuses) + #[prost(enumeration = "super::status_ids::StatusCode", tag = "1")] + pub status: i32, + /// Issues + #[prost(message, repeated, tag = "2")] + pub issues: ::prost::alloc::vec::Vec, + /// Result set (same as result of sql request) + #[prost(message, optional, tag = "3")] + pub result_set: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct BulkUpsertRequest { #[prost(string, tag = "1")] pub table: ::prost::alloc::string::String, @@ -1858,6 +2063,10 @@ pub struct ExecuteScanQueryRequest { pub mode: i32, #[prost(enumeration = "query_stats_collection::Mode", tag = "8")] pub collect_stats: i32, + /// works only in mode: MODE_EXPLAIN, + /// collects additional diagnostics about query compilation, including query plan and scheme + #[prost(bool, tag = "9")] + pub collect_full_diagnostics: bool, } /// Nested message and enum types in `ExecuteScanQueryRequest`. pub mod execute_scan_query_request { @@ -1910,4 +2119,28 @@ pub struct ExecuteScanQueryPartialResult { pub result_set: ::core::option::Option, #[prost(message, optional, tag = "6")] pub query_stats: ::core::option::Option, + /// works only in mode: MODE_EXPLAIN, + /// collects additional diagnostics about query compilation, including query plan and scheme + #[prost(string, tag = "7")] + pub query_full_diagnostics: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum StoreType { + Unspecified = 0, + Row = 1, + Column = 2, +} +impl StoreType { + /// 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 { + StoreType::Unspecified => "STORE_TYPE_UNSPECIFIED", + StoreType::Row => "STORE_TYPE_ROW", + StoreType::Column => "STORE_TYPE_COLUMN", + } + } } \ No newline at end of file diff --git a/ydb-grpc/src/generated/ydb.table.v1.rs b/ydb-grpc/src/generated/ydb.table.v1.rs index 81222f02..2c9f0cda 100644 --- a/ydb-grpc/src/generated/ydb.table.v1.rs +++ b/ydb-grpc/src/generated/ydb.table.v1.rs @@ -494,6 +494,26 @@ pub mod table_service_client { ); self.inner.server_streaming(request.into_request(), path, codec).await } + /// Reads specified keys non-transactionally from a single table + pub async fn read_rows( + &mut self, + request: impl tonic::IntoRequest, + ) -> 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( + "/Ydb.Table.V1.TableService/ReadRows", + ); + self.inner.unary(request.into_request(), path, codec).await + } /// Upserts a batch of rows non-transactionally. /// Returns success only when all rows were successfully upserted. In case of an error some rows might /// be upserted and some might not. diff --git a/ydb-grpc/src/generated/ydb.topic.rs b/ydb-grpc/src/generated/ydb.topic.rs index c1ce28fd..630e58a3 100644 --- a/ydb-grpc/src/generated/ydb.topic.rs +++ b/ydb-grpc/src/generated/ydb.topic.rs @@ -28,6 +28,24 @@ pub struct UpdateTokenRequest { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct UpdateTokenResponse {} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PartitionWithGeneration { + /// Partition identifier. + #[prost(int64, tag = "1")] + pub partition_id: i64, + /// Partition generation. + #[prost(int64, tag = "2")] + pub generation: i64, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetadataItem { + #[prost(string, tag = "1")] + pub key: ::prost::alloc::string::String, + #[prost(bytes = "vec", tag = "2")] + pub value: ::prost::alloc::vec::Vec, +} /// Messages for bidirectional streaming rpc StreamWrite #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -110,7 +128,7 @@ pub mod stream_write_message { pub get_last_seq_no: bool, /// Option for setting order on messages. /// If neither is set, no guarantees on ordering or partitions to write to. - #[prost(oneof = "init_request::Partitioning", tags = "4, 5")] + #[prost(oneof = "init_request::Partitioning", tags = "4, 5, 7")] pub partitioning: ::core::option::Option, } /// Nested message and enum types in `InitRequest`. @@ -126,9 +144,12 @@ pub mod stream_write_message { /// Explicit partition id to write to. #[prost(int64, tag = "5")] PartitionId(i64), + /// Explicit partition location to write to. + #[prost(message, tag = "7")] + PartitionWithGeneration(super::super::PartitionWithGeneration), } } - /// Response for handshake. + /// Response to the handshake. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitResponse { @@ -157,6 +178,8 @@ pub mod stream_write_message { /// See enum Codec above for values. #[prost(int32, tag = "2")] pub codec: i32, + #[prost(message, optional, tag = "3")] + pub tx: ::core::option::Option, } /// Nested message and enum types in `WriteRequest`. pub mod write_request { @@ -178,8 +201,11 @@ pub mod stream_write_message { /// Uncompressed size of client message body. #[prost(int64, tag = "4")] pub uncompressed_size: i64, + /// Message metadata. Overall size is limited to 4096 symbols (all keys and values combined). + #[prost(message, repeated, tag = "7")] + pub metadata_items: ::prost::alloc::vec::Vec, /// Per-message override for respective write session settings. - #[prost(oneof = "message_data::Partitioning", tags = "5, 6")] + #[prost(oneof = "message_data::Partitioning", tags = "5, 6, 8")] pub partitioning: ::core::option::Option, } /// Nested message and enum types in `MessageData`. @@ -194,6 +220,9 @@ pub mod stream_write_message { /// Explicit partition id to write to. #[prost(int64, tag = "6")] PartitionId(i64), + /// Explicit partition location to write to. + #[prost(message, tag = "8")] + PartitionWithGeneration(super::super::super::PartitionWithGeneration), } } } @@ -224,7 +253,7 @@ pub mod stream_write_message { #[prost(int64, tag = "1")] pub seq_no: i64, /// Either message is written for the first time or duplicate. - #[prost(oneof = "write_ack::MessageWriteStatus", tags = "2, 3")] + #[prost(oneof = "write_ack::MessageWriteStatus", tags = "2, 3, 4")] pub message_write_status: ::core::option::Option< write_ack::MessageWriteStatus, >, @@ -275,6 +304,9 @@ pub mod stream_write_message { } } } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct WrittenInTx {} /// Either message is written for the first time or duplicate. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Oneof)] @@ -283,6 +315,8 @@ pub mod stream_write_message { Written(Written), #[prost(message, tag = "3")] Skipped(Skipped), + #[prost(message, tag = "4")] + WrittenInTx(WrittenInTx), } } /// Message with write statistics. @@ -328,7 +362,7 @@ pub mod stream_read_message { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PartitionSession { - /// Identitifier of partition session. Unique inside one RPC call. + /// Identifier of partition session. Unique inside one RPC call. #[prost(int64, tag = "1")] pub partition_session_id: i64, /// Topic path of partition. @@ -344,6 +378,7 @@ pub mod stream_read_message { /// CommitOffsetRequest - request for commit of some read data. /// PartitionSessionStatusRequest - request for session status /// UpdateTokenRequest - request to update auth token + /// DirectReadAck - client signals it has finished direct reading from the partition node. /// StartPartitionSessionResponse - Response to StreamReadServerMessage.StartPartitionSessionRequest. /// Client signals it is ready to get data from partition. /// StopPartitionSessionResponse - Response to StreamReadServerMessage.StopPartitionSessionRequest. @@ -351,7 +386,7 @@ pub mod stream_read_message { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FromClient { - #[prost(oneof = "from_client::ClientMessage", tags = "1, 2, 3, 4, 5, 6, 7")] + #[prost(oneof = "from_client::ClientMessage", tags = "1, 2, 3, 4, 5, 8, 6, 7")] pub client_message: ::core::option::Option, } /// Nested message and enum types in `FromClient`. @@ -370,6 +405,8 @@ pub mod stream_read_message { PartitionSessionStatusRequest(super::PartitionSessionStatusRequest), #[prost(message, tag = "5")] UpdateTokenRequest(super::super::UpdateTokenRequest), + #[prost(message, tag = "8")] + DirectReadAck(super::DirectReadAck), /// Responses to respective server commands. #[prost(message, tag = "6")] StartPartitionSessionResponse(super::StartPartitionSessionResponse), @@ -385,6 +422,7 @@ pub mod stream_read_message { /// UpdateTokenResponse - acknowledgment of token update. /// StartPartitionSessionRequest - command from server to create a partition session. /// StopPartitionSessionRequest - command from server to destroy a partition session. + /// UpdatePartitionSession - command from server to update a partition session. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct FromServer { @@ -394,7 +432,7 @@ pub mod stream_read_message { /// Issues if any. #[prost(message, repeated, tag = "2")] pub issues: ::prost::alloc::vec::Vec, - #[prost(oneof = "from_server::ServerMessage", tags = "3, 4, 5, 6, 7, 8, 9")] + #[prost(oneof = "from_server::ServerMessage", tags = "3, 4, 5, 6, 7, 8, 9, 10")] pub server_message: ::core::option::Option, } /// Nested message and enum types in `FromServer`. @@ -418,6 +456,8 @@ pub mod stream_read_message { StartPartitionSessionRequest(super::StartPartitionSessionRequest), #[prost(message, tag = "9")] StopPartitionSessionRequest(super::StopPartitionSessionRequest), + #[prost(message, tag = "10")] + UpdatePartitionSession(super::UpdatePartitionSession), } } /// Handshake request. @@ -433,6 +473,12 @@ pub mod stream_read_message { /// Path of consumer that is used for reading by this session. #[prost(string, tag = "2")] pub consumer: ::prost::alloc::string::String, + /// Optional name. Will be shown in debug stat. + #[prost(string, tag = "3")] + pub reader_name: ::prost::alloc::string::String, + /// Direct reading from a partition node. + #[prost(bool, tag = "4")] + pub direct_read: bool, } /// Nested message and enum types in `InitRequest`. pub mod init_request { @@ -464,7 +510,7 @@ pub mod stream_read_message { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InitResponse { - /// Read session identifier for debug purposes. + /// Read session identifier. #[prost(string, tag = "1")] pub session_id: ::prost::alloc::string::String, } @@ -489,7 +535,7 @@ pub mod stream_read_message { /// 4) Server is free to send up to 50 + 100 = 150 bytes. But the next read message is too big, /// and it sends 160 bytes ReadResponse. /// 5) Let's assume client somehow processes it, and its 200 bytes buffer is free again. - /// It shoud account for excess 10 bytes and send ReadRequest with bytes_size = 210. + /// It should account for excess 10 bytes and send ReadRequest with bytes_size = 210. #[prost(int64, tag = "1")] pub bytes_size: i64, } @@ -512,7 +558,7 @@ pub mod stream_read_message { #[derive(Clone, PartialEq, ::prost::Message)] pub struct MessageData { /// Partition offset in partition that assigned for message. - /// unique value for clientside deduplication - Topic:Partition:Offset + /// unique value for client side deduplication - Topic:Partition:Offset #[prost(int64, tag = "1")] pub offset: i64, /// Sequence number that provided with message on write from client. @@ -534,6 +580,8 @@ pub mod stream_read_message { /// Filled if message_group_id was set on message write. #[prost(string, tag = "7")] pub message_group_id: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "8")] + pub metadata_items: ::prost::alloc::vec::Vec, } /// Representation of sequence of client messages from one write session. #[derive(serde::Serialize, serde::Deserialize)] @@ -626,7 +674,7 @@ pub mod stream_read_message { #[prost(int64, tag = "1")] pub partition_session_id: i64, } - /// Response for status request. + /// Response to status request. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct PartitionSessionStatusResponse { @@ -659,6 +707,9 @@ pub mod stream_read_message { /// Partition contains messages with offsets in range [start, end). #[prost(message, optional, tag = "3")] pub partition_offsets: ::core::option::Option, + /// Partition location, filled only when InitRequest.direct_read is true. + #[prost(message, optional, tag = "4")] + pub partition_location: ::core::option::Option, } /// Signal for server that cient is ready to recive data for partition. #[derive(serde::Serialize, serde::Deserialize)] @@ -699,6 +750,9 @@ pub mod stream_read_message { /// Upper bound for committed offsets. #[prost(int64, tag = "3")] pub committed_offset: i64, + /// Upper bound for read request identifiers, filled only when InitRequest.direct_read is true and graceful is true. + #[prost(int64, tag = "4")] + pub last_direct_read_id: i64, } /// Signal for server that client finished working with this partition. /// Must be sent only after corresponding StopPartitionSessionRequest from server. @@ -709,8 +763,276 @@ pub mod stream_read_message { /// Partition session identifier of partition session that is released by client. #[prost(int64, tag = "1")] pub partition_session_id: i64, + /// Flag of graceful stop, used only when InitRequest.direct_read is true + /// Client must pass this value unchanged from the StopPartitionSessionRequest. + /// Server can sent two StopPartitionSessionRequests, the first with graceful=true, the second with graceful=false. The client must answer both of them. + #[prost(bool, tag = "2")] + pub graceful: bool, + } + /// Command from server to notify about a partition session update. + /// Client should not send a response to the command. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct UpdatePartitionSession { + /// Partition session identifier. + #[prost(int64, tag = "1")] + pub partition_session_id: i64, + /// Partition location, filled only when InitRequest.direct_read is true. + #[prost(message, optional, tag = "2")] + pub partition_location: ::core::option::Option, + } + /// Signal for server that client has finished direct reading. + /// Server should not send a response to the command. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct DirectReadAck { + /// Partition session identifier. + #[prost(int64, tag = "1")] + pub partition_session_id: i64, + /// Identifier of the successfully completed read request. + #[prost(int64, tag = "2")] + pub direct_read_id: i64, + } +} +/// Messages for bidirectional streaming rpc StreamDirectRead +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct StreamDirectReadMessage {} +/// Nested message and enum types in `StreamDirectReadMessage`. +pub mod stream_direct_read_message { + /// Client-server message for direct read session. + /// InitDirectRead - command from client to create and start a direct read session. + /// StartDirectReadPartitionSession - command from client to create and start a direct read partition session. + /// UpdateTokenRequest - request to update auth token + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct FromClient { + #[prost(oneof = "from_client::ClientMessage", tags = "1, 2, 3")] + pub client_message: ::core::option::Option, + } + /// Nested message and enum types in `FromClient`. + pub mod from_client { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum ClientMessage { + #[prost(message, tag = "1")] + InitDirectRead(super::InitDirectRead), + #[prost(message, tag = "2")] + StartDirectReadPartitionSession(super::StartDirectReadPartitionSession), + #[prost(message, tag = "3")] + UpdateTokenRequest(super::super::UpdateTokenRequest), + } + } + /// Server-client message for direct read session. + /// DirectReadResponse - portion of message data. + /// StopDirectReadPartitionSession - command from server to stop a direct read partition session. + /// UpdateTokenResponse - acknowledgment of token update. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct FromServer { + /// Server status of response. + #[prost(enumeration = "super::super::status_ids::StatusCode", tag = "1")] + pub status: i32, + /// Issues if any. + #[prost(message, repeated, tag = "2")] + pub issues: ::prost::alloc::vec::Vec, + #[prost(oneof = "from_server::ServerMessage", tags = "3, 4, 5")] + pub server_message: ::core::option::Option, + } + /// Nested message and enum types in `FromServer`. + pub mod from_server { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum ServerMessage { + #[prost(message, tag = "3")] + StopDirectReadPartitionSession(super::StopDirectReadPartitionSession), + #[prost(message, tag = "4")] + DirectReadResponse(super::DirectReadResponse), + #[prost(message, tag = "5")] + UpdateTokenResponse(super::super::UpdateTokenResponse), + } + } + /// Command from client to create and start a direct read session. + /// Server should not send a response to the command. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct InitDirectRead { + /// Read session identifier. + #[prost(string, tag = "1")] + pub session_id: ::prost::alloc::string::String, + /// Topics that will be read by this session. + #[prost(message, repeated, tag = "2")] + pub topics_read_settings: ::prost::alloc::vec::Vec< + init_direct_read::TopicReadSettings, + >, + /// Path of consumer that is used for reading by this session. + #[prost(string, tag = "3")] + pub consumer: ::prost::alloc::string::String, + } + /// Nested message and enum types in `InitDirectRead`. + pub mod init_direct_read { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct TopicReadSettings { + /// Topic path. + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, + } + } + /// Command from client to create and start a direct read partition session. + /// Server should not send a response to the command. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct StartDirectReadPartitionSession { + /// Partition session identifier. + #[prost(int64, tag = "1")] + pub partition_session_id: i64, + /// Upper bound for read request identifiers. + #[prost(int64, tag = "2")] + pub last_direct_read_id: i64, + /// Partition generation. + #[prost(int64, tag = "3")] + pub generation: i64, + } + /// Command from server to stop a direct read partition session. + /// Client should not send a response to the command. + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct StopDirectReadPartitionSession { + /// The reason for the stop. + #[prost(enumeration = "super::super::status_ids::StatusCode", tag = "1")] + pub status: i32, + /// Issues if any. + #[prost(message, repeated, tag = "2")] + pub issues: ::prost::alloc::vec::Vec, + /// Partition session identifier. + #[prost(int64, tag = "3")] + pub partition_session_id: i64, + } + /// Messages that have been read directly from the partition node. + /// It's a response to StreamRead.ReadRequest + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct DirectReadResponse { + /// Partition session identifier. + #[prost(int64, tag = "1")] + pub partition_session_id: i64, + /// Read request identifier. + #[prost(int64, tag = "2")] + pub direct_read_id: i64, + /// Messages data + #[prost(message, optional, tag = "3")] + pub partition_data: ::core::option::Option< + super::stream_read_message::read_response::PartitionData, + >, + } +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionIdentity { + /// Transaction identifier from TableService. + #[prost(string, tag = "1")] + pub id: ::prost::alloc::string::String, + /// Session identifier from TableService. + #[prost(string, tag = "2")] + pub session: ::prost::alloc::string::String, +} +/// Add offsets to transaction request sent from client to server. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateOffsetsInTransactionRequest { + #[prost(message, optional, tag = "1")] + pub operation_params: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub tx: ::core::option::Option, + /// Ranges of offsets by topics. + #[prost(message, repeated, tag = "3")] + pub topics: ::prost::alloc::vec::Vec< + update_offsets_in_transaction_request::TopicOffsets, + >, + #[prost(string, tag = "4")] + pub consumer: ::prost::alloc::string::String, +} +/// Nested message and enum types in `UpdateOffsetsInTransactionRequest`. +pub mod update_offsets_in_transaction_request { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct TopicOffsets { + /// Topic path. + #[prost(string, tag = "1")] + pub path: ::prost::alloc::string::String, + /// Ranges of offsets by partitions. + #[prost(message, repeated, tag = "2")] + pub partitions: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `TopicOffsets`. + pub mod topic_offsets { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct PartitionOffsets { + /// Partition identifier. + #[prost(int64, tag = "1")] + pub partition_id: i64, + /// List of offset ranges. + #[prost(message, repeated, tag = "2")] + pub partition_offsets: ::prost::alloc::vec::Vec, + } } } +/// Add offsets to transaction response sent from server to client. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateOffsetsInTransactionResponse { + /// Result of request will be inside operation. + #[prost(message, optional, tag = "1")] + pub operation: ::core::option::Option, +} +/// Add offsets to transaction result message that will be inside UpdateOffsetsInTransactionResponse.operation. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateOffsetsInTransactionResult {} +/// Commit offset request sent from client to server. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitOffsetRequest { + #[prost(message, optional, tag = "1")] + pub operation_params: ::core::option::Option, + /// Topic path of partition. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, + /// Partition identifier. + #[prost(int64, tag = "3")] + pub partition_id: i64, + /// Path of consumer. + #[prost(string, tag = "4")] + pub consumer: ::prost::alloc::string::String, + /// Processed offset. + #[prost(int64, tag = "5")] + pub offset: i64, +} +/// Commit offset response sent from server to client. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitOffsetResponse { + /// Result of request will be inside operation. + #[prost(message, optional, tag = "1")] + pub operation: ::core::option::Option, +} +/// Commit offset result message inside CommitOffsetResponse.operation. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CommitOffsetResult {} +/// message representing statistics by several windows +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MultipleWindowsStat { + #[prost(int64, tag = "1")] + pub per_minute: i64, + #[prost(int64, tag = "2")] + pub per_hour: i64, + #[prost(int64, tag = "3")] + pub per_day: i64, +} /// Consumer description. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -728,6 +1050,7 @@ pub struct Consumer { pub read_from: ::core::option::Option, /// List of supported codecs by this consumer. /// supported_codecs on topic must be contained inside this list. + /// If empty, codec compatibility check for the consumer is disabled. #[prost(message, optional, tag = "5")] pub supported_codecs: ::core::option::Option, /// Attributes of consumer @@ -736,6 +1059,34 @@ pub struct Consumer { ::prost::alloc::string::String, ::prost::alloc::string::String, >, + /// Filled only when requested statistics in Describe*Request. + #[prost(message, optional, tag = "7")] + pub consumer_stats: ::core::option::Option, +} +/// Nested message and enum types in `Consumer`. +pub mod consumer { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct ConsumerStats { + /// Minimal timestamp of last read from partitions. + #[prost(message, optional, tag = "1")] + pub min_partitions_last_read_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// Maximum of differences between timestamp of read and write timestamp for all messages, read during last minute. + #[prost(message, optional, tag = "2")] + pub max_read_time_lag: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// Maximum of differences between write timestamp and create timestamp for all messages, read during last minute. + #[prost(message, optional, tag = "3")] + pub max_write_time_lag: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// Bytes read statistics. + #[prost(message, optional, tag = "4")] + pub bytes_read: ::core::option::Option, + } } /// Consumer alter description. #[derive(serde::Serialize, serde::Deserialize)] @@ -754,6 +1105,7 @@ pub struct AlterConsumer { pub set_read_from: ::core::option::Option, /// List of supported codecs by this consumer. /// supported_codecs on topic must be contained inside this list. + /// If empty, codec compatibility check for the consumer is disabled. #[prost(message, optional, tag = "5")] pub set_supported_codecs: ::core::option::Option, /// User and server attributes of consumer. Server attributes starts from "_" and will be validated by server. @@ -816,6 +1168,7 @@ pub struct CreateTopicRequest { pub retention_storage_mb: i64, /// List of allowed codecs for writers. /// Writes with codec not from this list are forbidden. + /// If empty, codec compatibility check for the topic is disabled. #[prost(message, optional, tag = "7")] pub supported_codecs: ::core::option::Option, /// Partition write speed in bytes per second. Must be less than database limit. @@ -852,6 +1205,17 @@ pub struct CreateTopicResponse { #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CreateTopicResult {} +/// Topic partition location +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PartitionLocation { + /// Node identificator. + #[prost(int32, tag = "1")] + pub node_id: i32, + /// Partition generation. + #[prost(int64, tag = "2")] + pub generation: i64, +} /// Describe topic request sent from client to server. #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -861,6 +1225,12 @@ pub struct DescribeTopicRequest { /// Topic path. #[prost(string, tag = "2")] pub path: ::prost::alloc::string::String, + /// Include topic statistics. + #[prost(bool, tag = "3")] + pub include_stats: bool, + /// Include partition location. + #[prost(bool, tag = "4")] + pub include_location: bool, } /// Describe topic response sent from server to client. /// If topic is not existed then response status will be "SCHEME_ERROR". @@ -897,12 +1267,17 @@ pub struct DescribeTopicResult { pub retention_storage_mb: i64, /// List of allowed codecs for writers. /// Writes with codec not from this list are forbidden. + /// If empty, codec compatibility check for the topic is disabled. #[prost(message, optional, tag = "7")] pub supported_codecs: ::core::option::Option, /// Partition write speed in bytes per second. /// Zero value means default limit: 1 MB per second. #[prost(int64, tag = "8")] pub partition_write_speed_bytes_per_second: i64, + #[prost(int64, tag = "14")] + pub partition_total_read_speed_bytes_per_second: i64, + #[prost(int64, tag = "15")] + pub partition_consumer_read_speed_bytes_per_second: i64, /// Burst size for write in partition, in bytes. /// Zero value means default limit: 1 MB. #[prost(int64, tag = "9")] @@ -919,6 +1294,9 @@ pub struct DescribeTopicResult { /// Metering settings. #[prost(enumeration = "MeteringMode", tag = "12")] pub metering_mode: i32, + /// Statistics of topic. + #[prost(message, optional, tag = "13")] + pub topic_stats: ::core::option::Option, } /// Nested message and enum types in `DescribeTopicResult`. pub mod describe_topic_result { @@ -937,7 +1315,207 @@ pub mod describe_topic_result { /// Ids of partitions from which this partition was formed by split or merge. #[prost(int64, repeated, tag = "4")] pub parent_partition_ids: ::prost::alloc::vec::Vec, + /// Stats for partition, filled only when include_stats in request is true. + #[prost(message, optional, tag = "5")] + pub partition_stats: ::core::option::Option, + /// Partition location, filled only when include_location in request is true. + #[prost(message, optional, tag = "6")] + pub partition_location: ::core::option::Option, + } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct TopicStats { + /// Approximate size of topic. + #[prost(int64, tag = "1")] + pub store_size_bytes: i64, + /// Minimum of timestamps of last write among all partitions. + #[prost(message, optional, tag = "2")] + pub min_last_write_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// Maximum of differences between write timestamp and create timestamp for all messages, written during last minute. + #[prost(message, optional, tag = "3")] + pub max_write_time_lag: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// How much bytes were written statistics. + #[prost(message, optional, tag = "4")] + pub bytes_written: ::core::option::Option, + } +} +/// Describe partition request sent from client to server. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribePartitionRequest { + #[prost(message, optional, tag = "1")] + pub operation_params: ::core::option::Option, + /// Topic path. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, + /// Partition identifier. + #[prost(int64, tag = "3")] + pub partition_id: i64, + /// Include partition statistics. + #[prost(bool, tag = "4")] + pub include_stats: bool, + /// Include partition location. + #[prost(bool, tag = "5")] + pub include_location: bool, +} +/// Describe partition response sent from server to client. +/// If topic is not existed then response status will be "SCHEME_ERROR". +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribePartitionResponse { + /// Result of request will be inside operation. + #[prost(message, optional, tag = "1")] + pub operation: ::core::option::Option, +} +/// Describe partition result message that will be inside DescribeTopicResponse.operation. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribePartitionResult { + /// Partitions description. + #[prost(message, optional, tag = "1")] + pub partition: ::core::option::Option, +} +/// Describe topic's consumer request sent from client to server. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribeConsumerRequest { + #[prost(message, optional, tag = "1")] + pub operation_params: ::core::option::Option, + /// Topic path. + #[prost(string, tag = "2")] + pub path: ::prost::alloc::string::String, + /// Consumer name; + #[prost(string, tag = "3")] + pub consumer: ::prost::alloc::string::String, + /// Include consumer statistics. + #[prost(bool, tag = "4")] + pub include_stats: bool, + /// Include partition location. + #[prost(bool, tag = "5")] + pub include_location: bool, +} +/// Describe topic's consumer response sent from server to client. +/// If topic is not existed then response status will be "SCHEME_ERROR". +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribeConsumerResponse { + /// Result of request will be inside operation. + #[prost(message, optional, tag = "1")] + pub operation: ::core::option::Option, +} +/// Describe topic's consumer result message that will be inside DescribeConsumerResponse.operation. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DescribeConsumerResult { + /// Description of scheme object. + #[prost(message, optional, tag = "1")] + pub self_: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub consumer: ::core::option::Option, + #[prost(message, repeated, tag = "3")] + pub partitions: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `DescribeConsumerResult`. +pub mod describe_consumer_result { + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct PartitionInfo { + /// Partition identifier. + #[prost(int64, tag = "1")] + pub partition_id: i64, + /// Is partition open for write. + #[prost(bool, tag = "2")] + pub active: bool, + /// Ids of partitions which was formed when this partition was split or merged. + #[prost(int64, repeated, tag = "3")] + pub child_partition_ids: ::prost::alloc::vec::Vec, + /// Ids of partitions from which this partition was formed by split or merge. + #[prost(int64, repeated, tag = "4")] + pub parent_partition_ids: ::prost::alloc::vec::Vec, + /// Stats for partition, filled only when include_stats in request is true. + #[prost(message, optional, tag = "5")] + pub partition_stats: ::core::option::Option, + /// Stats for consumer of this partition, filled only when include_stats in request is true. + #[prost(message, optional, tag = "6")] + pub partition_consumer_stats: ::core::option::Option, + /// Partition location, filled only when include_location in request is true. + #[prost(message, optional, tag = "7")] + pub partition_location: ::core::option::Option, } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Clone, PartialEq, ::prost::Message)] + pub struct PartitionConsumerStats { + /// Last read offset from this partition. + #[prost(int64, tag = "1")] + pub last_read_offset: i64, + /// Committed offset for this partition. + #[prost(int64, tag = "2")] + pub committed_offset: i64, + /// Reading this partition read session identifier. + #[prost(string, tag = "3")] + pub read_session_id: ::prost::alloc::string::String, + /// Timestamp of providing this partition to this session by server. + #[prost(message, optional, tag = "4")] + pub partition_read_session_create_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// Timestamp of last read from this partition. + #[prost(message, optional, tag = "5")] + pub last_read_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, + /// Maximum of differences between timestamp of read and write timestamp for all messages, read during last minute. + #[prost(message, optional, tag = "6")] + pub max_read_time_lag: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// Maximum of differences between write timestamp and create timestamp for all messages, read during last minute. + #[prost(message, optional, tag = "7")] + pub max_write_time_lag: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// How much bytes were read during several windows statistics from this partition. + #[prost(message, optional, tag = "8")] + pub bytes_read: ::core::option::Option, + /// Read session name, provided by client. + #[prost(string, tag = "11")] + pub reader_name: ::prost::alloc::string::String, + /// Host where read session connected. + #[prost(int32, tag = "12")] + pub connection_node_id: i32, + } +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PartitionStats { + /// Partition contains messages with offsets in range [start, end). + #[prost(message, optional, tag = "1")] + pub partition_offsets: ::core::option::Option, + /// Approximate size of partition. + #[prost(int64, tag = "2")] + pub store_size_bytes: i64, + /// Timestamp of last write. + #[prost(message, optional, tag = "3")] + pub last_write_time: ::core::option::Option< + super::super::google::protobuf::Timestamp, + >, + /// Maximum of differences between write timestamp and create timestamp for all messages, written during last minute. + #[prost(message, optional, tag = "4")] + pub max_write_time_lag: ::core::option::Option< + super::super::google::protobuf::Duration, + >, + /// How much bytes were written during several windows in this partition. + #[prost(message, optional, tag = "5")] + pub bytes_written: ::core::option::Option, + /// Partition host. Useful for debugging purposes. + /// Use PartitionLocation + #[deprecated] + #[prost(int32, tag = "8")] + pub partition_node_id: i32, } /// Update existing topic request sent from client to server. #[derive(serde::Serialize, serde::Deserialize)] @@ -964,6 +1542,7 @@ pub struct AlterTopicRequest { pub set_retention_storage_mb: ::core::option::Option, /// List of allowed codecs for writers. /// Writes with codec not from this list are forbidden. + /// If empty, codec compatibility check for the topic is disabled. #[prost(message, optional, tag = "7")] pub set_supported_codecs: ::core::option::Option, /// Partition write speed in bytes per second. Must be less than database limit. Default limit - 1 MB/s. diff --git a/ydb-grpc/src/generated/ydb.topic.v1.rs b/ydb-grpc/src/generated/ydb.topic.v1.rs index dcb14499..ebfa6805 100644 --- a/ydb-grpc/src/generated/ydb.topic.v1.rs +++ b/ydb-grpc/src/generated/ydb.topic.v1.rs @@ -174,6 +174,51 @@ pub mod topic_service_client { ); self.inner.streaming(request.into_streaming_request(), path, codec).await } + /// Single commit offset request. + pub async fn commit_offset( + &mut self, + request: impl tonic::IntoRequest, + ) -> 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( + "/Ydb.Topic.V1.TopicService/CommitOffset", + ); + self.inner.unary(request.into_request(), path, codec).await + } + /// Add information about offset ranges to the transaction. + pub async fn update_offsets_in_transaction( + &mut self, + request: impl tonic::IntoRequest< + super::super::UpdateOffsetsInTransactionRequest, + >, + ) -> 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( + "/Ydb.Topic.V1.TopicService/UpdateOffsetsInTransaction", + ); + self.inner.unary(request.into_request(), path, codec).await + } /// Create topic command. pub async fn create_topic( &mut self, @@ -217,6 +262,29 @@ pub mod topic_service_client { ); self.inner.unary(request.into_request(), path, codec).await } + /// Describe topic's consumer command. + pub async fn describe_consumer( + &mut self, + request: impl tonic::IntoRequest, + ) -> 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( + "/Ydb.Topic.V1.TopicService/DescribeConsumer", + ); + self.inner.unary(request.into_request(), path, codec).await + } /// Alter topic command. pub async fn alter_topic( &mut self, diff --git a/ydb-grpc/ydb-api-protos b/ydb-grpc/ydb-api-protos index 07b827b8..3490f62e 160000 --- a/ydb-grpc/ydb-api-protos +++ b/ydb-grpc/ydb-api-protos @@ -1 +1 @@ -Subproject commit 07b827b89f426c8b8ec0d14ede78db1cb1c540a6 +Subproject commit 3490f62eb05039bc1f881bfda62030edc17784d7 diff --git a/ydb/Cargo.toml b/ydb/Cargo.toml index 70d52d0e..0a863819 100644 --- a/ydb/Cargo.toml +++ b/ydb/Cargo.toml @@ -1,7 +1,7 @@ [package] publish = true name = "ydb" -version = "0.9.2" +version = "0.9.3" authors = ["rekby "] edition = "2021" license = "Apache-2.0" @@ -53,7 +53,7 @@ tonic = { version = "0.8.1", features = ["tls"] } tower = "0.4" url = "2.2" uuid = { version = "1", features = ["v4"] } -ydb-grpc = { version = "0.0.14", path = "../ydb-grpc" } +ydb-grpc = { version = "0.1.0", path="../ydb-grpc"} [dev-dependencies] async_once = "0.2" diff --git a/ydb/src/client_scheme/list_types.rs b/ydb/src/client_scheme/list_types.rs index def3679a..226eea5d 100644 --- a/ydb/src/client_scheme/list_types.rs +++ b/ydb/src/client_scheme/list_types.rs @@ -15,6 +15,8 @@ pub enum SchemeEntryType { Unspecified, Directory, Table, + ColumnStrore, + ColumnTable, PersQueueGroup, Database, RtmrVolume, @@ -23,6 +25,9 @@ pub enum SchemeEntryType { Sequence, Replication, Topic, + ExternalDataSource, + ExternalTable, + View, Unknown(i32), } diff --git a/ydb/src/client_table_test_integration.rs b/ydb/src/client_table_test_integration.rs index 7ba4bdce..1395768c 100644 --- a/ydb/src/client_table_test_integration.rs +++ b/ydb/src/client_table_test_integration.rs @@ -653,6 +653,66 @@ SELECT CAST(NULL AS Optional) Ok(()) } +#[tokio::test] +#[traced_test] +#[ignore] // need YDB access +async fn select_with_u8_param() -> YdbResult<()> { + let client = create_client().await?; + let mut transaction = client + .table_client() + .create_autocommit_transaction(Mode::OnlineReadonly); + let res = transaction.query( + Query::from(r#" + DECLARE $val AS Uint8; + SELECT $val as s + "#).with_params(ydb_params!( + "$val" => 99u8 + ))) + .await?; + trace!("result: {:?}", &res); + assert_eq!( + Value::Uint8(99u8), + res.into_only_result() + .unwrap() + .rows() + .next() + .unwrap() + .remove_field_by_name("s") + .unwrap() + ); + Ok(()) +} + +#[tokio::test] +#[traced_test] +#[ignore] // need YDB access +async fn select_with_u16_param() -> YdbResult<()> { + let client = create_client().await?; + let mut transaction = client + .table_client() + .create_autocommit_transaction(Mode::OnlineReadonly); + let res = transaction.query( + Query::from(r#" + DECLARE $val AS Uint16; + SELECT $val as s + "#).with_params(ydb_params!( + "$val" => 34111u16 + ))) + .await?; + trace!("result: {:?}", &res); + assert_eq!( + Value::Uint16(34111u16), + res.into_only_result() + .unwrap() + .rows() + .next() + .unwrap() + .remove_field_by_name("s") + .unwrap() + ); + Ok(()) +} + #[tokio::test] #[traced_test] #[ignore] // need YDB access diff --git a/ydb/src/client_topic/topicwriter/message_write_status.rs b/ydb/src/client_topic/topicwriter/message_write_status.rs index 71523b51..e6f6046d 100644 --- a/ydb/src/client_topic/topicwriter/message_write_status.rs +++ b/ydb/src/client_topic/topicwriter/message_write_status.rs @@ -12,10 +12,14 @@ pub enum MessageSkipReason { UnknownReasonCode(i32), } +#[cfg_attr(not(feature = "force-exhaustive-all"), non_exhaustive)] +pub struct MessageWriteInTxInfo {} + #[cfg_attr(not(feature = "force-exhaustive-all"), non_exhaustive)] pub enum MessageWriteStatus { Written(MessageWriteInfo), Skipped(MessageSkipReason), + WrittenInTx(MessageWriteInTxInfo), Unknown, } @@ -48,6 +52,9 @@ impl From> for MessageWrit Some(write_response::write_ack::MessageWriteStatus::Skipped(skip_info)) => { MessageWriteStatus::Skipped(MessageSkipReason::from(skip_info.reason)) } + Some(write_response::write_ack::MessageWriteStatus::WrittenInTx(_write_info)) => { + MessageWriteStatus::WrittenInTx(MessageWriteInTxInfo{}) + } } } } diff --git a/ydb/src/client_topic/topicwriter/writer.rs b/ydb/src/client_topic/topicwriter/writer.rs index 676a7883..fcf7e341 100644 --- a/ydb/src/client_topic/topicwriter/writer.rs +++ b/ydb/src/client_topic/topicwriter/writer.rs @@ -245,6 +245,7 @@ impl TopicWriter { as i64, nanos: message.created_at.duration_since(UNIX_EPOCH)?.as_nanos() as i32, }), + metadata_items: vec![], data: message.data, uncompressed_size: data_size, partitioning: Some(message_data::Partitioning::MessageGroupId( @@ -270,6 +271,7 @@ impl TopicWriter { client_message: Some(ClientMessage::WriteRequest(WriteRequest { messages, codec: 1, + tx: None, })), }) .unwrap(); // TODO: HANDLE ERROR diff --git a/ydb/src/grpc_wrapper/raw_scheme_client/list_directory_types.rs b/ydb/src/grpc_wrapper/raw_scheme_client/list_directory_types.rs index 03b784e6..f7f66750 100644 --- a/ydb/src/grpc_wrapper/raw_scheme_client/list_directory_types.rs +++ b/ydb/src/grpc_wrapper/raw_scheme_client/list_directory_types.rs @@ -73,6 +73,8 @@ fn from_grpc_code_to_scheme_entry_type(value: i32) -> SchemeEntryType { Some(grpcT::Unspecified) => SchemeEntryType::Unspecified, Some(grpcT::Directory) => SchemeEntryType::Directory, Some(grpcT::Table) => SchemeEntryType::Table, + Some(grpcT::ColumnStore) => SchemeEntryType::ColumnStrore, + Some(grpcT::ColumnTable) => SchemeEntryType::ColumnTable, Some(grpcT::PersQueueGroup) => SchemeEntryType::PersQueueGroup, Some(grpcT::Database) => SchemeEntryType::Database, Some(grpcT::RtmrVolume) => SchemeEntryType::RtmrVolume, @@ -81,6 +83,9 @@ fn from_grpc_code_to_scheme_entry_type(value: i32) -> SchemeEntryType { Some(grpcT::Sequence) => SchemeEntryType::Sequence, Some(grpcT::Replication) => SchemeEntryType::Replication, Some(grpcT::Topic) => SchemeEntryType::Topic, + Some(grpcT::ExternalDataSource) => SchemeEntryType::ExternalDataSource, + Some(grpcT::ExternalTable) => SchemeEntryType::ExternalTable, + Some(grpcT::View) => SchemeEntryType::View, None => SchemeEntryType::Unknown(value), } } diff --git a/ydb/src/grpc_wrapper/raw_table_service/value/type.rs b/ydb/src/grpc_wrapper/raw_table_service/value/type.rs index aa8711b0..ef10c2bd 100644 --- a/ydb/src/grpc_wrapper/raw_table_service/value/type.rs +++ b/ydb/src/grpc_wrapper/raw_table_service/value/type.rs @@ -280,6 +280,9 @@ impl TryFrom for RawType { item_type: RawType::try_from(*t)?, })) } + ProtoType::PgType(_pg_type) => { + return decode_err("pg type unimplemented yet"); + } ProtoType::VoidType(_) => RawType::Void, ProtoType::NullType(_) => RawType::Null, ProtoType::EmptyListType(_) => RawType::EmptyList, diff --git a/ydb/src/grpc_wrapper/raw_table_service/value/value_ydb.rs b/ydb/src/grpc_wrapper/raw_table_service/value/value_ydb.rs index 7749ad33..5fe90954 100644 --- a/ydb/src/grpc_wrapper/raw_table_service/value/value_ydb.rs +++ b/ydb/src/grpc_wrapper/raw_table_service/value/value_ydb.rs @@ -35,7 +35,7 @@ impl TryFrom for RawTypedValue { }, Value::Uint8(v) => RawTypedValue { r#type: RawType::Uint8, - value: RawValue::Int32(v as i32), + value: RawValue::UInt32(v as u32), }, Value::Int16(v) => RawTypedValue { r#type: RawType::Int16, @@ -43,7 +43,7 @@ impl TryFrom for RawTypedValue { }, Value::Uint16(v) => RawTypedValue { r#type: RawType::Uint16, - value: RawValue::Int32(v as i32), + value: RawValue::UInt32(v as u32), }, Value::Int32(v) => RawTypedValue { r#type: RawType::Int32, @@ -201,11 +201,11 @@ impl TryFrom for Value { (t @ RawType::Bool, v) => return types_mismatch(t, v), (RawType::Int8, RawValue::Int32(v)) => Value::Int8(v.try_into()?), (t @ RawType::Int8, v) => return types_mismatch(t, v), - (RawType::Uint8, RawValue::Int32(v)) => Value::Uint8(v.try_into()?), + (RawType::Uint8, RawValue::UInt32(v)) => Value::Uint8(v.try_into()?), (t @ RawType::Uint8, v) => return types_mismatch(t, v), (RawType::Int16, RawValue::Int32(v)) => Value::Int16(v.try_into()?), (t @ RawType::Int16, v) => return types_mismatch(t, v), - (RawType::Uint16, RawValue::Int32(v)) => Value::Uint16(v.try_into()?), + (RawType::Uint16, RawValue::UInt32(v)) => Value::Uint16(v.try_into()?), (t @ RawType::Uint16, v) => return types_mismatch(t, v), (RawType::Int32, RawValue::Int32(v)) => Value::Int32(v), (t @ RawType::Int32, v) => return types_mismatch(t, v), diff --git a/ydb/src/grpc_wrapper/raw_topic_service/common/consumer.rs b/ydb/src/grpc_wrapper/raw_topic_service/common/consumer.rs index 88afd9ed..a6c7180f 100644 --- a/ydb/src/grpc_wrapper/raw_topic_service/common/consumer.rs +++ b/ydb/src/grpc_wrapper/raw_topic_service/common/consumer.rs @@ -35,6 +35,7 @@ impl From for Consumer { read_from, supported_codecs: Some(SupportedCodecs::from(value.supported_codecs)), attributes: value.attributes, + consumer_stats: None, } } }