Skip to content

Commit

Permalink
Remove need to pass CAS store to action cache service
Browse files Browse the repository at this point in the history
  • Loading branch information
allada committed Jan 19, 2021
1 parent d231ea1 commit cc37b08
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
8 changes: 1 addition & 7 deletions cas/grpc_service/ac_server.rs
Expand Up @@ -22,22 +22,16 @@ use store::{Store, StoreManager};

pub struct AcServer {
ac_store: Arc<dyn Store>,
_cas_store: Arc<dyn Store>,
}

impl AcServer {
pub fn new(config: &HashMap<InstanceName, AcStoreConfig>, store_manager: &StoreManager) -> Result<Self, Error> {
for (_instance_name, ac_cfg) in config {
let ac_store = store_manager
.get_store(&ac_cfg.ac_store)
.ok_or_else(|| make_input_err!("'cas_store': '{}' does not exist", ac_cfg.cas_store))?;
let cas_store = store_manager
.get_store(&ac_cfg.cas_store)
.ok_or_else(|| make_input_err!("'cas_store': '{}' does not exist", ac_cfg.cas_store))?;
// TODO(allada) We don't yet support instance_name.
.ok_or_else(|| make_input_err!("'ac_store': '{}' does not exist", ac_cfg.ac_store))?;
return Ok(AcServer {
ac_store: ac_store.clone(),
_cas_store: cas_store.clone(),
});
}
Err(make_input_err!("No configuration configured for 'ac' service"))
Expand Down
5 changes: 2 additions & 3 deletions cas/grpc_service/tests/ac_server_test.rs
Expand Up @@ -15,7 +15,7 @@ use config;
use error::Error;
use store::{Store, StoreManager};

const INSTANCE_NAME: &str = "foo";
const INSTANCE_NAME: &str = "foo_instance_name";
const HASH1: &str = "0123456789abcdef000000000000000000000000000000000123456789abcdef";

async fn insert_into_store<T: Message>(
Expand Down Expand Up @@ -46,8 +46,7 @@ fn make_store_manager() -> Result<StoreManager, Error> {
fn make_ac_server(store_manager: &mut StoreManager) -> Result<AcServer, Error> {
AcServer::new(
&hashmap! {
"main".to_string() => config::cas_server::AcStoreConfig{
cas_store: "main_cas".to_string(),
"foo_instance_name".to_string() => config::cas_server::AcStoreConfig{
ac_store: "main_ac".to_string(),
}
},
Expand Down
4 changes: 0 additions & 4 deletions config/cas_server.rs
Expand Up @@ -15,10 +15,6 @@ pub type InstanceName = String;

#[derive(Deserialize, Debug)]
pub struct AcStoreConfig {
/// The store name referenced in the `stores` map in the main config.
/// This store name referenced here may be reused multiple times.
pub cas_store: StoreRefName,

/// The store name referenced in the `stores` map in the main config.
/// This store name referenced here may be reused multiple times.
pub ac_store: StoreRefName,
Expand Down
1 change: 0 additions & 1 deletion config/examples/basic_cas.json
Expand Up @@ -22,7 +22,6 @@
},
"ac": {
"main": {
"cas_store": "CAS_MAIN_STORE",
"ac_store": "AC_MAIN_STORE"
}
},
Expand Down

0 comments on commit cc37b08

Please sign in to comment.