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