cli/
lib.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#![allow(clippy::print_stdout)]
16mod bench;
17mod data;
18mod database;
19pub mod error;
20mod metadata;
21
22use async_trait::async_trait;
23use clap::Parser;
24use common_error::ext::BoxedError;
25pub use database::DatabaseClient;
26use error::Result;
27
28pub use crate::bench::BenchTableMetadataCommand;
29pub use crate::data::DataCommand;
30pub use crate::metadata::MetadataCommand;
31
32#[async_trait]
33pub trait Tool: Send + Sync {
34    async fn do_work(&self) -> std::result::Result<(), BoxedError>;
35}
36
37#[derive(Debug, Parser)]
38pub(crate) struct AttachCommand {
39    #[clap(long)]
40    pub(crate) grpc_addr: String,
41    #[clap(long)]
42    pub(crate) meta_addr: Option<String>,
43    #[clap(long, action)]
44    pub(crate) disable_helper: bool,
45}
46
47impl AttachCommand {
48    #[allow(dead_code)]
49    async fn build(self) -> Result<Box<dyn Tool>> {
50        unimplemented!("Wait for https://github.com/GreptimeTeam/greptimedb/issues/2373")
51    }
52}