fluss/rpc/message/
get_table.rs1use crate::proto::{GetTableInfoRequest, GetTableInfoResponse, PbTablePath};
19use crate::rpc::api_key::ApiKey;
20use crate::rpc::api_version::ApiVersion;
21use crate::rpc::frame::WriteError;
22use crate::rpc::message::{ReadVersionedType, RequestBody, WriteVersionedType};
23
24use crate::metadata::TablePath;
25use crate::rpc::frame::ReadError;
26
27use crate::{impl_read_version_type, impl_write_version_type};
28use bytes::{Buf, BufMut};
29use prost::Message;
30
31#[derive(Debug)]
32pub struct GetTableRequest {
33 pub inner_request: GetTableInfoRequest,
34}
35
36impl GetTableRequest {
37 pub fn new(table_path: &TablePath) -> Self {
38 let inner_request = GetTableInfoRequest {
39 table_path: PbTablePath {
40 database_name: table_path.database().to_owned(),
41 table_name: table_path.table().to_owned(),
42 },
43 };
44
45 Self { inner_request }
46 }
47}
48
49impl RequestBody for GetTableRequest {
50 type ResponseBody = GetTableInfoResponse;
51 const API_KEY: ApiKey = ApiKey::GetTable;
52 const REQUEST_VERSION: ApiVersion = ApiVersion(0);
53}
54
55impl_write_version_type!(GetTableRequest);
56impl_read_version_type!(GetTableInfoResponse);