diff --git a/src/traft/failover.rs b/src/traft/failover.rs index c9510fbd37d8a1e7ed150fd51df2dbe25ccd9a3a..ca68f1f44d5fb3132d69b928f38641455fb97e08 100644 --- a/src/traft/failover.rs +++ b/src/traft/failover.rs @@ -24,7 +24,7 @@ pub fn on_shutdown() { cluster_id: Storage::cluster_id() .unwrap() .expect("cluster_id must be present"), - active: false, + is_active: false, }; let fn_name = stringify_cfunc!(raft_deactivate); diff --git a/src/traft/mod.rs b/src/traft/mod.rs index 18858bce79f8b3797590d5170c93d579d196a500..08d05ab053c3b3aeadc62849926dbab5f9f9aa5a 100644 --- a/src/traft/mod.rs +++ b/src/traft/mod.rs @@ -144,7 +144,7 @@ pub struct Peer { pub commit_index: u64, /// Is this instance active. Instances become inactive when they shut down. - pub active: bool, + pub is_active: bool, } impl AsTuple for Peer {} @@ -432,7 +432,7 @@ impl AsTuple for JoinResponse {} pub struct SetActiveRequest { pub cluster_id: String, pub instance_id: String, - pub active: bool, + pub is_active: bool, } impl AsTuple for SetActiveRequest {} diff --git a/src/traft/node.rs b/src/traft/node.rs index 40097a2790a7a74e062837cb7a010f7540007701..9f273fa4d7cc6d9bf1c34e6729a54993c9a20951 100644 --- a/src/traft/node.rs +++ b/src/traft/node.rs @@ -594,7 +594,7 @@ fn raft_main_loop( TopologyRequest::SetActive(SetActiveRequest { instance_id, - active, + is_active: active, .. }) => topology.set_active(instance_id, active), }; @@ -887,7 +887,7 @@ fn raft_conf_change_loop( let peers: HashMap<RaftId, bool> = Storage::peers() .unwrap() .iter() - .map(|peer| (peer.raft_id, peer.active)) + .map(|peer| (peer.raft_id, peer.is_active)) .collect(); let mut changes: Vec<raft::ConfChangeSingle> = Vec::new(); diff --git a/src/traft/storage.rs b/src/traft/storage.rs index 29a6f6238ce382a91977550640443eed017cbbac..5fded69f0dd4928e5bcf051911937ea2917a7bee 100644 --- a/src/traft/storage.rs +++ b/src/traft/storage.rs @@ -79,7 +79,7 @@ impl Storage { {name = 'replicaset_id', type = 'string', is_nullable = false}, {name = 'replicaset_uuid', type = 'string', is_nullable = false}, {name = 'commit_index', type = 'unsigned', is_nullable = false}, - {name = 'active', type = 'boolean', is_nullable = false}, + {name = 'is_active', type = 'boolean', is_nullable = false}, } }) diff --git a/src/traft/topology.rs b/src/traft/topology.rs index ba065d0a2be02f09deb8044bba6a6d1267beaeee..45e818a673261b92922b32dd5ec8a4bccc5849e4 100644 --- a/src/traft/topology.rs +++ b/src/traft/topology.rs @@ -87,7 +87,7 @@ impl Topology { if let Some(id) = instance_id.as_ref() { let existing_peer: Option<&Peer> = self.instance_map.get(id); - if matches!(existing_peer, Some(peer) if peer.active) { + if matches!(existing_peer, Some(peer) if peer.is_active) { let e = format!("{} is already joined", id); return Err(e); } @@ -108,7 +108,7 @@ impl Topology { replicaset_id, replicaset_uuid, commit_index: INVALID_INDEX, - active: true, + is_active: true, }; self.put_peer(peer.clone()); @@ -136,7 +136,7 @@ impl Topology { .get_mut(&instance_id) .ok_or_else(|| format!("unknown instance {}", instance_id))?; - peer.active = active; + peer.is_active = active; Ok(peer.clone()) } }