1use risingwave_compactor::CompactorOpts;
16use risingwave_compute::ComputeNodeOpts;
17use risingwave_ctl::CliOpts as CtlOpts;
18use risingwave_frontend::FrontendOpts;
19use risingwave_meta_node::MetaNodeOpts;
20use risingwave_rt::{LoggerSettings, init_risingwave_logger, main_okk};
21
22#[macro_export]
24macro_rules! main {
25 ($component:ident) => {
26 risingwave_common::enable_jemalloc!();
27
28 #[cfg_attr(coverage, coverage(off))]
29 fn main() {
30 let opts = clap::Parser::parse();
31 $crate::$component(opts);
32 }
33 };
34}
35
36risingwave_batch_executors::enable!();
37risingwave_expr_impl::enable!();
38
39pub fn compute(opts: ComputeNodeOpts) -> ! {
42 init_risingwave_logger(LoggerSettings::from_opts(&opts));
43 main_okk(|shutdown| risingwave_compute::start(opts, shutdown));
44}
45
46pub fn meta(opts: MetaNodeOpts) -> ! {
47 init_risingwave_logger(LoggerSettings::from_opts(&opts));
48 main_okk(|shutdown| risingwave_meta_node::start(opts, shutdown));
49}
50
51pub fn frontend(opts: FrontendOpts) -> ! {
52 init_risingwave_logger(LoggerSettings::from_opts(&opts));
53 main_okk(|shutdown| risingwave_frontend::start(opts, shutdown));
54}
55
56pub fn compactor(opts: CompactorOpts) -> ! {
57 init_risingwave_logger(LoggerSettings::from_opts(&opts));
58 main_okk(|shutdown| risingwave_compactor::start(opts, shutdown));
59}
60
61pub fn ctl(opts: CtlOpts) -> ! {
62 init_risingwave_logger(LoggerSettings::new("ctl").stderr(true));
63 main_okk(|shutdown| risingwave_ctl::start(opts, shutdown));
64}