Skip to content

Commit

Permalink
Make CAS and AC server not to use the same store
Browse files Browse the repository at this point in the history
When CAS and AC uses the same store, it might produce unexpected
side-effects and wrong behaviors. To prevent system from such situation,
it currently raises an error when CAS and AC uses the same store.
  • Loading branch information
aleksdmladenovic committed Jul 22, 2024
1 parent 97f64b2 commit 452ba6b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/bin/nativelink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,23 @@ async fn inner_main(
// Currently we only support http as our socket type.
let ListenerConfig::http(http_config) = server_cfg.listener;

// Check if CAS and AC uses the same store.
if let Some(cas_config) = &services.cas {
if let Some(ac_config) = &services.ac {
for (instance_name, cas_store_config) in cas_config {
if let Some(ac_store_config) = ac_config.get(instance_name) {
if cas_store_config.cas_store == ac_store_config.ac_store {
return Err(make_err!(
Code::InvalidArgument,
"CAS and AC uses the same store '{}' in the config",
cas_store_config.cas_store
))?;
}
}
}
}
}

let tonic_services = TonicServer::builder()
.add_optional_service(
services
Expand Down

0 comments on commit 452ba6b

Please sign in to comment.