// Copyright 2023 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #pragma once #include #include #include #include namespace DB { namespace ErrorCodes { extern const int LOGICAL_ERROR; extern const int TOO_LARGE_ARRAY_SIZE; } // namespace ErrorCodes class ReadBuffer; class WriteBuffer; /// The following are request-response messages for TablesStatus request of the client-server protocol. /// Client can ask for about a set of tables and the server will respond with the following information for each table: /// - Is the table Replicated? /// - If yes, replication delay for that table. /// /// For nonexistent tables there will be no TableStatus entry in the response. struct TableStatus { bool is_replicated = false; UInt32 absolute_delay = 0; void write(WriteBuffer & out) const; void read(ReadBuffer & in); }; struct TablesStatusRequest { std::unordered_set tables; void write(WriteBuffer & out) const; void read(ReadBuffer & in); }; struct TablesStatusResponse { std::unordered_map table_states_by_id; void write(WriteBuffer & out) const; void read(ReadBuffer & in); }; } // namespace DB