palladium_cli/commands/consensus/
types.rs1use clap::{Args, Subcommand};
2use schemars::JsonSchema;
3use serde::Serialize;
4
5#[derive(Subcommand, Debug, Serialize, JsonSchema)]
6#[serde(rename_all = "kebab-case")]
7pub enum ConsensusCommand {
8 #[command(subcommand)]
10 Group(ConsensusGroupCommand),
11 #[command(subcommand)]
13 Binding(ConsensusBindingCommand),
14 Propose(ConsensusProposeArgs),
16 Read(ConsensusReadArgs),
18 #[command(subcommand)]
20 Engine(ConsensusEngineCommand),
21}
22
23#[derive(Subcommand, Debug, Serialize, JsonSchema)]
24#[serde(rename_all = "kebab-case")]
25pub enum ConsensusGroupCommand {
26 Create(ConsensusGroupCreateArgs),
28 Attach(ConsensusGroupAttachArgs),
30 List(ConsensusGroupListArgs),
32 Detach(ConsensusGroupDetachArgs),
34 Delete(ConsensusGroupDeleteArgs),
36 Members(ConsensusGroupMembersArgs),
38 Status(ConsensusGroupStatusArgs),
40}
41
42#[derive(Subcommand, Debug, Serialize, JsonSchema)]
43#[serde(rename_all = "kebab-case")]
44pub enum ConsensusEngineCommand {
45 Status(ConsensusEngineStatusArgs),
47 Config(ConsensusEngineConfigArgs),
49}
50
51#[derive(Subcommand, Debug, Serialize, JsonSchema)]
52#[serde(rename_all = "kebab-case")]
53pub enum ConsensusBindingCommand {
54 List(ConsensusBindingListArgs),
56}
57
58#[derive(Args, Debug, Serialize, JsonSchema)]
59#[serde(rename_all = "kebab-case")]
60pub struct ConsensusGroupCreateArgs {
61 #[arg(long)]
63 pub name: String,
64 #[arg(long = "member")]
66 pub members: Vec<String>,
67 #[arg(long)]
69 pub heartbeat_interval_ms: Option<u64>,
70 #[arg(long)]
72 pub election_timeout_min_ms: Option<u64>,
73 #[arg(long)]
75 pub election_timeout_max_ms: Option<u64>,
76 #[arg(long)]
78 pub snapshot_interval: Option<u64>,
79 #[arg(long)]
81 pub json: bool,
82}
83
84#[derive(Args, Debug, Serialize, JsonSchema)]
85#[serde(rename_all = "kebab-case")]
86pub struct ConsensusGroupAttachArgs {
87 #[arg(long)]
89 pub group: String,
90 #[arg(long)]
92 pub path: String,
93 #[arg(long)]
95 pub json: bool,
96}
97
98#[derive(Args, Debug, Serialize, JsonSchema)]
99#[serde(rename_all = "kebab-case")]
100pub struct ConsensusGroupListArgs {
101 #[arg(long)]
103 pub json: bool,
104}
105
106#[derive(Args, Debug, Serialize, JsonSchema)]
107#[serde(rename_all = "kebab-case")]
108pub struct ConsensusGroupDetachArgs {
109 #[arg(long)]
111 pub group: String,
112 #[arg(long)]
114 pub path: String,
115 #[arg(long)]
117 pub json: bool,
118}
119
120#[derive(Args, Debug, Serialize, JsonSchema)]
121#[serde(rename_all = "kebab-case")]
122pub struct ConsensusGroupDeleteArgs {
123 #[arg(long)]
125 pub name: String,
126 #[arg(long)]
128 pub json: bool,
129}
130
131#[derive(Args, Debug, Serialize, JsonSchema)]
132#[serde(rename_all = "kebab-case")]
133pub struct ConsensusGroupMembersArgs {
134 #[arg(long)]
136 pub group: String,
137 #[arg(long)]
139 pub json: bool,
140}
141
142#[derive(Args, Debug, Serialize, JsonSchema)]
143#[serde(rename_all = "kebab-case")]
144pub struct ConsensusGroupStatusArgs {
145 #[arg(long)]
147 pub group: String,
148 #[arg(long)]
150 pub json: bool,
151}
152
153#[derive(Args, Debug, Serialize, JsonSchema)]
154#[serde(rename_all = "kebab-case")]
155pub struct ConsensusProposeArgs {
156 #[arg(long)]
158 pub group: String,
159 pub payload: String,
161 #[arg(long)]
163 pub json: bool,
164}
165
166#[derive(Args, Debug, Serialize, JsonSchema)]
167#[serde(rename_all = "kebab-case")]
168pub struct ConsensusReadArgs {
169 #[arg(long)]
171 pub group: String,
172 pub query: String,
174 #[arg(long)]
176 pub json: bool,
177}
178
179#[derive(Args, Debug, Serialize, JsonSchema)]
180#[serde(rename_all = "kebab-case")]
181pub struct ConsensusEngineStatusArgs {
182 #[arg(long)]
184 pub json: bool,
185}
186
187#[derive(Args, Debug, Serialize, JsonSchema)]
188#[serde(rename_all = "kebab-case")]
189pub struct ConsensusEngineConfigArgs {
190 #[arg(long)]
192 pub json: bool,
193}
194
195#[derive(Args, Debug, Serialize, JsonSchema)]
196#[serde(rename_all = "kebab-case")]
197pub struct ConsensusBindingListArgs {
198 #[arg(long)]
200 pub json: bool,
201}