Garage v1.0 #683

Merged
lx merged 119 commits from next-0.10 into main 2024-04-10 15:23:13 +00:00
Showing only changes of commit 25c196f34d - Show all commits

View file

@ -70,9 +70,7 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
); );
} }
Some(n) => { Some(n) => {
if n.role.is_none() { n.role = Some(role);
n.role = Some(role);
}
} }
} }
} }
@ -81,15 +79,21 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
for ver in layout.versions().iter().rev().skip(1) { for ver in layout.versions().iter().rev().skip(1) {
for (id, _, role) in ver.roles.items().iter() { for (id, _, role) in ver.roles.items().iter() {
if let layout::NodeRoleV(Some(r)) = role { if let layout::NodeRoleV(Some(r)) = role {
if !nodes.contains_key(id) && r.capacity.is_some() { if r.capacity.is_some() {
nodes.insert( if let Some(n) = nodes.get_mut(id) {
*id, if n.role.is_none() {
NodeResp { n.draining = true;
id: hex::encode(id), }
draining: true, } else {
..Default::default() nodes.insert(
}, *id,
); NodeResp {
id: hex::encode(id),
draining: true,
..Default::default()
},
);
}
} }
} }
} }