Skip to main content

fluss/rpc/message/
list_tables.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18use crate::{impl_read_version_type, impl_write_version_type, proto};
19
20use crate::proto::ListTablesResponse;
21use crate::rpc::frame::ReadError;
22
23use crate::rpc::api_key::ApiKey;
24use crate::rpc::api_version::ApiVersion;
25use crate::rpc::frame::WriteError;
26use crate::rpc::message::{ReadVersionedType, RequestBody, WriteVersionedType};
27
28use bytes::{Buf, BufMut};
29use prost::Message;
30
31#[derive(Debug)]
32pub struct ListTablesRequest {
33    pub inner_request: proto::ListTablesRequest,
34}
35
36impl ListTablesRequest {
37    pub fn new(database_name: &str) -> Self {
38        ListTablesRequest {
39            inner_request: proto::ListTablesRequest {
40                database_name: database_name.to_string(),
41            },
42        }
43    }
44}
45
46impl RequestBody for ListTablesRequest {
47    type ResponseBody = ListTablesResponse;
48
49    const API_KEY: ApiKey = ApiKey::ListTables;
50
51    const REQUEST_VERSION: ApiVersion = ApiVersion(0);
52}
53
54impl_write_version_type!(ListTablesRequest);
55impl_read_version_type!(ListTablesResponse);