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
use kvproto::pdpb::*;
use super::*;
#[derive(Debug)]
pub struct AlreadyBootstrapped;
impl PdMocker for AlreadyBootstrapped {
fn bootstrap(&self, _: &BootstrapRequest) -> Option<Result<BootstrapResponse>> {
let mut err = Error::default();
err.set_type(ErrorType::AlreadyBootstrapped);
err.set_message("cluster is already bootstrapped".to_owned());
let mut header = ResponseHeader::default();
header.set_error(err);
header.set_cluster_id(DEFAULT_CLUSTER_ID);
let mut resp = BootstrapResponse::default();
resp.set_header(header);
Some(Ok(resp))
}
fn is_bootstrapped(&self, _: &IsBootstrappedRequest) -> Option<Result<IsBootstrappedResponse>> {
let mut header = ResponseHeader::default();
header.set_cluster_id(DEFAULT_CLUSTER_ID);
let mut resp = IsBootstrappedResponse::default();
resp.set_bootstrapped(false);
Some(Ok(resp))
}
}