-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
38 lines (31 loc) · 827 Bytes
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use clap::Parser;
mod leader;
mod replica;
#[derive(clap::ValueEnum, Debug, Clone)]
enum Service {
Leader,
Replica,
}
#[derive(Parser, Debug)]
struct Args {
#[clap(long)]
service: Service,
#[clap(long, default_value = "0.0.0.0")]
prometheus_host: String,
#[clap(long, default_value = "-1")]
prometheus_port: i32,
#[clap(flatten)]
leader: leader::LeaderArgs,
#[clap(flatten)]
replica: replica::ReplicaArgs,
}
#[tokio::main]
async fn main() {
let args = Args::parse();
frankenpaxos::serve_prometheus(args.prometheus_host, args.prometheus_port);
let ports = hydroflow::util::cli::init().await;
match args.service {
Service::Leader => leader::run(args.leader, ports).await,
Service::Replica => replica::run(args.replica, ports).await,
};
}