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