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
use crate::PARTITION_API;
use k8_obj_metadata::Crd;
use k8_obj_metadata::Spec;
use k8_obj_metadata::DefaultHeader;
use serde::Deserialize;
use serde::Serialize;
use super::PartitionStatus;
impl Spec for PartitionSpec {
type Header = DefaultHeader;
type Status = PartitionStatus;
fn metadata() -> &'static Crd {
&PARTITION_API
}
}
#[derive(Deserialize, Serialize, Debug, PartialEq, Default, Clone)]
#[serde(rename_all = "camelCase")]
pub struct PartitionSpec {
pub leader: i32,
pub replicas: Vec<i32>,
}
impl PartitionSpec {
pub fn new(leader: i32, replicas: Vec<i32>) -> Self {
PartitionSpec { leader, replicas }
}
}