Skip to content

Commit

Permalink
rename Application to Cluster
Browse files Browse the repository at this point in the history
this change makes configuration names more coherent with other software,
and indicates clearly that a Cluster corresponds to a set of servers and
configures its load balancing and other parameters (some HTTP routing
specific data wil be moved out of the Cluster struct)
  • Loading branch information
Geal authored and FlorentinDUBOIS committed Jul 13, 2022
1 parent cf59369 commit f4f05b4
Show file tree
Hide file tree
Showing 37 changed files with 673 additions and 674 deletions.
2 changes: 1 addition & 1 deletion bin/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl std::convert::Into<sozu_command::proxy::Route> for Route {
fn into(self) -> sozu_command::proxy::Route {
match self {
Route::Deny => sozu_command::proxy::Route::Deny,
Route::Id { id } => sozu_command::proxy::Route::AppId(id),
Route::Id { id } => sozu_command::proxy::Route::ClusterId(id),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions bin/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl CommandServer {

self.backends_count = self.state.count_backends();
self.frontends_count = self.state.count_frontends();
gauge!("configuration.applications", self.state.applications.len());
gauge!("configuration.clusters", self.state.clusters.len());
gauge!("configuration.backends", self.backends_count);
gauge!("configuration.frontends", self.frontends_count);
}
Expand Down Expand Up @@ -541,7 +541,7 @@ pub fn start(
.load_state(None, "INITIALIZATION".to_string(), &path)
.await;
}
gauge!("configuration.applications", server.state.applications.len());
gauge!("configuration.clusters", server.state.clusters.len());
gauge!("configuration.backends", server.backends_count);
gauge!("configuration.frontends", server.frontends_count);

Expand Down
27 changes: 14 additions & 13 deletions bin/src/command/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl CommandServer {

self.backends_count = self.state.count_backends();
self.frontends_count = self.state.count_frontends();
gauge!("configuration.applications", self.state.applications.len());
gauge!("configuration.clusters", self.state.clusters.len());
gauge!("configuration.backends", self.backends_count);
gauge!("configuration.frontends", self.frontends_count);
}
Expand Down Expand Up @@ -822,7 +822,7 @@ impl CommandServer {

self.backends_count = self.state.count_backends();
self.frontends_count = self.state.count_frontends();
gauge!("configuration.applications", self.state.applications.len());
gauge!("configuration.clusters", self.state.clusters.len());
gauge!("configuration.backends", self.backends_count);
gauge!("configuration.frontends", self.frontends_count);

Expand Down Expand Up @@ -925,12 +925,12 @@ impl CommandServer {
}
&Query::Applications(ref query_type) => {
main_query_answer = Some(QueryAnswer::Applications(match query_type {
QueryApplicationType::AppId(ref app_id) => {
vec![self.state.application_state(app_id)]
QueryApplicationType::ClusterId(ref cluster_id) => {
vec![self.state.application_state(cluster_id)]
}
QueryApplicationType::Domain(ref domain) => {
let app_ids = get_application_ids_by_domain(&self.state, domain.hostname.clone(), domain.path.clone());
app_ids.iter().map(|ref app_id| self.state.application_state(app_id)).collect()
let cluster_ids = get_application_ids_by_domain(&self.state, domain.hostname.clone(), domain.path.clone());
cluster_ids.iter().map(|ref cluster_id| self.state.application_state(cluster_id)).collect()
}
}));
}
Expand Down Expand Up @@ -1054,29 +1054,30 @@ impl CommandServer {
match order {
ProxyRequestData::RemoveBackend(ref backend) => {
let msg = format!(
"cannot remove backend: application {} has no backends {} at {}",
backend.app_id, backend.backend_id, backend.address,
"cannot remove backend: cluster {} has no backends {} at {}",
backend.cluster_id, backend.backend_id, backend.address,
);
error!("{}", msg);
self.answer_error(client_id, request_id, msg, None).await;
return;
}
ProxyRequestData::RemoveHttpFrontend(h) | ProxyRequestData::RemoveHttpsFrontend(h) => {
let msg = match h.route {
Route::AppId(app_id) => format!("No such frontend at {} for the application {}", h.address, app_id),
Route::ClusterId(cluster_id) =>
format!("No such frontend at {} for the cluster {}", h.address, cluster_id),
Route::Deny => format!("No such frontend at {}", h.address),
};
error!("{}", msg);
self.answer_error(client_id, request_id, msg, None).await;
return;
}
ProxyRequestData::RemoveTcpFrontend(TcpFrontend {
ref app_id,
ref cluster_id,
ref address,
}) => {
let msg = format!(
"cannot remove TCP frontend: application {} has no frontends at {}",
app_id, address,
"cannot remove TCP frontend: cluster {} has no frontends at {}",
cluster_id, address,
);
error!("{}", msg);
self.answer_error(client_id, request_id, msg, None).await;
Expand Down Expand Up @@ -1228,7 +1229,7 @@ impl CommandServer {
_ => {}
};

gauge!("configuration.applications", self.state.applications.len());
gauge!("configuration.clusters", self.state.clusters.len());
gauge!("configuration.backends", self.backends_count);
gauge!("configuration.frontends", self.frontends_count);
}
Expand Down

0 comments on commit f4f05b4

Please sign in to comment.