Skip to main content

greptime_proto/generated/
greptime.v1.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// This file is @generated by prost-build.
16#[derive(Clone, PartialEq, ::prost::Message)]
17pub struct QueryContext {
18    #[prost(string, tag = "1")]
19    pub current_catalog: ::prost::alloc::string::String,
20    #[prost(string, tag = "2")]
21    pub current_schema: ::prost::alloc::string::String,
22    #[prost(string, tag = "4")]
23    pub timezone: ::prost::alloc::string::String,
24    #[prost(map = "string, string", tag = "5")]
25    pub extensions: ::std::collections::HashMap<
26        ::prost::alloc::string::String,
27        ::prost::alloc::string::String,
28    >,
29    #[prost(uint32, tag = "6")]
30    pub channel: u32,
31    #[prost(message, optional, tag = "7")]
32    pub snapshot_seqs: ::core::option::Option<SnapshotSequences>,
33    /// Explain options for the query.
34    #[prost(message, optional, tag = "8")]
35    pub explain: ::core::option::Option<ExplainOptions>,
36}
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct SnapshotSequences {
39    /// Mappings of the RegionId to the minimal sequence of SST file to scan.
40    #[prost(map = "uint64, uint64", tag = "1")]
41    pub sst_min_sequences: ::std::collections::HashMap<u64, u64>,
42    /// mapping of RegionId to SequenceNumber, for snapshot read, meaning that the
43    /// read should only container data that was committed before (and include) the
44    /// given sequence number
45    #[prost(map = "uint64, uint64", tag = "7")]
46    pub snapshot_seqs: ::std::collections::HashMap<u64, u64>,
47}
48#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
49pub struct ExplainOptions {
50    /// Whether to enable verbose explain output.
51    #[prost(bool, tag = "1")]
52    pub verbose: bool,
53}
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct RequestHeader {
56    /// The `catalog` that is selected to be used in this request.
57    #[prost(string, tag = "1")]
58    pub catalog: ::prost::alloc::string::String,
59    /// The `schema` that is selected to be used in this request.
60    #[prost(string, tag = "2")]
61    pub schema: ::prost::alloc::string::String,
62    /// The `authorization` header, much like http's authorization header.
63    #[prost(message, optional, tag = "3")]
64    pub authorization: ::core::option::Option<AuthHeader>,
65    /// The `dbname` for the request
66    #[prost(string, tag = "4")]
67    pub dbname: ::prost::alloc::string::String,
68    /// Encoded trace_id & span_id, follow the w3c Trace Context
69    /// <https://www.w3.org/TR/trace-context/#header-name>
70    #[prost(map = "string, string", tag = "5")]
71    pub tracing_context: ::std::collections::HashMap<
72        ::prost::alloc::string::String,
73        ::prost::alloc::string::String,
74    >,
75    /// The `timezone` for the request
76    #[prost(string, tag = "6")]
77    pub timezone: ::prost::alloc::string::String,
78}
79#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
80pub struct ResponseHeader {
81    #[prost(message, optional, tag = "1")]
82    pub status: ::core::option::Option<Status>,
83}
84#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
85pub struct Status {
86    /// Corresponding to the `StatusCode` definition of GreptimeDB
87    #[prost(uint32, tag = "1")]
88    pub status_code: u32,
89    #[prost(string, tag = "2")]
90    pub err_msg: ::prost::alloc::string::String,
91}
92#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
93pub struct AuthHeader {
94    #[prost(oneof = "auth_header::AuthScheme", tags = "1, 2")]
95    pub auth_scheme: ::core::option::Option<auth_header::AuthScheme>,
96}
97/// Nested message and enum types in `AuthHeader`.
98pub mod auth_header {
99    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
100    pub enum AuthScheme {
101        #[prost(message, tag = "1")]
102        Basic(super::Basic),
103        #[prost(message, tag = "2")]
104        Token(super::Token),
105    }
106}
107#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
108pub struct Basic {
109    #[prost(string, tag = "1")]
110    pub username: ::prost::alloc::string::String,
111    #[prost(string, tag = "2")]
112    pub password: ::prost::alloc::string::String,
113}
114#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
115pub struct Token {
116    #[prost(string, tag = "1")]
117    pub token: ::prost::alloc::string::String,
118}
119#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
120pub struct TableName {
121    #[prost(string, tag = "1")]
122    pub catalog_name: ::prost::alloc::string::String,
123    #[prost(string, tag = "2")]
124    pub schema_name: ::prost::alloc::string::String,
125    #[prost(string, tag = "3")]
126    pub table_name: ::prost::alloc::string::String,
127}
128#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
129pub struct AffectedRows {
130    #[prost(uint32, tag = "1")]
131    pub value: u32,
132}
133#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
134pub struct Metrics {
135    #[prost(bytes = "vec", tag = "1")]
136    pub metrics: ::prost::alloc::vec::Vec<u8>,
137}
138#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
139pub struct ExpireAfter {
140    #[prost(int64, tag = "1")]
141    pub value: i64,
142}
143/// Eval Interval in seconds
144#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
145pub struct EvalInterval {
146    #[prost(int64, tag = "1")]
147    pub seconds: i64,
148}
149#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
150pub struct FlightMetadata {
151    #[prost(message, optional, tag = "1")]
152    pub affected_rows: ::core::option::Option<AffectedRows>,
153    #[prost(message, optional, tag = "2")]
154    pub metrics: ::core::option::Option<Metrics>,
155}
156#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
157pub struct IntervalMonthDayNano {
158    #[prost(int32, tag = "1")]
159    pub months: i32,
160    #[prost(int32, tag = "2")]
161    pub days: i32,
162    #[prost(int64, tag = "3")]
163    pub nanoseconds: i64,
164}
165#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
166pub struct TimeRange {
167    #[prost(int64, tag = "1")]
168    pub start: i64,
169    #[prost(int64, tag = "2")]
170    pub end: i64,
171}
172/// / Truncate partially by time ranges
173#[derive(Clone, PartialEq, ::prost::Message)]
174pub struct TimeRanges {
175    #[prost(enumeration = "TimeUnit", tag = "1")]
176    pub time_unit: i32,
177    #[prost(message, repeated, tag = "2")]
178    pub time_ranges: ::prost::alloc::vec::Vec<TimeRange>,
179}
180/// (hi: high 64 bits, lo: low 64 bits) are used to keep the decimal128 value.
181#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
182pub struct Decimal128 {
183    #[prost(int64, tag = "1")]
184    pub hi: i64,
185    #[prost(int64, tag = "2")]
186    pub lo: i64,
187}
188#[derive(Clone, PartialEq, ::prost::Message)]
189pub struct StructField {
190    #[prost(string, tag = "1")]
191    pub name: ::prost::alloc::string::String,
192    #[prost(enumeration = "ColumnDataType", tag = "2")]
193    pub datatype: i32,
194    #[prost(message, optional, tag = "3")]
195    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
196}
197/// Type extension for some complex types
198#[derive(Clone, PartialEq, ::prost::Message)]
199pub struct ColumnDataTypeExtension {
200    #[prost(oneof = "column_data_type_extension::TypeExt", tags = "1, 2, 3, 4, 5, 6, 7")]
201    pub type_ext: ::core::option::Option<column_data_type_extension::TypeExt>,
202}
203/// Nested message and enum types in `ColumnDataTypeExtension`.
204pub mod column_data_type_extension {
205    #[derive(Clone, PartialEq, ::prost::Oneof)]
206    pub enum TypeExt {
207        #[prost(message, tag = "1")]
208        DecimalType(super::DecimalTypeExtension),
209        /// Marks the binary column in proto is actually a JSON column.
210        /// Deprecated
211        #[prost(enumeration = "super::JsonTypeExtension", tag = "2")]
212        JsonType(i32),
213        #[prost(message, tag = "3")]
214        VectorType(super::VectorTypeExtension),
215        #[prost(message, tag = "4")]
216        ListType(::prost::alloc::boxed::Box<super::ListTypeExtension>),
217        #[prost(message, tag = "5")]
218        StructType(super::StructTypeExtension),
219        /// Marks the data type is a logical json data
220        #[prost(message, tag = "6")]
221        JsonNativeType(::prost::alloc::boxed::Box<super::JsonNativeTypeExtension>),
222        #[prost(message, tag = "7")]
223        DictionaryType(::prost::alloc::boxed::Box<super::DictionaryTypeExtension>),
224    }
225}
226#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
227pub struct DecimalTypeExtension {
228    #[prost(int32, tag = "1")]
229    pub precision: i32,
230    #[prost(int32, tag = "2")]
231    pub scale: i32,
232}
233#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
234pub struct VectorTypeExtension {
235    #[prost(uint32, tag = "1")]
236    pub dim: u32,
237}
238#[derive(Clone, PartialEq, ::prost::Message)]
239pub struct ListTypeExtension {
240    #[prost(enumeration = "ColumnDataType", tag = "1")]
241    pub datatype: i32,
242    #[prost(message, optional, boxed, tag = "2")]
243    pub datatype_extension: ::core::option::Option<
244        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
245    >,
246}
247#[derive(Clone, PartialEq, ::prost::Message)]
248pub struct StructTypeExtension {
249    #[prost(message, repeated, tag = "1")]
250    pub fields: ::prost::alloc::vec::Vec<StructField>,
251}
252#[derive(Clone, PartialEq, ::prost::Message)]
253pub struct JsonNativeTypeExtension {
254    #[prost(enumeration = "ColumnDataType", tag = "1")]
255    pub datatype: i32,
256    #[prost(message, optional, boxed, tag = "2")]
257    pub datatype_extension: ::core::option::Option<
258        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
259    >,
260}
261#[derive(Clone, PartialEq, ::prost::Message)]
262pub struct DictionaryTypeExtension {
263    #[prost(enumeration = "ColumnDataType", tag = "1")]
264    pub key_datatype: i32,
265    #[prost(message, optional, boxed, tag = "2")]
266    pub key_datatype_extension: ::core::option::Option<
267        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
268    >,
269    #[prost(enumeration = "ColumnDataType", tag = "3")]
270    pub value_datatype: i32,
271    #[prost(message, optional, boxed, tag = "4")]
272    pub value_datatype_extension: ::core::option::Option<
273        ::prost::alloc::boxed::Box<ColumnDataTypeExtension>,
274    >,
275}
276/// Additional options for the column.
277#[derive(Clone, PartialEq, ::prost::Message)]
278pub struct ColumnOptions {
279    /// Supported keys:
280    /// "fulltext":
281    /// A JSON encoded string containing full-text search options for the column.
282    ///
283    /// ```text
284    ///   The fulltext options JSON structure:
285    ///   {
286    ///     "enable": bool,          // Indicates whether full-text search is
287    ///                              // enabled for the column.
288    ///
289    ///     "analyzer": string,      // The language-specific text analyzer to
290    ///                              // use for indexing and searching text.
291    ///                              // Supported values: \["English" (Default), "Chinese"\].
292    ///
293    ///     "case-sensitive": bool   // Indicates whether the text should be treated
294    ///                              // as case-sensitive during full-text search.
295    ///   }
296    ///
297    ///   Example:
298    ///   "fulltext": "{\"enable\": true, \"analyzer\": \"English\", \"case-sensitive\": false}"
299    /// ```
300    #[prost(map = "string, string", tag = "1")]
301    pub options: ::std::collections::HashMap<
302        ::prost::alloc::string::String,
303        ::prost::alloc::string::String,
304    >,
305}
306#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
307pub struct ArrowIpc {
308    #[prost(bytes = "bytes", tag = "1")]
309    pub schema: ::prost::bytes::Bytes,
310    #[prost(bytes = "bytes", tag = "2")]
311    pub data_header: ::prost::bytes::Bytes,
312    #[prost(bytes = "bytes", tag = "3")]
313    pub payload: ::prost::bytes::Bytes,
314}
315#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
316pub struct PartitionExprVersion {
317    #[prost(uint64, tag = "1")]
318    pub value: u64,
319}
320#[derive(::serde::Serialize, ::serde::Deserialize)]
321#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
322#[repr(i32)]
323pub enum SemanticType {
324    Tag = 0,
325    Field = 1,
326    Timestamp = 2,
327}
328impl SemanticType {
329    /// String value of the enum field names used in the ProtoBuf definition.
330    ///
331    /// The values are not transformed in any way and thus are considered stable
332    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
333    pub fn as_str_name(&self) -> &'static str {
334        match self {
335            Self::Tag => "TAG",
336            Self::Field => "FIELD",
337            Self::Timestamp => "TIMESTAMP",
338        }
339    }
340    /// Creates an enum from field names used in the ProtoBuf definition.
341    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
342        match value {
343            "TAG" => Some(Self::Tag),
344            "FIELD" => Some(Self::Field),
345            "TIMESTAMP" => Some(Self::Timestamp),
346            _ => None,
347        }
348    }
349}
350#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
351#[repr(i32)]
352pub enum ColumnDataType {
353    Boolean = 0,
354    Int8 = 1,
355    Int16 = 2,
356    Int32 = 3,
357    Int64 = 4,
358    Uint8 = 5,
359    Uint16 = 6,
360    Uint32 = 7,
361    Uint64 = 8,
362    Float32 = 9,
363    Float64 = 10,
364    Binary = 11,
365    String = 12,
366    Date = 13,
367    Datetime = 14,
368    TimestampSecond = 15,
369    TimestampMillisecond = 16,
370    TimestampMicrosecond = 17,
371    TimestampNanosecond = 18,
372    TimeSecond = 19,
373    TimeMillisecond = 20,
374    TimeMicrosecond = 21,
375    TimeNanosecond = 22,
376    IntervalYearMonth = 23,
377    IntervalDayTime = 24,
378    IntervalMonthDayNano = 25,
379    Decimal128 = 30,
380    Json = 31,
381    Vector = 32,
382    List = 40,
383    Struct = 41,
384    Dictionary = 42,
385}
386impl ColumnDataType {
387    /// String value of the enum field names used in the ProtoBuf definition.
388    ///
389    /// The values are not transformed in any way and thus are considered stable
390    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
391    pub fn as_str_name(&self) -> &'static str {
392        match self {
393            Self::Boolean => "BOOLEAN",
394            Self::Int8 => "INT8",
395            Self::Int16 => "INT16",
396            Self::Int32 => "INT32",
397            Self::Int64 => "INT64",
398            Self::Uint8 => "UINT8",
399            Self::Uint16 => "UINT16",
400            Self::Uint32 => "UINT32",
401            Self::Uint64 => "UINT64",
402            Self::Float32 => "FLOAT32",
403            Self::Float64 => "FLOAT64",
404            Self::Binary => "BINARY",
405            Self::String => "STRING",
406            Self::Date => "DATE",
407            Self::Datetime => "DATETIME",
408            Self::TimestampSecond => "TIMESTAMP_SECOND",
409            Self::TimestampMillisecond => "TIMESTAMP_MILLISECOND",
410            Self::TimestampMicrosecond => "TIMESTAMP_MICROSECOND",
411            Self::TimestampNanosecond => "TIMESTAMP_NANOSECOND",
412            Self::TimeSecond => "TIME_SECOND",
413            Self::TimeMillisecond => "TIME_MILLISECOND",
414            Self::TimeMicrosecond => "TIME_MICROSECOND",
415            Self::TimeNanosecond => "TIME_NANOSECOND",
416            Self::IntervalYearMonth => "INTERVAL_YEAR_MONTH",
417            Self::IntervalDayTime => "INTERVAL_DAY_TIME",
418            Self::IntervalMonthDayNano => "INTERVAL_MONTH_DAY_NANO",
419            Self::Decimal128 => "DECIMAL128",
420            Self::Json => "JSON",
421            Self::Vector => "VECTOR",
422            Self::List => "LIST",
423            Self::Struct => "STRUCT",
424            Self::Dictionary => "DICTIONARY",
425        }
426    }
427    /// Creates an enum from field names used in the ProtoBuf definition.
428    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
429        match value {
430            "BOOLEAN" => Some(Self::Boolean),
431            "INT8" => Some(Self::Int8),
432            "INT16" => Some(Self::Int16),
433            "INT32" => Some(Self::Int32),
434            "INT64" => Some(Self::Int64),
435            "UINT8" => Some(Self::Uint8),
436            "UINT16" => Some(Self::Uint16),
437            "UINT32" => Some(Self::Uint32),
438            "UINT64" => Some(Self::Uint64),
439            "FLOAT32" => Some(Self::Float32),
440            "FLOAT64" => Some(Self::Float64),
441            "BINARY" => Some(Self::Binary),
442            "STRING" => Some(Self::String),
443            "DATE" => Some(Self::Date),
444            "DATETIME" => Some(Self::Datetime),
445            "TIMESTAMP_SECOND" => Some(Self::TimestampSecond),
446            "TIMESTAMP_MILLISECOND" => Some(Self::TimestampMillisecond),
447            "TIMESTAMP_MICROSECOND" => Some(Self::TimestampMicrosecond),
448            "TIMESTAMP_NANOSECOND" => Some(Self::TimestampNanosecond),
449            "TIME_SECOND" => Some(Self::TimeSecond),
450            "TIME_MILLISECOND" => Some(Self::TimeMillisecond),
451            "TIME_MICROSECOND" => Some(Self::TimeMicrosecond),
452            "TIME_NANOSECOND" => Some(Self::TimeNanosecond),
453            "INTERVAL_YEAR_MONTH" => Some(Self::IntervalYearMonth),
454            "INTERVAL_DAY_TIME" => Some(Self::IntervalDayTime),
455            "INTERVAL_MONTH_DAY_NANO" => Some(Self::IntervalMonthDayNano),
456            "DECIMAL128" => Some(Self::Decimal128),
457            "JSON" => Some(Self::Json),
458            "VECTOR" => Some(Self::Vector),
459            "LIST" => Some(Self::List),
460            "STRUCT" => Some(Self::Struct),
461            "DICTIONARY" => Some(Self::Dictionary),
462            _ => None,
463        }
464    }
465}
466/// / Time Unit for timestamp
467#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
468#[repr(i32)]
469pub enum TimeUnit {
470    /// The default time unit is MILLISECOND
471    Millisecond = 0,
472    Second = 1,
473    Microsecond = 2,
474    Nanosecond = 3,
475}
476impl TimeUnit {
477    /// String value of the enum field names used in the ProtoBuf definition.
478    ///
479    /// The values are not transformed in any way and thus are considered stable
480    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
481    pub fn as_str_name(&self) -> &'static str {
482        match self {
483            Self::Millisecond => "MILLISECOND",
484            Self::Second => "SECOND",
485            Self::Microsecond => "MICROSECOND",
486            Self::Nanosecond => "NANOSECOND",
487        }
488    }
489    /// Creates an enum from field names used in the ProtoBuf definition.
490    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
491        match value {
492            "MILLISECOND" => Some(Self::Millisecond),
493            "SECOND" => Some(Self::Second),
494            "MICROSECOND" => Some(Self::Microsecond),
495            "NANOSECOND" => Some(Self::Nanosecond),
496            _ => None,
497        }
498    }
499}
500/// Deprecated
501#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
502#[repr(i32)]
503pub enum JsonTypeExtension {
504    JsonBinary = 0,
505}
506impl JsonTypeExtension {
507    /// String value of the enum field names used in the ProtoBuf definition.
508    ///
509    /// The values are not transformed in any way and thus are considered stable
510    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
511    pub fn as_str_name(&self) -> &'static str {
512        match self {
513            Self::JsonBinary => "JSON_BINARY",
514        }
515    }
516    /// Creates an enum from field names used in the ProtoBuf definition.
517    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
518        match value {
519            "JSON_BINARY" => Some(Self::JsonBinary),
520            _ => None,
521        }
522    }
523}
524#[derive(Clone, PartialEq, ::prost::Message)]
525pub struct Rows {
526    #[prost(message, repeated, tag = "1")]
527    pub schema: ::prost::alloc::vec::Vec<ColumnSchema>,
528    #[prost(message, repeated, tag = "2")]
529    pub rows: ::prost::alloc::vec::Vec<Row>,
530}
531#[derive(Clone, PartialEq, ::prost::Message)]
532pub struct ColumnSchema {
533    #[prost(string, tag = "1")]
534    pub column_name: ::prost::alloc::string::String,
535    #[prost(enumeration = "ColumnDataType", tag = "2")]
536    pub datatype: i32,
537    #[prost(enumeration = "SemanticType", tag = "3")]
538    pub semantic_type: i32,
539    /// Extension for ColumnDataType.
540    #[prost(message, optional, tag = "4")]
541    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
542    /// Additional column options.
543    #[prost(message, optional, tag = "5")]
544    pub options: ::core::option::Option<ColumnOptions>,
545}
546#[derive(Clone, PartialEq, ::prost::Message)]
547pub struct Row {
548    #[prost(message, repeated, tag = "1")]
549    pub values: ::prost::alloc::vec::Vec<Value>,
550}
551#[derive(Clone, PartialEq, ::prost::Message)]
552pub struct Value {
553    #[prost(
554        oneof = "value::ValueData",
555        tags = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 31, 40, 41, 42"
556    )]
557    pub value_data: ::core::option::Option<value::ValueData>,
558}
559/// Nested message and enum types in `Value`.
560pub mod value {
561    #[derive(Clone, PartialEq, ::prost::Oneof)]
562    pub enum ValueData {
563        #[prost(int32, tag = "1")]
564        I8Value(i32),
565        #[prost(int32, tag = "2")]
566        I16Value(i32),
567        #[prost(int32, tag = "3")]
568        I32Value(i32),
569        #[prost(int64, tag = "4")]
570        I64Value(i64),
571        #[prost(uint32, tag = "5")]
572        U8Value(u32),
573        #[prost(uint32, tag = "6")]
574        U16Value(u32),
575        #[prost(uint32, tag = "7")]
576        U32Value(u32),
577        #[prost(uint64, tag = "8")]
578        U64Value(u64),
579        #[prost(float, tag = "9")]
580        F32Value(f32),
581        #[prost(double, tag = "10")]
582        F64Value(f64),
583        #[prost(bool, tag = "11")]
584        BoolValue(bool),
585        #[prost(bytes, tag = "12")]
586        BinaryValue(::prost::alloc::vec::Vec<u8>),
587        #[prost(string, tag = "13")]
588        StringValue(::prost::alloc::string::String),
589        #[prost(int32, tag = "14")]
590        DateValue(i32),
591        #[prost(int64, tag = "15")]
592        DatetimeValue(i64),
593        #[prost(int64, tag = "16")]
594        TimestampSecondValue(i64),
595        #[prost(int64, tag = "17")]
596        TimestampMillisecondValue(i64),
597        #[prost(int64, tag = "18")]
598        TimestampMicrosecondValue(i64),
599        #[prost(int64, tag = "19")]
600        TimestampNanosecondValue(i64),
601        #[prost(int64, tag = "20")]
602        TimeSecondValue(i64),
603        #[prost(int64, tag = "21")]
604        TimeMillisecondValue(i64),
605        #[prost(int64, tag = "22")]
606        TimeMicrosecondValue(i64),
607        #[prost(int64, tag = "23")]
608        TimeNanosecondValue(i64),
609        #[prost(int32, tag = "24")]
610        IntervalYearMonthValue(i32),
611        #[prost(int64, tag = "25")]
612        IntervalDayTimeValue(i64),
613        #[prost(message, tag = "26")]
614        IntervalMonthDayNanoValue(super::IntervalMonthDayNano),
615        #[prost(message, tag = "31")]
616        Decimal128Value(super::Decimal128),
617        #[prost(message, tag = "40")]
618        ListValue(super::ListValue),
619        #[prost(message, tag = "41")]
620        StructValue(super::StructValue),
621        #[prost(message, tag = "42")]
622        JsonValue(super::JsonValue),
623    }
624}
625#[derive(Clone, PartialEq, ::prost::Message)]
626pub struct ListValue {
627    #[prost(message, repeated, tag = "1")]
628    pub items: ::prost::alloc::vec::Vec<Value>,
629}
630#[derive(Clone, PartialEq, ::prost::Message)]
631pub struct StructValue {
632    #[prost(message, repeated, tag = "2")]
633    pub items: ::prost::alloc::vec::Vec<Value>,
634}
635#[derive(Clone, PartialEq, ::prost::Message)]
636pub struct JsonValue {
637    #[prost(oneof = "json_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")]
638    pub value: ::core::option::Option<json_value::Value>,
639}
640/// Nested message and enum types in `JsonValue`.
641pub mod json_value {
642    #[derive(Clone, PartialEq, ::prost::Oneof)]
643    pub enum Value {
644        #[prost(bool, tag = "1")]
645        Boolean(bool),
646        #[prost(int64, tag = "2")]
647        Int(i64),
648        #[prost(uint64, tag = "3")]
649        Uint(u64),
650        #[prost(double, tag = "4")]
651        Float(f64),
652        #[prost(string, tag = "5")]
653        Str(::prost::alloc::string::String),
654        #[prost(message, tag = "6")]
655        Array(super::JsonList),
656        #[prost(message, tag = "7")]
657        Object(super::JsonObject),
658    }
659}
660#[derive(Clone, PartialEq, ::prost::Message)]
661pub struct JsonList {
662    #[prost(message, repeated, tag = "1")]
663    pub items: ::prost::alloc::vec::Vec<JsonValue>,
664}
665#[derive(Clone, PartialEq, ::prost::Message)]
666pub struct JsonObject {
667    #[prost(message, repeated, tag = "1")]
668    pub entries: ::prost::alloc::vec::Vec<json_object::Entry>,
669}
670/// Nested message and enum types in `JsonObject`.
671pub mod json_object {
672    #[derive(Clone, PartialEq, ::prost::Message)]
673    pub struct Entry {
674        #[prost(string, tag = "1")]
675        pub key: ::prost::alloc::string::String,
676        #[prost(message, optional, tag = "2")]
677        pub value: ::core::option::Option<super::JsonValue>,
678    }
679}
680#[derive(Clone, PartialEq, ::prost::Message)]
681pub struct Column {
682    #[prost(string, tag = "1")]
683    pub column_name: ::prost::alloc::string::String,
684    #[prost(enumeration = "SemanticType", tag = "2")]
685    pub semantic_type: i32,
686    /// The array of non-null values in this column.
687    ///
688    /// For example: suppose there is a column "foo" that contains some int32
689    /// values (1, 2, 3, 4, 5, null, 7, 8, 9, null);
690    /// column:
691    /// column_name: foo
692    /// semantic_type: Tag
693    /// values: 1, 2, 3, 4, 5, 7, 8, 9
694    /// null_masks: 00100000 00000010
695    #[prost(message, optional, tag = "3")]
696    pub values: ::core::option::Option<column::Values>,
697    /// Mask maps the positions of null values.
698    /// If a bit in null_mask is 1, it indicates that the column value at that
699    /// position is null.
700    #[prost(bytes = "vec", tag = "4")]
701    pub null_mask: ::prost::alloc::vec::Vec<u8>,
702    /// Helpful in creating vector from column.
703    #[prost(enumeration = "ColumnDataType", tag = "5")]
704    pub datatype: i32,
705    /// Extension for ColumnDataType.
706    #[prost(message, optional, tag = "6")]
707    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
708    /// Additional column options.
709    #[prost(message, optional, tag = "7")]
710    pub options: ::core::option::Option<ColumnOptions>,
711}
712/// Nested message and enum types in `Column`.
713pub mod column {
714    #[derive(Clone, PartialEq, ::prost::Message)]
715    pub struct Values {
716        #[prost(int32, repeated, tag = "1")]
717        pub i8_values: ::prost::alloc::vec::Vec<i32>,
718        #[prost(int32, repeated, tag = "2")]
719        pub i16_values: ::prost::alloc::vec::Vec<i32>,
720        #[prost(int32, repeated, tag = "3")]
721        pub i32_values: ::prost::alloc::vec::Vec<i32>,
722        #[prost(int64, repeated, tag = "4")]
723        pub i64_values: ::prost::alloc::vec::Vec<i64>,
724        #[prost(uint32, repeated, tag = "5")]
725        pub u8_values: ::prost::alloc::vec::Vec<u32>,
726        #[prost(uint32, repeated, tag = "6")]
727        pub u16_values: ::prost::alloc::vec::Vec<u32>,
728        #[prost(uint32, repeated, tag = "7")]
729        pub u32_values: ::prost::alloc::vec::Vec<u32>,
730        #[prost(uint64, repeated, tag = "8")]
731        pub u64_values: ::prost::alloc::vec::Vec<u64>,
732        #[prost(float, repeated, tag = "9")]
733        pub f32_values: ::prost::alloc::vec::Vec<f32>,
734        #[prost(double, repeated, tag = "10")]
735        pub f64_values: ::prost::alloc::vec::Vec<f64>,
736        #[prost(bool, repeated, tag = "11")]
737        pub bool_values: ::prost::alloc::vec::Vec<bool>,
738        #[prost(bytes = "vec", repeated, tag = "12")]
739        pub binary_values: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
740        #[prost(string, repeated, tag = "13")]
741        pub string_values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
742        #[prost(int32, repeated, tag = "14")]
743        pub date_values: ::prost::alloc::vec::Vec<i32>,
744        #[prost(int64, repeated, tag = "15")]
745        pub datetime_values: ::prost::alloc::vec::Vec<i64>,
746        #[prost(int64, repeated, tag = "16")]
747        pub timestamp_second_values: ::prost::alloc::vec::Vec<i64>,
748        #[prost(int64, repeated, tag = "17")]
749        pub timestamp_millisecond_values: ::prost::alloc::vec::Vec<i64>,
750        #[prost(int64, repeated, tag = "18")]
751        pub timestamp_microsecond_values: ::prost::alloc::vec::Vec<i64>,
752        #[prost(int64, repeated, tag = "19")]
753        pub timestamp_nanosecond_values: ::prost::alloc::vec::Vec<i64>,
754        #[prost(int64, repeated, tag = "20")]
755        pub time_second_values: ::prost::alloc::vec::Vec<i64>,
756        #[prost(int64, repeated, tag = "21")]
757        pub time_millisecond_values: ::prost::alloc::vec::Vec<i64>,
758        #[prost(int64, repeated, tag = "22")]
759        pub time_microsecond_values: ::prost::alloc::vec::Vec<i64>,
760        #[prost(int64, repeated, tag = "23")]
761        pub time_nanosecond_values: ::prost::alloc::vec::Vec<i64>,
762        #[prost(int32, repeated, tag = "24")]
763        pub interval_year_month_values: ::prost::alloc::vec::Vec<i32>,
764        #[prost(int64, repeated, tag = "25")]
765        pub interval_day_time_values: ::prost::alloc::vec::Vec<i64>,
766        #[prost(message, repeated, tag = "26")]
767        pub interval_month_day_nano_values: ::prost::alloc::vec::Vec<
768            super::IntervalMonthDayNano,
769        >,
770        #[prost(message, repeated, tag = "31")]
771        pub decimal128_values: ::prost::alloc::vec::Vec<super::Decimal128>,
772        #[prost(message, repeated, tag = "40")]
773        pub list_values: ::prost::alloc::vec::Vec<super::ListValue>,
774        #[prost(message, repeated, tag = "41")]
775        pub struct_values: ::prost::alloc::vec::Vec<super::StructValue>,
776        #[prost(message, repeated, tag = "42")]
777        pub json_values: ::prost::alloc::vec::Vec<Values>,
778    }
779}
780/// "Data Definition Language" requests, that create, modify or delete the
781/// database structures but not the data. `DdlRequest` could carry more
782/// information than plain SQL, for example, the "table_id" in `CreateTableExpr`.
783/// So create a new DDL expr if you need it.
784#[derive(Clone, PartialEq, ::prost::Message)]
785pub struct DdlRequest {
786    #[prost(oneof = "ddl_request::Expr", tags = "1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13")]
787    pub expr: ::core::option::Option<ddl_request::Expr>,
788}
789/// Nested message and enum types in `DdlRequest`.
790pub mod ddl_request {
791    #[derive(Clone, PartialEq, ::prost::Oneof)]
792    pub enum Expr {
793        #[prost(message, tag = "1")]
794        CreateDatabase(super::CreateDatabaseExpr),
795        #[prost(message, tag = "2")]
796        CreateTable(super::CreateTableExpr),
797        #[prost(message, tag = "3")]
798        AlterTable(super::AlterTableExpr),
799        #[prost(message, tag = "4")]
800        DropTable(super::DropTableExpr),
801        #[prost(message, tag = "7")]
802        TruncateTable(super::TruncateTableExpr),
803        #[prost(message, tag = "8")]
804        CreateFlow(super::CreateFlowExpr),
805        #[prost(message, tag = "9")]
806        DropFlow(super::DropFlowExpr),
807        #[prost(message, tag = "10")]
808        CreateView(super::CreateViewExpr),
809        #[prost(message, tag = "11")]
810        DropView(super::DropViewExpr),
811        #[prost(message, tag = "12")]
812        AlterDatabase(super::AlterDatabaseExpr),
813        #[prost(message, tag = "13")]
814        CommentOn(super::CommentOnExpr),
815    }
816}
817/// Create a flow to run the SQL when new data arrives.
818#[derive(Clone, PartialEq, ::prost::Message)]
819pub struct CreateFlowExpr {
820    #[prost(string, tag = "1")]
821    pub catalog_name: ::prost::alloc::string::String,
822    #[prost(string, tag = "2")]
823    pub flow_name: ::prost::alloc::string::String,
824    #[prost(message, repeated, tag = "3")]
825    pub source_table_names: ::prost::alloc::vec::Vec<TableName>,
826    #[prost(message, optional, tag = "4")]
827    pub sink_table_name: ::core::option::Option<TableName>,
828    #[prost(bool, tag = "5")]
829    pub or_replace: bool,
830    #[prost(bool, tag = "6")]
831    pub create_if_not_exists: bool,
832    /// Expire data older than the given duration seconds.
833    #[prost(message, optional, tag = "7")]
834    pub expire_after: ::core::option::Option<ExpireAfter>,
835    #[prost(message, optional, tag = "11")]
836    pub eval_interval: ::core::option::Option<EvalInterval>,
837    #[prost(string, tag = "8")]
838    pub comment: ::prost::alloc::string::String,
839    #[prost(string, tag = "9")]
840    pub sql: ::prost::alloc::string::String,
841    #[prost(map = "string, string", tag = "10")]
842    pub flow_options: ::std::collections::HashMap<
843        ::prost::alloc::string::String,
844        ::prost::alloc::string::String,
845    >,
846}
847/// Drop a flow.
848#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
849pub struct DropFlowExpr {
850    #[prost(string, tag = "1")]
851    pub catalog_name: ::prost::alloc::string::String,
852    #[prost(string, tag = "2")]
853    pub flow_name: ::prost::alloc::string::String,
854    #[prost(message, optional, tag = "3")]
855    pub flow_id: ::core::option::Option<FlowId>,
856    #[prost(bool, tag = "5")]
857    pub drop_if_exists: bool,
858}
859/// Create a view
860#[derive(Clone, PartialEq, ::prost::Message)]
861pub struct CreateViewExpr {
862    #[prost(string, tag = "1")]
863    pub catalog_name: ::prost::alloc::string::String,
864    #[prost(string, tag = "2")]
865    pub schema_name: ::prost::alloc::string::String,
866    #[prost(string, tag = "3")]
867    pub view_name: ::prost::alloc::string::String,
868    #[prost(bytes = "vec", tag = "4")]
869    pub logical_plan: ::prost::alloc::vec::Vec<u8>,
870    #[prost(bool, tag = "5")]
871    pub create_if_not_exists: bool,
872    #[prost(bool, tag = "6")]
873    pub or_replace: bool,
874    #[prost(message, repeated, tag = "7")]
875    pub table_names: ::prost::alloc::vec::Vec<TableName>,
876    #[prost(string, repeated, tag = "8")]
877    pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
878    #[prost(string, repeated, tag = "9")]
879    pub plan_columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
880    #[prost(string, tag = "10")]
881    pub definition: ::prost::alloc::string::String,
882}
883/// Drop a view
884#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
885pub struct DropViewExpr {
886    #[prost(string, tag = "1")]
887    pub catalog_name: ::prost::alloc::string::String,
888    #[prost(string, tag = "2")]
889    pub schema_name: ::prost::alloc::string::String,
890    #[prost(string, tag = "3")]
891    pub view_name: ::prost::alloc::string::String,
892    #[prost(message, optional, tag = "4")]
893    pub view_id: ::core::option::Option<TableId>,
894    #[prost(bool, tag = "5")]
895    pub drop_if_exists: bool,
896}
897#[derive(Clone, PartialEq, ::prost::Message)]
898pub struct CreateTableExpr {
899    #[prost(string, tag = "1")]
900    pub catalog_name: ::prost::alloc::string::String,
901    #[prost(string, tag = "2")]
902    pub schema_name: ::prost::alloc::string::String,
903    #[prost(string, tag = "3")]
904    pub table_name: ::prost::alloc::string::String,
905    #[prost(string, tag = "4")]
906    pub desc: ::prost::alloc::string::String,
907    #[prost(message, repeated, tag = "5")]
908    pub column_defs: ::prost::alloc::vec::Vec<ColumnDef>,
909    #[prost(string, tag = "6")]
910    pub time_index: ::prost::alloc::string::String,
911    #[prost(string, repeated, tag = "7")]
912    pub primary_keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
913    #[prost(bool, tag = "8")]
914    pub create_if_not_exists: bool,
915    #[prost(map = "string, string", tag = "9")]
916    pub table_options: ::std::collections::HashMap<
917        ::prost::alloc::string::String,
918        ::prost::alloc::string::String,
919    >,
920    #[prost(message, optional, tag = "10")]
921    pub table_id: ::core::option::Option<TableId>,
922    #[prost(string, tag = "12")]
923    pub engine: ::prost::alloc::string::String,
924}
925#[derive(Clone, PartialEq, ::prost::Message)]
926pub struct AlterTableExpr {
927    #[prost(string, tag = "1")]
928    pub catalog_name: ::prost::alloc::string::String,
929    #[prost(string, tag = "2")]
930    pub schema_name: ::prost::alloc::string::String,
931    #[prost(string, tag = "3")]
932    pub table_name: ::prost::alloc::string::String,
933    #[prost(
934        oneof = "alter_table_expr::Kind",
935        tags = "4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18"
936    )]
937    pub kind: ::core::option::Option<alter_table_expr::Kind>,
938}
939/// Nested message and enum types in `AlterTableExpr`.
940pub mod alter_table_expr {
941    #[derive(Clone, PartialEq, ::prost::Oneof)]
942    pub enum Kind {
943        #[prost(message, tag = "4")]
944        AddColumns(super::AddColumns),
945        #[prost(message, tag = "5")]
946        DropColumns(super::DropColumns),
947        #[prost(message, tag = "6")]
948        RenameTable(super::RenameTable),
949        #[prost(message, tag = "7")]
950        ModifyColumnTypes(super::ModifyColumnTypes),
951        #[prost(message, tag = "8")]
952        SetTableOptions(super::SetTableOptions),
953        #[prost(message, tag = "11")]
954        UnsetTableOptions(super::UnsetTableOptions),
955        /// Deprecated: use set_indexes instead.
956        #[prost(message, tag = "12")]
957        SetIndex(super::SetIndex),
958        /// Deprecated: use unset_indexes instead.
959        #[prost(message, tag = "13")]
960        UnsetIndex(super::UnsetIndex),
961        #[prost(message, tag = "14")]
962        DropDefaults(super::DropDefaults),
963        #[prost(message, tag = "15")]
964        SetIndexes(super::SetIndexes),
965        #[prost(message, tag = "16")]
966        UnsetIndexes(super::UnsetIndexes),
967        #[prost(message, tag = "17")]
968        SetDefaults(super::SetDefaults),
969        #[prost(message, tag = "18")]
970        Repartition(super::Repartition),
971    }
972}
973#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
974pub struct DropDefault {
975    #[prost(string, tag = "1")]
976    pub column_name: ::prost::alloc::string::String,
977}
978#[derive(Clone, PartialEq, ::prost::Message)]
979pub struct SetIndexes {
980    #[prost(message, repeated, tag = "1")]
981    pub set_indexes: ::prost::alloc::vec::Vec<SetIndex>,
982}
983#[derive(Clone, PartialEq, ::prost::Message)]
984pub struct UnsetIndexes {
985    #[prost(message, repeated, tag = "1")]
986    pub unset_indexes: ::prost::alloc::vec::Vec<UnsetIndex>,
987}
988#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
989pub struct SetDefault {
990    #[prost(string, tag = "1")]
991    pub column_name: ::prost::alloc::string::String,
992    /// The JSON representation of the default `Expr`.
993    #[prost(bytes = "vec", tag = "2")]
994    pub default_constraint: ::prost::alloc::vec::Vec<u8>,
995}
996#[derive(Clone, PartialEq, ::prost::Message)]
997pub struct SetIndex {
998    #[prost(oneof = "set_index::Options", tags = "1, 2, 3")]
999    pub options: ::core::option::Option<set_index::Options>,
1000}
1001/// Nested message and enum types in `SetIndex`.
1002pub mod set_index {
1003    #[derive(Clone, PartialEq, ::prost::Oneof)]
1004    pub enum Options {
1005        #[prost(message, tag = "1")]
1006        Fulltext(super::SetFulltext),
1007        #[prost(message, tag = "2")]
1008        Inverted(super::SetInverted),
1009        #[prost(message, tag = "3")]
1010        Skipping(super::SetSkipping),
1011    }
1012}
1013#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1014pub struct UnsetIndex {
1015    #[prost(oneof = "unset_index::Options", tags = "1, 2, 3")]
1016    pub options: ::core::option::Option<unset_index::Options>,
1017}
1018/// Nested message and enum types in `UnsetIndex`.
1019pub mod unset_index {
1020    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1021    pub enum Options {
1022        #[prost(message, tag = "1")]
1023        Fulltext(super::UnsetFulltext),
1024        #[prost(message, tag = "2")]
1025        Inverted(super::UnsetInverted),
1026        #[prost(message, tag = "3")]
1027        Skipping(super::UnsetSkipping),
1028    }
1029}
1030#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1031pub struct Repartition {
1032    /// The from partition expressions serialized in JSON format.
1033    #[prost(string, repeated, tag = "1")]
1034    pub from_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1035    /// The into partition expressions serialized in JSON format.
1036    #[prost(string, repeated, tag = "2")]
1037    pub into_partition_exprs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1038}
1039#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1040pub struct DropTableExpr {
1041    #[prost(string, tag = "1")]
1042    pub catalog_name: ::prost::alloc::string::String,
1043    #[prost(string, tag = "2")]
1044    pub schema_name: ::prost::alloc::string::String,
1045    #[prost(string, tag = "3")]
1046    pub table_name: ::prost::alloc::string::String,
1047    #[prost(message, optional, tag = "4")]
1048    pub table_id: ::core::option::Option<TableId>,
1049    #[prost(bool, tag = "5")]
1050    pub drop_if_exists: bool,
1051}
1052#[derive(Clone, PartialEq, ::prost::Message)]
1053pub struct CreateDatabaseExpr {
1054    #[prost(string, tag = "1")]
1055    pub catalog_name: ::prost::alloc::string::String,
1056    #[prost(string, tag = "2")]
1057    pub schema_name: ::prost::alloc::string::String,
1058    #[prost(bool, tag = "3")]
1059    pub create_if_not_exists: bool,
1060    #[prost(map = "string, string", tag = "4")]
1061    pub options: ::std::collections::HashMap<
1062        ::prost::alloc::string::String,
1063        ::prost::alloc::string::String,
1064    >,
1065}
1066#[derive(Clone, PartialEq, ::prost::Message)]
1067pub struct TruncateTableExpr {
1068    #[prost(string, tag = "1")]
1069    pub catalog_name: ::prost::alloc::string::String,
1070    #[prost(string, tag = "2")]
1071    pub schema_name: ::prost::alloc::string::String,
1072    #[prost(string, tag = "3")]
1073    pub table_name: ::prost::alloc::string::String,
1074    #[prost(message, optional, tag = "4")]
1075    pub table_id: ::core::option::Option<TableId>,
1076    /// if empty, truncate entire table, else only truncate time ranges
1077    #[prost(message, optional, tag = "5")]
1078    pub time_ranges: ::core::option::Option<TimeRanges>,
1079}
1080#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1081pub struct DropDatabaseExpr {
1082    #[prost(string, tag = "1")]
1083    pub catalog_name: ::prost::alloc::string::String,
1084    #[prost(string, tag = "2")]
1085    pub schema_name: ::prost::alloc::string::String,
1086    #[prost(bool, tag = "3")]
1087    pub drop_if_exists: bool,
1088}
1089#[derive(Clone, PartialEq, ::prost::Message)]
1090pub struct AddColumns {
1091    #[prost(message, repeated, tag = "1")]
1092    pub add_columns: ::prost::alloc::vec::Vec<AddColumn>,
1093}
1094#[derive(Clone, PartialEq, ::prost::Message)]
1095pub struct DropDefaults {
1096    #[prost(message, repeated, tag = "1")]
1097    pub drop_defaults: ::prost::alloc::vec::Vec<DropDefault>,
1098}
1099#[derive(Clone, PartialEq, ::prost::Message)]
1100pub struct SetDefaults {
1101    #[prost(message, repeated, tag = "1")]
1102    pub set_defaults: ::prost::alloc::vec::Vec<SetDefault>,
1103}
1104#[derive(Clone, PartialEq, ::prost::Message)]
1105pub struct DropColumns {
1106    #[prost(message, repeated, tag = "1")]
1107    pub drop_columns: ::prost::alloc::vec::Vec<DropColumn>,
1108}
1109#[derive(Clone, PartialEq, ::prost::Message)]
1110pub struct ModifyColumnTypes {
1111    #[prost(message, repeated, tag = "1")]
1112    pub modify_column_types: ::prost::alloc::vec::Vec<ModifyColumnType>,
1113}
1114#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1115pub struct RenameTable {
1116    #[prost(string, tag = "1")]
1117    pub new_table_name: ::prost::alloc::string::String,
1118}
1119#[derive(Clone, PartialEq, ::prost::Message)]
1120pub struct AddColumn {
1121    #[prost(message, optional, tag = "1")]
1122    pub column_def: ::core::option::Option<ColumnDef>,
1123    #[prost(message, optional, tag = "3")]
1124    pub location: ::core::option::Option<AddColumnLocation>,
1125    #[prost(bool, tag = "4")]
1126    pub add_if_not_exists: bool,
1127}
1128#[derive(Clone, PartialEq, ::prost::Message)]
1129pub struct ModifyColumnType {
1130    #[prost(string, tag = "1")]
1131    pub column_name: ::prost::alloc::string::String,
1132    #[prost(enumeration = "ColumnDataType", tag = "2")]
1133    pub target_type: i32,
1134    #[prost(message, optional, tag = "3")]
1135    pub target_type_extension: ::core::option::Option<ColumnDataTypeExtension>,
1136}
1137#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1138pub struct Option {
1139    #[prost(string, tag = "1")]
1140    pub key: ::prost::alloc::string::String,
1141    #[prost(string, tag = "2")]
1142    pub value: ::prost::alloc::string::String,
1143}
1144#[derive(Clone, PartialEq, ::prost::Message)]
1145pub struct SetTableOptions {
1146    #[prost(message, repeated, tag = "1")]
1147    pub table_options: ::prost::alloc::vec::Vec<Option>,
1148}
1149#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1150pub struct UnsetTableOptions {
1151    #[prost(string, repeated, tag = "1")]
1152    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1153}
1154#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1155pub struct DropColumn {
1156    #[prost(string, tag = "1")]
1157    pub name: ::prost::alloc::string::String,
1158}
1159#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1160pub struct TableId {
1161    #[prost(uint32, tag = "1")]
1162    pub id: u32,
1163}
1164#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1165pub struct FlowId {
1166    #[prost(uint32, tag = "1")]
1167    pub id: u32,
1168}
1169#[derive(Clone, PartialEq, ::prost::Message)]
1170pub struct ColumnDef {
1171    #[prost(string, tag = "1")]
1172    pub name: ::prost::alloc::string::String,
1173    #[prost(enumeration = "ColumnDataType", tag = "2")]
1174    pub data_type: i32,
1175    #[prost(bool, tag = "3")]
1176    pub is_nullable: bool,
1177    #[prost(bytes = "vec", tag = "4")]
1178    pub default_constraint: ::prost::alloc::vec::Vec<u8>,
1179    #[prost(enumeration = "SemanticType", tag = "5")]
1180    pub semantic_type: i32,
1181    #[prost(string, tag = "6")]
1182    pub comment: ::prost::alloc::string::String,
1183    /// Extension for ColumnDataType.
1184    #[prost(message, optional, tag = "7")]
1185    pub datatype_extension: ::core::option::Option<ColumnDataTypeExtension>,
1186    /// Additional column options.
1187    #[prost(message, optional, tag = "8")]
1188    pub options: ::core::option::Option<ColumnOptions>,
1189}
1190#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1191pub struct AddColumnLocation {
1192    #[prost(enumeration = "add_column_location::LocationType", tag = "1")]
1193    pub location_type: i32,
1194    #[prost(string, tag = "2")]
1195    pub after_column_name: ::prost::alloc::string::String,
1196}
1197/// Nested message and enum types in `AddColumnLocation`.
1198pub mod add_column_location {
1199    #[derive(
1200        Clone,
1201        Copy,
1202        Debug,
1203        PartialEq,
1204        Eq,
1205        Hash,
1206        PartialOrd,
1207        Ord,
1208        ::prost::Enumeration
1209    )]
1210    #[repr(i32)]
1211    pub enum LocationType {
1212        First = 0,
1213        After = 1,
1214    }
1215    impl LocationType {
1216        /// String value of the enum field names used in the ProtoBuf definition.
1217        ///
1218        /// The values are not transformed in any way and thus are considered stable
1219        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1220        pub fn as_str_name(&self) -> &'static str {
1221            match self {
1222                Self::First => "FIRST",
1223                Self::After => "AFTER",
1224            }
1225        }
1226        /// Creates an enum from field names used in the ProtoBuf definition.
1227        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1228            match value {
1229                "FIRST" => Some(Self::First),
1230                "AFTER" => Some(Self::After),
1231                _ => None,
1232            }
1233        }
1234    }
1235}
1236#[derive(Clone, PartialEq, ::prost::Message)]
1237pub struct SetFulltext {
1238    #[prost(string, tag = "1")]
1239    pub column_name: ::prost::alloc::string::String,
1240    #[prost(bool, tag = "2")]
1241    pub enable: bool,
1242    #[prost(enumeration = "Analyzer", tag = "3")]
1243    pub analyzer: i32,
1244    #[prost(bool, tag = "4")]
1245    pub case_sensitive: bool,
1246    #[prost(enumeration = "FulltextBackend", tag = "5")]
1247    pub backend: i32,
1248    /// The granularity for the fulltext index (for bloom backend only).
1249    #[prost(uint64, tag = "6")]
1250    pub granularity: u64,
1251    /// The false positive rate for the fulltext index (for bloom backend only).
1252    #[prost(double, tag = "7")]
1253    pub false_positive_rate: f64,
1254}
1255#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1256pub struct UnsetFulltext {
1257    #[prost(string, tag = "1")]
1258    pub column_name: ::prost::alloc::string::String,
1259}
1260#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1261pub struct SetInverted {
1262    #[prost(string, tag = "1")]
1263    pub column_name: ::prost::alloc::string::String,
1264}
1265#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1266pub struct UnsetInverted {
1267    #[prost(string, tag = "1")]
1268    pub column_name: ::prost::alloc::string::String,
1269}
1270#[derive(Clone, PartialEq, ::prost::Message)]
1271pub struct SetSkipping {
1272    #[prost(string, tag = "1")]
1273    pub column_name: ::prost::alloc::string::String,
1274    #[prost(bool, tag = "2")]
1275    pub enable: bool,
1276    #[prost(uint64, tag = "3")]
1277    pub granularity: u64,
1278    #[prost(enumeration = "SkippingIndexType", tag = "4")]
1279    pub skipping_index_type: i32,
1280    #[prost(double, tag = "5")]
1281    pub false_positive_rate: f64,
1282}
1283#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1284pub struct UnsetSkipping {
1285    #[prost(string, tag = "1")]
1286    pub column_name: ::prost::alloc::string::String,
1287}
1288#[derive(Clone, PartialEq, ::prost::Message)]
1289pub struct AlterDatabaseExpr {
1290    #[prost(string, tag = "1")]
1291    pub catalog_name: ::prost::alloc::string::String,
1292    #[prost(string, tag = "2")]
1293    pub schema_name: ::prost::alloc::string::String,
1294    #[prost(oneof = "alter_database_expr::Kind", tags = "3, 4")]
1295    pub kind: ::core::option::Option<alter_database_expr::Kind>,
1296}
1297/// Nested message and enum types in `AlterDatabaseExpr`.
1298pub mod alter_database_expr {
1299    #[derive(Clone, PartialEq, ::prost::Oneof)]
1300    pub enum Kind {
1301        #[prost(message, tag = "3")]
1302        SetDatabaseOptions(super::SetDatabaseOptions),
1303        #[prost(message, tag = "4")]
1304        UnsetDatabaseOptions(super::UnsetDatabaseOptions),
1305    }
1306}
1307#[derive(Clone, PartialEq, ::prost::Message)]
1308pub struct SetDatabaseOptions {
1309    #[prost(message, repeated, tag = "1")]
1310    pub set_database_options: ::prost::alloc::vec::Vec<Option>,
1311}
1312#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1313pub struct UnsetDatabaseOptions {
1314    #[prost(string, repeated, tag = "1")]
1315    pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1316}
1317/// The create trigger expression.
1318#[derive(Clone, PartialEq, ::prost::Message)]
1319pub struct CreateTriggerExpr {
1320    #[prost(string, tag = "1")]
1321    pub catalog_name: ::prost::alloc::string::String,
1322    #[prost(string, tag = "2")]
1323    pub trigger_name: ::prost::alloc::string::String,
1324    #[prost(bool, tag = "3")]
1325    pub create_if_not_exists: bool,
1326    /// The SQL statement to be executed periodically.
1327    #[prost(string, tag = "4")]
1328    pub sql: ::prost::alloc::string::String,
1329    /// The channels for sending notifications.
1330    #[prost(message, repeated, tag = "5")]
1331    pub channels: ::prost::alloc::vec::Vec<NotifyChannel>,
1332    /// The user-defined labels.
1333    #[prost(map = "string, string", tag = "6")]
1334    pub labels: ::std::collections::HashMap<
1335        ::prost::alloc::string::String,
1336        ::prost::alloc::string::String,
1337    >,
1338    /// The user-defined annotations.
1339    #[prost(map = "string, string", tag = "7")]
1340    pub annotations: ::std::collections::HashMap<
1341        ::prost::alloc::string::String,
1342        ::prost::alloc::string::String,
1343    >,
1344    #[prost(message, optional, tag = "8")]
1345    pub interval: ::core::option::Option<::prost_types::Duration>,
1346    /// The raw interval expression, e.g., '1 minute'::INTERVAL.
1347    #[prost(string, tag = "9")]
1348    pub raw_interval_expr: ::prost::alloc::string::String,
1349    /// The duration that the condition must be met continuously before firing the
1350    /// trigger.
1351    #[prost(message, optional, tag = "10")]
1352    pub r#for: ::core::option::Option<::prost_types::Duration>,
1353    /// The raw SQL expression for 'for' duration, e.g., '5 minutes'::INTERVAL.
1354    #[prost(string, tag = "11")]
1355    pub for_raw_expr: ::prost::alloc::string::String,
1356    /// The duration to keep firing after the condition is no longer met.
1357    #[prost(message, optional, tag = "12")]
1358    pub keep_firing_for: ::core::option::Option<::prost_types::Duration>,
1359    /// The raw SQL expression for 'keep_firing_for' duration, e.g.,
1360    /// '10 minutes'::INTERVAL.
1361    #[prost(string, tag = "13")]
1362    pub keep_firing_for_raw_expr: ::prost::alloc::string::String,
1363}
1364/// The notification channel for trigger.
1365#[derive(Clone, PartialEq, ::prost::Message)]
1366pub struct NotifyChannel {
1367    #[prost(string, tag = "1")]
1368    pub name: ::prost::alloc::string::String,
1369    #[prost(oneof = "notify_channel::ChannelType", tags = "2")]
1370    pub channel_type: ::core::option::Option<notify_channel::ChannelType>,
1371}
1372/// Nested message and enum types in `NotifyChannel`.
1373pub mod notify_channel {
1374    #[derive(Clone, PartialEq, ::prost::Oneof)]
1375    pub enum ChannelType {
1376        #[prost(message, tag = "2")]
1377        Webhook(super::WebhookOptions),
1378    }
1379}
1380/// The options for webhook.
1381#[derive(Clone, PartialEq, ::prost::Message)]
1382pub struct WebhookOptions {
1383    #[prost(string, tag = "1")]
1384    pub url: ::prost::alloc::string::String,
1385    #[prost(map = "string, string", tag = "2")]
1386    pub opts: ::std::collections::HashMap<
1387        ::prost::alloc::string::String,
1388        ::prost::alloc::string::String,
1389    >,
1390}
1391#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1392pub struct DropTriggerExpr {
1393    #[prost(string, tag = "1")]
1394    pub catalog_name: ::prost::alloc::string::String,
1395    #[prost(string, tag = "2")]
1396    pub trigger_name: ::prost::alloc::string::String,
1397    #[prost(bool, tag = "3")]
1398    pub drop_if_exists: bool,
1399}
1400/// Comment on a table, column, or flow
1401#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1402pub struct CommentOnExpr {
1403    #[prost(string, tag = "1")]
1404    pub catalog_name: ::prost::alloc::string::String,
1405    #[prost(string, tag = "2")]
1406    pub schema_name: ::prost::alloc::string::String,
1407    #[prost(enumeration = "CommentObjectType", tag = "3")]
1408    pub object_type: i32,
1409    #[prost(string, tag = "4")]
1410    pub object_name: ::prost::alloc::string::String,
1411    /// Column name (only for Column comments)
1412    #[prost(string, tag = "5")]
1413    pub column_name: ::prost::alloc::string::String,
1414    /// The comment text (null to remove comment)
1415    #[prost(string, tag = "6")]
1416    pub comment: ::prost::alloc::string::String,
1417}
1418#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1419#[repr(i32)]
1420pub enum Analyzer {
1421    English = 0,
1422    Chinese = 1,
1423}
1424impl Analyzer {
1425    /// String value of the enum field names used in the ProtoBuf definition.
1426    ///
1427    /// The values are not transformed in any way and thus are considered stable
1428    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1429    pub fn as_str_name(&self) -> &'static str {
1430        match self {
1431            Self::English => "ENGLISH",
1432            Self::Chinese => "CHINESE",
1433        }
1434    }
1435    /// Creates an enum from field names used in the ProtoBuf definition.
1436    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1437        match value {
1438            "ENGLISH" => Some(Self::English),
1439            "CHINESE" => Some(Self::Chinese),
1440            _ => None,
1441        }
1442    }
1443}
1444#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1445#[repr(i32)]
1446pub enum FulltextBackend {
1447    Tantivy = 0,
1448    Bloom = 1,
1449}
1450impl FulltextBackend {
1451    /// String value of the enum field names used in the ProtoBuf definition.
1452    ///
1453    /// The values are not transformed in any way and thus are considered stable
1454    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1455    pub fn as_str_name(&self) -> &'static str {
1456        match self {
1457            Self::Tantivy => "TANTIVY",
1458            Self::Bloom => "BLOOM",
1459        }
1460    }
1461    /// Creates an enum from field names used in the ProtoBuf definition.
1462    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1463        match value {
1464            "TANTIVY" => Some(Self::Tantivy),
1465            "BLOOM" => Some(Self::Bloom),
1466            _ => None,
1467        }
1468    }
1469}
1470#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1471#[repr(i32)]
1472pub enum SkippingIndexType {
1473    BloomFilter = 0,
1474}
1475impl SkippingIndexType {
1476    /// String value of the enum field names used in the ProtoBuf definition.
1477    ///
1478    /// The values are not transformed in any way and thus are considered stable
1479    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1480    pub fn as_str_name(&self) -> &'static str {
1481        match self {
1482            Self::BloomFilter => "BLOOM_FILTER",
1483        }
1484    }
1485    /// Creates an enum from field names used in the ProtoBuf definition.
1486    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1487        match value {
1488            "BLOOM_FILTER" => Some(Self::BloomFilter),
1489            _ => None,
1490        }
1491    }
1492}
1493/// The type of object to comment on
1494#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1495#[repr(i32)]
1496pub enum CommentObjectType {
1497    Table = 0,
1498    Column = 1,
1499    Flow = 2,
1500}
1501impl CommentObjectType {
1502    /// String value of the enum field names used in the ProtoBuf definition.
1503    ///
1504    /// The values are not transformed in any way and thus are considered stable
1505    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1506    pub fn as_str_name(&self) -> &'static str {
1507        match self {
1508            Self::Table => "TABLE",
1509            Self::Column => "COLUMN",
1510            Self::Flow => "FLOW",
1511        }
1512    }
1513    /// Creates an enum from field names used in the ProtoBuf definition.
1514    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1515        match value {
1516            "TABLE" => Some(Self::Table),
1517            "COLUMN" => Some(Self::Column),
1518            "FLOW" => Some(Self::Flow),
1519            _ => None,
1520        }
1521    }
1522}
1523#[derive(Clone, PartialEq, ::prost::Message)]
1524pub struct PromqlRequest {
1525    #[prost(message, optional, tag = "1")]
1526    pub header: ::core::option::Option<RequestHeader>,
1527    #[prost(oneof = "promql_request::Promql", tags = "2, 3")]
1528    pub promql: ::core::option::Option<promql_request::Promql>,
1529}
1530/// Nested message and enum types in `PromqlRequest`.
1531pub mod promql_request {
1532    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1533    pub enum Promql {
1534        #[prost(message, tag = "2")]
1535        InstantQuery(super::PromInstantQuery),
1536        #[prost(message, tag = "3")]
1537        RangeQuery(super::PromRangeQuery),
1538    }
1539}
1540#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1541pub struct PromqlResponse {
1542    #[prost(message, optional, tag = "1")]
1543    pub header: ::core::option::Option<ResponseHeader>,
1544    /// absolutely same format as Prometheus in JSON
1545    #[prost(bytes = "vec", tag = "2")]
1546    pub body: ::prost::alloc::vec::Vec<u8>,
1547}
1548#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1549pub struct PromInstantQuery {
1550    #[prost(string, tag = "1")]
1551    pub query: ::prost::alloc::string::String,
1552    #[prost(string, tag = "2")]
1553    pub time: ::prost::alloc::string::String,
1554    #[prost(string, tag = "3")]
1555    pub lookback: ::prost::alloc::string::String,
1556}
1557#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1558pub struct PromRangeQuery {
1559    #[prost(string, tag = "1")]
1560    pub query: ::prost::alloc::string::String,
1561    #[prost(string, tag = "2")]
1562    pub start: ::prost::alloc::string::String,
1563    #[prost(string, tag = "3")]
1564    pub end: ::prost::alloc::string::String,
1565    #[prost(string, tag = "4")]
1566    pub step: ::prost::alloc::string::String,
1567    #[prost(string, tag = "5")]
1568    pub lookback: ::prost::alloc::string::String,
1569}
1570/// Generated client implementations.
1571pub mod prometheus_gateway_client {
1572    #![allow(
1573        unused_variables,
1574        dead_code,
1575        missing_docs,
1576        clippy::wildcard_imports,
1577        clippy::let_unit_value,
1578    )]
1579    use tonic::codegen::*;
1580    use tonic::codegen::http::Uri;
1581    /// PrometheusGateway behaves absolutely the same as Prometheus HTTP API
1582    #[derive(Debug, Clone)]
1583    pub struct PrometheusGatewayClient<T> {
1584        inner: tonic::client::Grpc<T>,
1585    }
1586    impl PrometheusGatewayClient<tonic::transport::Channel> {
1587        /// Attempt to create a new client by connecting to a given endpoint.
1588        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1589        where
1590            D: TryInto<tonic::transport::Endpoint>,
1591            D::Error: Into<StdError>,
1592        {
1593            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1594            Ok(Self::new(conn))
1595        }
1596    }
1597    impl<T> PrometheusGatewayClient<T>
1598    where
1599        T: tonic::client::GrpcService<tonic::body::Body>,
1600        T::Error: Into<StdError>,
1601        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1602        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1603    {
1604        pub fn new(inner: T) -> Self {
1605            let inner = tonic::client::Grpc::new(inner);
1606            Self { inner }
1607        }
1608        pub fn with_origin(inner: T, origin: Uri) -> Self {
1609            let inner = tonic::client::Grpc::with_origin(inner, origin);
1610            Self { inner }
1611        }
1612        pub fn with_interceptor<F>(
1613            inner: T,
1614            interceptor: F,
1615        ) -> PrometheusGatewayClient<InterceptedService<T, F>>
1616        where
1617            F: tonic::service::Interceptor,
1618            T::ResponseBody: Default,
1619            T: tonic::codegen::Service<
1620                http::Request<tonic::body::Body>,
1621                Response = http::Response<
1622                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1623                >,
1624            >,
1625            <T as tonic::codegen::Service<
1626                http::Request<tonic::body::Body>,
1627            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1628        {
1629            PrometheusGatewayClient::new(InterceptedService::new(inner, interceptor))
1630        }
1631        /// Compress requests with the given encoding.
1632        ///
1633        /// This requires the server to support it otherwise it might respond with an
1634        /// error.
1635        #[must_use]
1636        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1637            self.inner = self.inner.send_compressed(encoding);
1638            self
1639        }
1640        /// Enable decompressing responses.
1641        #[must_use]
1642        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1643            self.inner = self.inner.accept_compressed(encoding);
1644            self
1645        }
1646        /// Limits the maximum size of a decoded message.
1647        ///
1648        /// Default: `4MB`
1649        #[must_use]
1650        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1651            self.inner = self.inner.max_decoding_message_size(limit);
1652            self
1653        }
1654        /// Limits the maximum size of an encoded message.
1655        ///
1656        /// Default: `usize::MAX`
1657        #[must_use]
1658        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1659            self.inner = self.inner.max_encoding_message_size(limit);
1660            self
1661        }
1662        pub async fn handle(
1663            &mut self,
1664            request: impl tonic::IntoRequest<super::PromqlRequest>,
1665        ) -> std::result::Result<tonic::Response<super::PromqlResponse>, tonic::Status> {
1666            self.inner
1667                .ready()
1668                .await
1669                .map_err(|e| {
1670                    tonic::Status::unknown(
1671                        format!("Service was not ready: {}", e.into()),
1672                    )
1673                })?;
1674            let codec = tonic_prost::ProstCodec::default();
1675            let path = http::uri::PathAndQuery::from_static(
1676                "/greptime.v1.PrometheusGateway/Handle",
1677            );
1678            let mut req = request.into_request();
1679            req.extensions_mut()
1680                .insert(GrpcMethod::new("greptime.v1.PrometheusGateway", "Handle"));
1681            self.inner.unary(req, path, codec).await
1682        }
1683    }
1684}
1685/// Generated server implementations.
1686pub mod prometheus_gateway_server {
1687    #![allow(
1688        unused_variables,
1689        dead_code,
1690        missing_docs,
1691        clippy::wildcard_imports,
1692        clippy::let_unit_value,
1693    )]
1694    use tonic::codegen::*;
1695    /// Generated trait containing gRPC methods that should be implemented for use with PrometheusGatewayServer.
1696    #[async_trait]
1697    pub trait PrometheusGateway: std::marker::Send + std::marker::Sync + 'static {
1698        async fn handle(
1699            &self,
1700            request: tonic::Request<super::PromqlRequest>,
1701        ) -> std::result::Result<tonic::Response<super::PromqlResponse>, tonic::Status>;
1702    }
1703    /// PrometheusGateway behaves absolutely the same as Prometheus HTTP API
1704    #[derive(Debug)]
1705    pub struct PrometheusGatewayServer<T> {
1706        inner: Arc<T>,
1707        accept_compression_encodings: EnabledCompressionEncodings,
1708        send_compression_encodings: EnabledCompressionEncodings,
1709        max_decoding_message_size: Option<usize>,
1710        max_encoding_message_size: Option<usize>,
1711    }
1712    impl<T> PrometheusGatewayServer<T> {
1713        pub fn new(inner: T) -> Self {
1714            Self::from_arc(Arc::new(inner))
1715        }
1716        pub fn from_arc(inner: Arc<T>) -> Self {
1717            Self {
1718                inner,
1719                accept_compression_encodings: Default::default(),
1720                send_compression_encodings: Default::default(),
1721                max_decoding_message_size: None,
1722                max_encoding_message_size: None,
1723            }
1724        }
1725        pub fn with_interceptor<F>(
1726            inner: T,
1727            interceptor: F,
1728        ) -> InterceptedService<Self, F>
1729        where
1730            F: tonic::service::Interceptor,
1731        {
1732            InterceptedService::new(Self::new(inner), interceptor)
1733        }
1734        /// Enable decompressing requests with the given encoding.
1735        #[must_use]
1736        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1737            self.accept_compression_encodings.enable(encoding);
1738            self
1739        }
1740        /// Compress responses with the given encoding, if the client supports it.
1741        #[must_use]
1742        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1743            self.send_compression_encodings.enable(encoding);
1744            self
1745        }
1746        /// Limits the maximum size of a decoded message.
1747        ///
1748        /// Default: `4MB`
1749        #[must_use]
1750        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1751            self.max_decoding_message_size = Some(limit);
1752            self
1753        }
1754        /// Limits the maximum size of an encoded message.
1755        ///
1756        /// Default: `usize::MAX`
1757        #[must_use]
1758        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1759            self.max_encoding_message_size = Some(limit);
1760            self
1761        }
1762    }
1763    impl<T, B> tonic::codegen::Service<http::Request<B>> for PrometheusGatewayServer<T>
1764    where
1765        T: PrometheusGateway,
1766        B: Body + std::marker::Send + 'static,
1767        B::Error: Into<StdError> + std::marker::Send + 'static,
1768    {
1769        type Response = http::Response<tonic::body::Body>;
1770        type Error = std::convert::Infallible;
1771        type Future = BoxFuture<Self::Response, Self::Error>;
1772        fn poll_ready(
1773            &mut self,
1774            _cx: &mut Context<'_>,
1775        ) -> Poll<std::result::Result<(), Self::Error>> {
1776            Poll::Ready(Ok(()))
1777        }
1778        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1779            match req.uri().path() {
1780                "/greptime.v1.PrometheusGateway/Handle" => {
1781                    #[allow(non_camel_case_types)]
1782                    struct HandleSvc<T: PrometheusGateway>(pub Arc<T>);
1783                    impl<
1784                        T: PrometheusGateway,
1785                    > tonic::server::UnaryService<super::PromqlRequest>
1786                    for HandleSvc<T> {
1787                        type Response = super::PromqlResponse;
1788                        type Future = BoxFuture<
1789                            tonic::Response<Self::Response>,
1790                            tonic::Status,
1791                        >;
1792                        fn call(
1793                            &mut self,
1794                            request: tonic::Request<super::PromqlRequest>,
1795                        ) -> Self::Future {
1796                            let inner = Arc::clone(&self.0);
1797                            let fut = async move {
1798                                <T as PrometheusGateway>::handle(&inner, request).await
1799                            };
1800                            Box::pin(fut)
1801                        }
1802                    }
1803                    let accept_compression_encodings = self.accept_compression_encodings;
1804                    let send_compression_encodings = self.send_compression_encodings;
1805                    let max_decoding_message_size = self.max_decoding_message_size;
1806                    let max_encoding_message_size = self.max_encoding_message_size;
1807                    let inner = self.inner.clone();
1808                    let fut = async move {
1809                        let method = HandleSvc(inner);
1810                        let codec = tonic_prost::ProstCodec::default();
1811                        let mut grpc = tonic::server::Grpc::new(codec)
1812                            .apply_compression_config(
1813                                accept_compression_encodings,
1814                                send_compression_encodings,
1815                            )
1816                            .apply_max_message_size_config(
1817                                max_decoding_message_size,
1818                                max_encoding_message_size,
1819                            );
1820                        let res = grpc.unary(method, req).await;
1821                        Ok(res)
1822                    };
1823                    Box::pin(fut)
1824                }
1825                _ => {
1826                    Box::pin(async move {
1827                        let mut response = http::Response::new(
1828                            tonic::body::Body::default(),
1829                        );
1830                        let headers = response.headers_mut();
1831                        headers
1832                            .insert(
1833                                tonic::Status::GRPC_STATUS,
1834                                (tonic::Code::Unimplemented as i32).into(),
1835                            );
1836                        headers
1837                            .insert(
1838                                http::header::CONTENT_TYPE,
1839                                tonic::metadata::GRPC_CONTENT_TYPE,
1840                            );
1841                        Ok(response)
1842                    })
1843                }
1844            }
1845        }
1846    }
1847    impl<T> Clone for PrometheusGatewayServer<T> {
1848        fn clone(&self) -> Self {
1849            let inner = self.inner.clone();
1850            Self {
1851                inner,
1852                accept_compression_encodings: self.accept_compression_encodings,
1853                send_compression_encodings: self.send_compression_encodings,
1854                max_decoding_message_size: self.max_decoding_message_size,
1855                max_encoding_message_size: self.max_encoding_message_size,
1856            }
1857        }
1858    }
1859    /// Generated gRPC service name
1860    pub const SERVICE_NAME: &str = "greptime.v1.PrometheusGateway";
1861    impl<T> tonic::server::NamedService for PrometheusGatewayServer<T> {
1862        const NAME: &'static str = SERVICE_NAME;
1863    }
1864}
1865#[derive(Clone, PartialEq, ::prost::Message)]
1866pub struct GreptimeRequest {
1867    #[prost(message, optional, tag = "1")]
1868    pub header: ::core::option::Option<RequestHeader>,
1869    #[prost(oneof = "greptime_request::Request", tags = "2, 3, 4, 5, 6, 7")]
1870    pub request: ::core::option::Option<greptime_request::Request>,
1871}
1872/// Nested message and enum types in `GreptimeRequest`.
1873pub mod greptime_request {
1874    #[derive(Clone, PartialEq, ::prost::Oneof)]
1875    pub enum Request {
1876        #[prost(message, tag = "2")]
1877        Inserts(super::InsertRequests),
1878        #[prost(message, tag = "3")]
1879        Query(super::QueryRequest),
1880        #[prost(message, tag = "4")]
1881        Ddl(super::DdlRequest),
1882        #[prost(message, tag = "5")]
1883        Deletes(super::DeleteRequests),
1884        #[prost(message, tag = "6")]
1885        RowInserts(super::RowInsertRequests),
1886        #[prost(message, tag = "7")]
1887        RowDeletes(super::RowDeleteRequests),
1888    }
1889}
1890#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1891pub struct GreptimeResponse {
1892    #[prost(message, optional, tag = "1")]
1893    pub header: ::core::option::Option<ResponseHeader>,
1894    #[prost(oneof = "greptime_response::Response", tags = "2")]
1895    pub response: ::core::option::Option<greptime_response::Response>,
1896}
1897/// Nested message and enum types in `GreptimeResponse`.
1898pub mod greptime_response {
1899    #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
1900    pub enum Response {
1901        #[prost(message, tag = "2")]
1902        AffectedRows(super::AffectedRows),
1903    }
1904}
1905#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1906pub struct QueryRequest {
1907    #[prost(oneof = "query_request::Query", tags = "1, 2, 3, 4")]
1908    pub query: ::core::option::Option<query_request::Query>,
1909}
1910/// Nested message and enum types in `QueryRequest`.
1911pub mod query_request {
1912    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
1913    pub enum Query {
1914        #[prost(string, tag = "1")]
1915        Sql(::prost::alloc::string::String),
1916        #[prost(bytes, tag = "2")]
1917        LogicalPlan(::prost::alloc::vec::Vec<u8>),
1918        #[prost(message, tag = "3")]
1919        PromRangeQuery(super::PromRangeQuery),
1920        #[prost(message, tag = "4")]
1921        InsertIntoPlan(super::InsertIntoPlan),
1922    }
1923}
1924/// A temporary solution for executing insert into table SELECT .. with logical plan
1925/// since substrait to logical plan doesn't support dml yet.
1926#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1927pub struct InsertIntoPlan {
1928    #[prost(message, optional, tag = "1")]
1929    pub table_name: ::core::option::Option<TableName>,
1930    #[prost(bytes = "vec", tag = "2")]
1931    pub logical_plan: ::prost::alloc::vec::Vec<u8>,
1932}
1933#[derive(Clone, PartialEq, ::prost::Message)]
1934pub struct InsertRequests {
1935    #[prost(message, repeated, tag = "1")]
1936    pub inserts: ::prost::alloc::vec::Vec<InsertRequest>,
1937}
1938#[derive(Clone, PartialEq, ::prost::Message)]
1939pub struct InsertRequest {
1940    #[prost(string, tag = "1")]
1941    pub table_name: ::prost::alloc::string::String,
1942    /// Data is represented here.
1943    #[prost(message, repeated, tag = "3")]
1944    pub columns: ::prost::alloc::vec::Vec<Column>,
1945    /// The row_count of all columns, which include null and non-null values.
1946    ///
1947    /// Note: the row_count of all columns in a InsertRequest must be same.
1948    #[prost(uint32, tag = "4")]
1949    pub row_count: u32,
1950}
1951#[derive(Clone, PartialEq, ::prost::Message)]
1952pub struct DeleteRequests {
1953    #[prost(message, repeated, tag = "1")]
1954    pub deletes: ::prost::alloc::vec::Vec<DeleteRequest>,
1955}
1956#[derive(Clone, PartialEq, ::prost::Message)]
1957pub struct DeleteRequest {
1958    /// The table name to delete from. Catalog name and schema name are in the
1959    /// `RequestHeader`.
1960    #[prost(string, tag = "1")]
1961    pub table_name: ::prost::alloc::string::String,
1962    /// The data to delete, indexed by key columns.
1963    #[prost(message, repeated, tag = "3")]
1964    pub key_columns: ::prost::alloc::vec::Vec<Column>,
1965    /// The row count of all columns above.
1966    #[prost(uint32, tag = "4")]
1967    pub row_count: u32,
1968}
1969#[derive(Clone, PartialEq, ::prost::Message)]
1970pub struct RowInsertRequests {
1971    #[prost(message, repeated, tag = "1")]
1972    pub inserts: ::prost::alloc::vec::Vec<RowInsertRequest>,
1973}
1974#[derive(Clone, PartialEq, ::prost::Message)]
1975pub struct RowInsertRequest {
1976    #[prost(string, tag = "1")]
1977    pub table_name: ::prost::alloc::string::String,
1978    /// Data is represented here.
1979    #[prost(message, optional, tag = "2")]
1980    pub rows: ::core::option::Option<Rows>,
1981}
1982#[derive(Clone, PartialEq, ::prost::Message)]
1983pub struct RowDeleteRequests {
1984    #[prost(message, repeated, tag = "1")]
1985    pub deletes: ::prost::alloc::vec::Vec<RowDeleteRequest>,
1986}
1987#[derive(Clone, PartialEq, ::prost::Message)]
1988pub struct RowDeleteRequest {
1989    /// The table name to delete from. Catalog name and schema name are in the
1990    /// `RequestHeader`.
1991    #[prost(string, tag = "1")]
1992    pub table_name: ::prost::alloc::string::String,
1993    /// The data to delete.
1994    #[prost(message, optional, tag = "2")]
1995    pub rows: ::core::option::Option<Rows>,
1996}
1997/// Generated client implementations.
1998pub mod greptime_database_client {
1999    #![allow(
2000        unused_variables,
2001        dead_code,
2002        missing_docs,
2003        clippy::wildcard_imports,
2004        clippy::let_unit_value,
2005    )]
2006    use tonic::codegen::*;
2007    use tonic::codegen::http::Uri;
2008    #[derive(Debug, Clone)]
2009    pub struct GreptimeDatabaseClient<T> {
2010        inner: tonic::client::Grpc<T>,
2011    }
2012    impl GreptimeDatabaseClient<tonic::transport::Channel> {
2013        /// Attempt to create a new client by connecting to a given endpoint.
2014        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2015        where
2016            D: TryInto<tonic::transport::Endpoint>,
2017            D::Error: Into<StdError>,
2018        {
2019            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2020            Ok(Self::new(conn))
2021        }
2022    }
2023    impl<T> GreptimeDatabaseClient<T>
2024    where
2025        T: tonic::client::GrpcService<tonic::body::Body>,
2026        T::Error: Into<StdError>,
2027        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2028        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2029    {
2030        pub fn new(inner: T) -> Self {
2031            let inner = tonic::client::Grpc::new(inner);
2032            Self { inner }
2033        }
2034        pub fn with_origin(inner: T, origin: Uri) -> Self {
2035            let inner = tonic::client::Grpc::with_origin(inner, origin);
2036            Self { inner }
2037        }
2038        pub fn with_interceptor<F>(
2039            inner: T,
2040            interceptor: F,
2041        ) -> GreptimeDatabaseClient<InterceptedService<T, F>>
2042        where
2043            F: tonic::service::Interceptor,
2044            T::ResponseBody: Default,
2045            T: tonic::codegen::Service<
2046                http::Request<tonic::body::Body>,
2047                Response = http::Response<
2048                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2049                >,
2050            >,
2051            <T as tonic::codegen::Service<
2052                http::Request<tonic::body::Body>,
2053            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2054        {
2055            GreptimeDatabaseClient::new(InterceptedService::new(inner, interceptor))
2056        }
2057        /// Compress requests with the given encoding.
2058        ///
2059        /// This requires the server to support it otherwise it might respond with an
2060        /// error.
2061        #[must_use]
2062        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2063            self.inner = self.inner.send_compressed(encoding);
2064            self
2065        }
2066        /// Enable decompressing responses.
2067        #[must_use]
2068        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2069            self.inner = self.inner.accept_compressed(encoding);
2070            self
2071        }
2072        /// Limits the maximum size of a decoded message.
2073        ///
2074        /// Default: `4MB`
2075        #[must_use]
2076        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2077            self.inner = self.inner.max_decoding_message_size(limit);
2078            self
2079        }
2080        /// Limits the maximum size of an encoded message.
2081        ///
2082        /// Default: `usize::MAX`
2083        #[must_use]
2084        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2085            self.inner = self.inner.max_encoding_message_size(limit);
2086            self
2087        }
2088        pub async fn handle(
2089            &mut self,
2090            request: impl tonic::IntoRequest<super::GreptimeRequest>,
2091        ) -> std::result::Result<
2092            tonic::Response<super::GreptimeResponse>,
2093            tonic::Status,
2094        > {
2095            self.inner
2096                .ready()
2097                .await
2098                .map_err(|e| {
2099                    tonic::Status::unknown(
2100                        format!("Service was not ready: {}", e.into()),
2101                    )
2102                })?;
2103            let codec = tonic_prost::ProstCodec::default();
2104            let path = http::uri::PathAndQuery::from_static(
2105                "/greptime.v1.GreptimeDatabase/Handle",
2106            );
2107            let mut req = request.into_request();
2108            req.extensions_mut()
2109                .insert(GrpcMethod::new("greptime.v1.GreptimeDatabase", "Handle"));
2110            self.inner.unary(req, path, codec).await
2111        }
2112        pub async fn handle_requests(
2113            &mut self,
2114            request: impl tonic::IntoStreamingRequest<Message = super::GreptimeRequest>,
2115        ) -> std::result::Result<
2116            tonic::Response<super::GreptimeResponse>,
2117            tonic::Status,
2118        > {
2119            self.inner
2120                .ready()
2121                .await
2122                .map_err(|e| {
2123                    tonic::Status::unknown(
2124                        format!("Service was not ready: {}", e.into()),
2125                    )
2126                })?;
2127            let codec = tonic_prost::ProstCodec::default();
2128            let path = http::uri::PathAndQuery::from_static(
2129                "/greptime.v1.GreptimeDatabase/HandleRequests",
2130            );
2131            let mut req = request.into_streaming_request();
2132            req.extensions_mut()
2133                .insert(
2134                    GrpcMethod::new("greptime.v1.GreptimeDatabase", "HandleRequests"),
2135                );
2136            self.inner.client_streaming(req, path, codec).await
2137        }
2138    }
2139}
2140/// Generated server implementations.
2141pub mod greptime_database_server {
2142    #![allow(
2143        unused_variables,
2144        dead_code,
2145        missing_docs,
2146        clippy::wildcard_imports,
2147        clippy::let_unit_value,
2148    )]
2149    use tonic::codegen::*;
2150    /// Generated trait containing gRPC methods that should be implemented for use with GreptimeDatabaseServer.
2151    #[async_trait]
2152    pub trait GreptimeDatabase: std::marker::Send + std::marker::Sync + 'static {
2153        async fn handle(
2154            &self,
2155            request: tonic::Request<super::GreptimeRequest>,
2156        ) -> std::result::Result<
2157            tonic::Response<super::GreptimeResponse>,
2158            tonic::Status,
2159        >;
2160        async fn handle_requests(
2161            &self,
2162            request: tonic::Request<tonic::Streaming<super::GreptimeRequest>>,
2163        ) -> std::result::Result<
2164            tonic::Response<super::GreptimeResponse>,
2165            tonic::Status,
2166        >;
2167    }
2168    #[derive(Debug)]
2169    pub struct GreptimeDatabaseServer<T> {
2170        inner: Arc<T>,
2171        accept_compression_encodings: EnabledCompressionEncodings,
2172        send_compression_encodings: EnabledCompressionEncodings,
2173        max_decoding_message_size: Option<usize>,
2174        max_encoding_message_size: Option<usize>,
2175    }
2176    impl<T> GreptimeDatabaseServer<T> {
2177        pub fn new(inner: T) -> Self {
2178            Self::from_arc(Arc::new(inner))
2179        }
2180        pub fn from_arc(inner: Arc<T>) -> Self {
2181            Self {
2182                inner,
2183                accept_compression_encodings: Default::default(),
2184                send_compression_encodings: Default::default(),
2185                max_decoding_message_size: None,
2186                max_encoding_message_size: None,
2187            }
2188        }
2189        pub fn with_interceptor<F>(
2190            inner: T,
2191            interceptor: F,
2192        ) -> InterceptedService<Self, F>
2193        where
2194            F: tonic::service::Interceptor,
2195        {
2196            InterceptedService::new(Self::new(inner), interceptor)
2197        }
2198        /// Enable decompressing requests with the given encoding.
2199        #[must_use]
2200        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2201            self.accept_compression_encodings.enable(encoding);
2202            self
2203        }
2204        /// Compress responses with the given encoding, if the client supports it.
2205        #[must_use]
2206        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2207            self.send_compression_encodings.enable(encoding);
2208            self
2209        }
2210        /// Limits the maximum size of a decoded message.
2211        ///
2212        /// Default: `4MB`
2213        #[must_use]
2214        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2215            self.max_decoding_message_size = Some(limit);
2216            self
2217        }
2218        /// Limits the maximum size of an encoded message.
2219        ///
2220        /// Default: `usize::MAX`
2221        #[must_use]
2222        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2223            self.max_encoding_message_size = Some(limit);
2224            self
2225        }
2226    }
2227    impl<T, B> tonic::codegen::Service<http::Request<B>> for GreptimeDatabaseServer<T>
2228    where
2229        T: GreptimeDatabase,
2230        B: Body + std::marker::Send + 'static,
2231        B::Error: Into<StdError> + std::marker::Send + 'static,
2232    {
2233        type Response = http::Response<tonic::body::Body>;
2234        type Error = std::convert::Infallible;
2235        type Future = BoxFuture<Self::Response, Self::Error>;
2236        fn poll_ready(
2237            &mut self,
2238            _cx: &mut Context<'_>,
2239        ) -> Poll<std::result::Result<(), Self::Error>> {
2240            Poll::Ready(Ok(()))
2241        }
2242        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2243            match req.uri().path() {
2244                "/greptime.v1.GreptimeDatabase/Handle" => {
2245                    #[allow(non_camel_case_types)]
2246                    struct HandleSvc<T: GreptimeDatabase>(pub Arc<T>);
2247                    impl<
2248                        T: GreptimeDatabase,
2249                    > tonic::server::UnaryService<super::GreptimeRequest>
2250                    for HandleSvc<T> {
2251                        type Response = super::GreptimeResponse;
2252                        type Future = BoxFuture<
2253                            tonic::Response<Self::Response>,
2254                            tonic::Status,
2255                        >;
2256                        fn call(
2257                            &mut self,
2258                            request: tonic::Request<super::GreptimeRequest>,
2259                        ) -> Self::Future {
2260                            let inner = Arc::clone(&self.0);
2261                            let fut = async move {
2262                                <T as GreptimeDatabase>::handle(&inner, request).await
2263                            };
2264                            Box::pin(fut)
2265                        }
2266                    }
2267                    let accept_compression_encodings = self.accept_compression_encodings;
2268                    let send_compression_encodings = self.send_compression_encodings;
2269                    let max_decoding_message_size = self.max_decoding_message_size;
2270                    let max_encoding_message_size = self.max_encoding_message_size;
2271                    let inner = self.inner.clone();
2272                    let fut = async move {
2273                        let method = HandleSvc(inner);
2274                        let codec = tonic_prost::ProstCodec::default();
2275                        let mut grpc = tonic::server::Grpc::new(codec)
2276                            .apply_compression_config(
2277                                accept_compression_encodings,
2278                                send_compression_encodings,
2279                            )
2280                            .apply_max_message_size_config(
2281                                max_decoding_message_size,
2282                                max_encoding_message_size,
2283                            );
2284                        let res = grpc.unary(method, req).await;
2285                        Ok(res)
2286                    };
2287                    Box::pin(fut)
2288                }
2289                "/greptime.v1.GreptimeDatabase/HandleRequests" => {
2290                    #[allow(non_camel_case_types)]
2291                    struct HandleRequestsSvc<T: GreptimeDatabase>(pub Arc<T>);
2292                    impl<
2293                        T: GreptimeDatabase,
2294                    > tonic::server::ClientStreamingService<super::GreptimeRequest>
2295                    for HandleRequestsSvc<T> {
2296                        type Response = super::GreptimeResponse;
2297                        type Future = BoxFuture<
2298                            tonic::Response<Self::Response>,
2299                            tonic::Status,
2300                        >;
2301                        fn call(
2302                            &mut self,
2303                            request: tonic::Request<
2304                                tonic::Streaming<super::GreptimeRequest>,
2305                            >,
2306                        ) -> Self::Future {
2307                            let inner = Arc::clone(&self.0);
2308                            let fut = async move {
2309                                <T as GreptimeDatabase>::handle_requests(&inner, request)
2310                                    .await
2311                            };
2312                            Box::pin(fut)
2313                        }
2314                    }
2315                    let accept_compression_encodings = self.accept_compression_encodings;
2316                    let send_compression_encodings = self.send_compression_encodings;
2317                    let max_decoding_message_size = self.max_decoding_message_size;
2318                    let max_encoding_message_size = self.max_encoding_message_size;
2319                    let inner = self.inner.clone();
2320                    let fut = async move {
2321                        let method = HandleRequestsSvc(inner);
2322                        let codec = tonic_prost::ProstCodec::default();
2323                        let mut grpc = tonic::server::Grpc::new(codec)
2324                            .apply_compression_config(
2325                                accept_compression_encodings,
2326                                send_compression_encodings,
2327                            )
2328                            .apply_max_message_size_config(
2329                                max_decoding_message_size,
2330                                max_encoding_message_size,
2331                            );
2332                        let res = grpc.client_streaming(method, req).await;
2333                        Ok(res)
2334                    };
2335                    Box::pin(fut)
2336                }
2337                _ => {
2338                    Box::pin(async move {
2339                        let mut response = http::Response::new(
2340                            tonic::body::Body::default(),
2341                        );
2342                        let headers = response.headers_mut();
2343                        headers
2344                            .insert(
2345                                tonic::Status::GRPC_STATUS,
2346                                (tonic::Code::Unimplemented as i32).into(),
2347                            );
2348                        headers
2349                            .insert(
2350                                http::header::CONTENT_TYPE,
2351                                tonic::metadata::GRPC_CONTENT_TYPE,
2352                            );
2353                        Ok(response)
2354                    })
2355                }
2356            }
2357        }
2358    }
2359    impl<T> Clone for GreptimeDatabaseServer<T> {
2360        fn clone(&self) -> Self {
2361            let inner = self.inner.clone();
2362            Self {
2363                inner,
2364                accept_compression_encodings: self.accept_compression_encodings,
2365                send_compression_encodings: self.send_compression_encodings,
2366                max_decoding_message_size: self.max_decoding_message_size,
2367                max_encoding_message_size: self.max_encoding_message_size,
2368            }
2369        }
2370    }
2371    /// Generated gRPC service name
2372    pub const SERVICE_NAME: &str = "greptime.v1.GreptimeDatabase";
2373    impl<T> tonic::server::NamedService for GreptimeDatabaseServer<T> {
2374        const NAME: &'static str = SERVICE_NAME;
2375    }
2376}
2377#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2378pub struct HealthCheckRequest {}
2379#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2380pub struct HealthCheckResponse {}
2381/// Generated client implementations.
2382pub mod health_check_client {
2383    #![allow(
2384        unused_variables,
2385        dead_code,
2386        missing_docs,
2387        clippy::wildcard_imports,
2388        clippy::let_unit_value,
2389    )]
2390    use tonic::codegen::*;
2391    use tonic::codegen::http::Uri;
2392    #[derive(Debug, Clone)]
2393    pub struct HealthCheckClient<T> {
2394        inner: tonic::client::Grpc<T>,
2395    }
2396    impl HealthCheckClient<tonic::transport::Channel> {
2397        /// Attempt to create a new client by connecting to a given endpoint.
2398        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2399        where
2400            D: TryInto<tonic::transport::Endpoint>,
2401            D::Error: Into<StdError>,
2402        {
2403            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2404            Ok(Self::new(conn))
2405        }
2406    }
2407    impl<T> HealthCheckClient<T>
2408    where
2409        T: tonic::client::GrpcService<tonic::body::Body>,
2410        T::Error: Into<StdError>,
2411        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2412        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2413    {
2414        pub fn new(inner: T) -> Self {
2415            let inner = tonic::client::Grpc::new(inner);
2416            Self { inner }
2417        }
2418        pub fn with_origin(inner: T, origin: Uri) -> Self {
2419            let inner = tonic::client::Grpc::with_origin(inner, origin);
2420            Self { inner }
2421        }
2422        pub fn with_interceptor<F>(
2423            inner: T,
2424            interceptor: F,
2425        ) -> HealthCheckClient<InterceptedService<T, F>>
2426        where
2427            F: tonic::service::Interceptor,
2428            T::ResponseBody: Default,
2429            T: tonic::codegen::Service<
2430                http::Request<tonic::body::Body>,
2431                Response = http::Response<
2432                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
2433                >,
2434            >,
2435            <T as tonic::codegen::Service<
2436                http::Request<tonic::body::Body>,
2437            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2438        {
2439            HealthCheckClient::new(InterceptedService::new(inner, interceptor))
2440        }
2441        /// Compress requests with the given encoding.
2442        ///
2443        /// This requires the server to support it otherwise it might respond with an
2444        /// error.
2445        #[must_use]
2446        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2447            self.inner = self.inner.send_compressed(encoding);
2448            self
2449        }
2450        /// Enable decompressing responses.
2451        #[must_use]
2452        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2453            self.inner = self.inner.accept_compressed(encoding);
2454            self
2455        }
2456        /// Limits the maximum size of a decoded message.
2457        ///
2458        /// Default: `4MB`
2459        #[must_use]
2460        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2461            self.inner = self.inner.max_decoding_message_size(limit);
2462            self
2463        }
2464        /// Limits the maximum size of an encoded message.
2465        ///
2466        /// Default: `usize::MAX`
2467        #[must_use]
2468        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2469            self.inner = self.inner.max_encoding_message_size(limit);
2470            self
2471        }
2472        pub async fn health_check(
2473            &mut self,
2474            request: impl tonic::IntoRequest<super::HealthCheckRequest>,
2475        ) -> std::result::Result<
2476            tonic::Response<super::HealthCheckResponse>,
2477            tonic::Status,
2478        > {
2479            self.inner
2480                .ready()
2481                .await
2482                .map_err(|e| {
2483                    tonic::Status::unknown(
2484                        format!("Service was not ready: {}", e.into()),
2485                    )
2486                })?;
2487            let codec = tonic_prost::ProstCodec::default();
2488            let path = http::uri::PathAndQuery::from_static(
2489                "/greptime.v1.HealthCheck/HealthCheck",
2490            );
2491            let mut req = request.into_request();
2492            req.extensions_mut()
2493                .insert(GrpcMethod::new("greptime.v1.HealthCheck", "HealthCheck"));
2494            self.inner.unary(req, path, codec).await
2495        }
2496    }
2497}
2498/// Generated server implementations.
2499pub mod health_check_server {
2500    #![allow(
2501        unused_variables,
2502        dead_code,
2503        missing_docs,
2504        clippy::wildcard_imports,
2505        clippy::let_unit_value,
2506    )]
2507    use tonic::codegen::*;
2508    /// Generated trait containing gRPC methods that should be implemented for use with HealthCheckServer.
2509    #[async_trait]
2510    pub trait HealthCheck: std::marker::Send + std::marker::Sync + 'static {
2511        async fn health_check(
2512            &self,
2513            request: tonic::Request<super::HealthCheckRequest>,
2514        ) -> std::result::Result<
2515            tonic::Response<super::HealthCheckResponse>,
2516            tonic::Status,
2517        >;
2518    }
2519    #[derive(Debug)]
2520    pub struct HealthCheckServer<T> {
2521        inner: Arc<T>,
2522        accept_compression_encodings: EnabledCompressionEncodings,
2523        send_compression_encodings: EnabledCompressionEncodings,
2524        max_decoding_message_size: Option<usize>,
2525        max_encoding_message_size: Option<usize>,
2526    }
2527    impl<T> HealthCheckServer<T> {
2528        pub fn new(inner: T) -> Self {
2529            Self::from_arc(Arc::new(inner))
2530        }
2531        pub fn from_arc(inner: Arc<T>) -> Self {
2532            Self {
2533                inner,
2534                accept_compression_encodings: Default::default(),
2535                send_compression_encodings: Default::default(),
2536                max_decoding_message_size: None,
2537                max_encoding_message_size: None,
2538            }
2539        }
2540        pub fn with_interceptor<F>(
2541            inner: T,
2542            interceptor: F,
2543        ) -> InterceptedService<Self, F>
2544        where
2545            F: tonic::service::Interceptor,
2546        {
2547            InterceptedService::new(Self::new(inner), interceptor)
2548        }
2549        /// Enable decompressing requests with the given encoding.
2550        #[must_use]
2551        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2552            self.accept_compression_encodings.enable(encoding);
2553            self
2554        }
2555        /// Compress responses with the given encoding, if the client supports it.
2556        #[must_use]
2557        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2558            self.send_compression_encodings.enable(encoding);
2559            self
2560        }
2561        /// Limits the maximum size of a decoded message.
2562        ///
2563        /// Default: `4MB`
2564        #[must_use]
2565        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2566            self.max_decoding_message_size = Some(limit);
2567            self
2568        }
2569        /// Limits the maximum size of an encoded message.
2570        ///
2571        /// Default: `usize::MAX`
2572        #[must_use]
2573        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2574            self.max_encoding_message_size = Some(limit);
2575            self
2576        }
2577    }
2578    impl<T, B> tonic::codegen::Service<http::Request<B>> for HealthCheckServer<T>
2579    where
2580        T: HealthCheck,
2581        B: Body + std::marker::Send + 'static,
2582        B::Error: Into<StdError> + std::marker::Send + 'static,
2583    {
2584        type Response = http::Response<tonic::body::Body>;
2585        type Error = std::convert::Infallible;
2586        type Future = BoxFuture<Self::Response, Self::Error>;
2587        fn poll_ready(
2588            &mut self,
2589            _cx: &mut Context<'_>,
2590        ) -> Poll<std::result::Result<(), Self::Error>> {
2591            Poll::Ready(Ok(()))
2592        }
2593        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2594            match req.uri().path() {
2595                "/greptime.v1.HealthCheck/HealthCheck" => {
2596                    #[allow(non_camel_case_types)]
2597                    struct HealthCheckSvc<T: HealthCheck>(pub Arc<T>);
2598                    impl<
2599                        T: HealthCheck,
2600                    > tonic::server::UnaryService<super::HealthCheckRequest>
2601                    for HealthCheckSvc<T> {
2602                        type Response = super::HealthCheckResponse;
2603                        type Future = BoxFuture<
2604                            tonic::Response<Self::Response>,
2605                            tonic::Status,
2606                        >;
2607                        fn call(
2608                            &mut self,
2609                            request: tonic::Request<super::HealthCheckRequest>,
2610                        ) -> Self::Future {
2611                            let inner = Arc::clone(&self.0);
2612                            let fut = async move {
2613                                <T as HealthCheck>::health_check(&inner, request).await
2614                            };
2615                            Box::pin(fut)
2616                        }
2617                    }
2618                    let accept_compression_encodings = self.accept_compression_encodings;
2619                    let send_compression_encodings = self.send_compression_encodings;
2620                    let max_decoding_message_size = self.max_decoding_message_size;
2621                    let max_encoding_message_size = self.max_encoding_message_size;
2622                    let inner = self.inner.clone();
2623                    let fut = async move {
2624                        let method = HealthCheckSvc(inner);
2625                        let codec = tonic_prost::ProstCodec::default();
2626                        let mut grpc = tonic::server::Grpc::new(codec)
2627                            .apply_compression_config(
2628                                accept_compression_encodings,
2629                                send_compression_encodings,
2630                            )
2631                            .apply_max_message_size_config(
2632                                max_decoding_message_size,
2633                                max_encoding_message_size,
2634                            );
2635                        let res = grpc.unary(method, req).await;
2636                        Ok(res)
2637                    };
2638                    Box::pin(fut)
2639                }
2640                _ => {
2641                    Box::pin(async move {
2642                        let mut response = http::Response::new(
2643                            tonic::body::Body::default(),
2644                        );
2645                        let headers = response.headers_mut();
2646                        headers
2647                            .insert(
2648                                tonic::Status::GRPC_STATUS,
2649                                (tonic::Code::Unimplemented as i32).into(),
2650                            );
2651                        headers
2652                            .insert(
2653                                http::header::CONTENT_TYPE,
2654                                tonic::metadata::GRPC_CONTENT_TYPE,
2655                            );
2656                        Ok(response)
2657                    })
2658                }
2659            }
2660        }
2661    }
2662    impl<T> Clone for HealthCheckServer<T> {
2663        fn clone(&self) -> Self {
2664            let inner = self.inner.clone();
2665            Self {
2666                inner,
2667                accept_compression_encodings: self.accept_compression_encodings,
2668                send_compression_encodings: self.send_compression_encodings,
2669                max_decoding_message_size: self.max_decoding_message_size,
2670                max_encoding_message_size: self.max_encoding_message_size,
2671            }
2672        }
2673    }
2674    /// Generated gRPC service name
2675    pub const SERVICE_NAME: &str = "greptime.v1.HealthCheck";
2676    impl<T> tonic::server::NamedService for HealthCheckServer<T> {
2677        const NAME: &'static str = SERVICE_NAME;
2678    }
2679}
2680/// Write hint of the mutation.
2681#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2682pub struct WriteHint {
2683    #[prost(enumeration = "PrimaryKeyEncoding", tag = "1")]
2684    pub primary_key_encoding: i32,
2685}
2686/// Mutation contains updates to a set of rows.
2687#[derive(Clone, PartialEq, ::prost::Message)]
2688pub struct Mutation {
2689    /// Type of this mutation.
2690    #[prost(enumeration = "OpType", tag = "1")]
2691    pub op_type: i32,
2692    /// Start WAL sequence of this mutation.
2693    #[prost(uint64, tag = "2")]
2694    pub sequence: u64,
2695    /// Row updates to write to the WAL.
2696    #[prost(message, optional, tag = "3")]
2697    pub rows: ::core::option::Option<Rows>,
2698    /// Write hint of the mutation.
2699    #[prost(message, optional, tag = "4")]
2700    pub write_hint: ::core::option::Option<WriteHint>,
2701}
2702/// A WAL entry contains a list of mutations for a region to write.
2703#[derive(Clone, PartialEq, ::prost::Message)]
2704pub struct WalEntry {
2705    /// List of mutations for a region.
2706    #[prost(message, repeated, tag = "1")]
2707    pub mutations: ::prost::alloc::vec::Vec<Mutation>,
2708    /// List of bulk insert requests.
2709    #[prost(message, repeated, tag = "2")]
2710    pub bulk_entries: ::prost::alloc::vec::Vec<BulkWalEntry>,
2711}
2712#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2713pub struct BulkWalEntry {
2714    /// Start WAL sequence of this entry.
2715    #[prost(uint64, tag = "1")]
2716    pub sequence: u64,
2717    /// Max timestamp value.
2718    #[prost(int64, tag = "2")]
2719    pub max_ts: i64,
2720    /// Min timestamp value.
2721    #[prost(int64, tag = "3")]
2722    pub min_ts: i64,
2723    /// Timestamp column index.
2724    #[prost(uint32, tag = "4")]
2725    pub timestamp_index: u32,
2726    #[prost(oneof = "bulk_wal_entry::Body", tags = "5")]
2727    pub body: ::core::option::Option<bulk_wal_entry::Body>,
2728}
2729/// Nested message and enum types in `BulkWalEntry`.
2730pub mod bulk_wal_entry {
2731    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
2732    pub enum Body {
2733        #[prost(message, tag = "5")]
2734        ArrowIpc(super::ArrowIpc),
2735    }
2736}
2737/// Type of operation to rows.
2738#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2739#[repr(i32)]
2740pub enum OpType {
2741    /// Delete rows.
2742    Delete = 0,
2743    /// Put rows.
2744    Put = 1,
2745}
2746impl OpType {
2747    /// String value of the enum field names used in the ProtoBuf definition.
2748    ///
2749    /// The values are not transformed in any way and thus are considered stable
2750    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2751    pub fn as_str_name(&self) -> &'static str {
2752        match self {
2753            Self::Delete => "DELETE",
2754            Self::Put => "PUT",
2755        }
2756    }
2757    /// Creates an enum from field names used in the ProtoBuf definition.
2758    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2759        match value {
2760            "DELETE" => Some(Self::Delete),
2761            "PUT" => Some(Self::Put),
2762            _ => None,
2763        }
2764    }
2765}
2766/// Encoding of primary key.
2767#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
2768#[repr(i32)]
2769pub enum PrimaryKeyEncoding {
2770    Dense = 0,
2771    Sparse = 1,
2772}
2773impl PrimaryKeyEncoding {
2774    /// String value of the enum field names used in the ProtoBuf definition.
2775    ///
2776    /// The values are not transformed in any way and thus are considered stable
2777    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2778    pub fn as_str_name(&self) -> &'static str {
2779        match self {
2780            Self::Dense => "DENSE",
2781            Self::Sparse => "SPARSE",
2782        }
2783    }
2784    /// Creates an enum from field names used in the ProtoBuf definition.
2785    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2786        match value {
2787            "DENSE" => Some(Self::Dense),
2788            "SPARSE" => Some(Self::Sparse),
2789            _ => None,
2790        }
2791    }
2792}