opensrv_clickhouse/protocols/
mod.rs

1// Copyright 2021 Datafuse Labs.
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
15mod protocol_exception;
16mod protocol_hello;
17mod protocol_query;
18mod protocol_type;
19
20pub use protocol_exception::*;
21pub use protocol_hello::*;
22pub use protocol_query::*;
23pub use protocol_type::*;
24
25use crate::types::Block;
26
27#[derive(Debug)]
28pub enum Packet {
29    Ping,
30    Cancel,
31    Hello(HelloRequest),
32    Query(QueryRequest),
33    Data(Block),
34}
35
36#[derive(Debug, Default)]
37pub enum Stage {
38    #[default]
39    Default = 0,
40    InsertPrepare,
41    InsertStarted,
42    EOS,
43}
44
45pub const DBMS_MIN_REVISION_WITH_CLIENT_INFO: u64 = 54032;
46pub const DBMS_MIN_REVISION_WITH_SERVER_TIMEZONE: u64 = 54058;
47pub const DBMS_MIN_REVISION_WITH_QUOTA_KEY_IN_CLIENT_INFO: u64 = 54060;
48pub const DBMS_MIN_REVISION_WITH_TABLES_STATUS: u64 = 54226;
49pub const DBMS_MIN_REVISION_WITH_TIME_ZONE_PARAMETER_IN_DATETIME_DATA_TYPE: u64 = 54337;
50pub const DBMS_MIN_REVISION_WITH_SERVER_DISPLAY_NAME: u64 = 54372;
51pub const DBMS_MIN_REVISION_WITH_VERSION_PATCH: u64 = 54401;
52pub const DBMS_MIN_REVISION_WITH_SERVER_LOGS: u64 = 54406;
53pub const DBMS_MIN_REVISION_WITH_CLIENT_SUPPORT_EMBEDDED_DATA: u64 = 54415;
54// Minimum revision with exactly the same set of aggregation methods and rules to select them.
55// Two-level (bucketed) aggregation is incompatible if servers are inconsistent in these rules
56// (keys will be placed in different buckets and result will not be fully aggregated).
57pub const DBMS_MIN_REVISION_WITH_CURRENT_AGGREGATION_VARIANT_SELECTION_METHOD: u64 = 54431;
58pub const DBMS_MIN_REVISION_WITH_COLUMN_DEFAULTS_METADATA: u64 = 54410;
59
60pub const DBMS_MIN_REVISION_WITH_LOW_CARDINALITY_TYPE: u64 = 54405;
61pub const DBMS_MIN_REVISION_WITH_CLIENT_WRITE_INFO: u64 = 54420;
62
63// Minimum revision supporting SettingsBinaryFormat::STRINGS.
64pub const DBMS_MIN_REVISION_WITH_SETTINGS_SERIALIZED_AS_STRINGS: u64 = 54429;
65
66// Minimum revision supporting OpenTelemetry
67pub const DBMS_MIN_REVISION_WITH_OPENTELEMETRY: u64 = 54442;
68
69// Minimum revision supporting interserver secret.
70pub const DBMS_MIN_REVISION_WITH_INTERSERVER_SECRET: u64 = 54441;
71
72pub const DBMS_MIN_REVISION_WITH_X_FORWARDED_FOR_IN_CLIENT_INFO: u64 = 54443;
73pub const DBMS_MIN_REVISION_WITH_REFERER_IN_CLIENT_INFO: u64 = 54447;