Commit 7dfd0e9f authored by Philip Carns's avatar Philip Carns
Browse files

rename administrative functions

- make usage more clear and also align better with other microservices
parent 5939e55b
......@@ -79,9 +79,9 @@ int bake_provider_destroy(bake_provider_t provider);
*
* @return 0 on success, -1 on failure
*/
int bake_provider_add_storage_target(bake_provider_t provider,
const char* target_name,
bake_target_id_t* target_id);
int bake_provider_attach_target(bake_provider_t provider,
const char* target_name,
bake_target_id_t* target_id);
/**
* Makes the provider stop managing a target.
......@@ -91,8 +91,8 @@ int bake_provider_add_storage_target(bake_provider_t provider,
*
* @return 0 on success, -1 on failure
*/
int bake_provider_remove_storage_target(bake_provider_t provider,
bake_target_id_t target_id);
int bake_provider_detach_target(bake_provider_t provider,
bake_target_id_t target_id);
/**
* Removes all the targets associated with a provider.
......@@ -101,7 +101,7 @@ int bake_provider_remove_storage_target(bake_provider_t provider,
*
* @return 0 on success, -1 on failure
*/
int bake_provider_remove_all_storage_targets(bake_provider_t provider);
int bake_provider_detach_all_targets(bake_provider_t provider);
/**
* Returns the number of targets that this provider manages.
......@@ -111,13 +111,13 @@ int bake_provider_remove_all_storage_targets(bake_provider_t provider);
*
* @return 0 on success, -1 on failure
*/
int bake_provider_count_storage_targets(bake_provider_t provider,
uint64_t* num_targets);
int bake_provider_count_targets(bake_provider_t provider,
uint64_t* num_targets);
/**
* List the target ids of the targets managed by this provider.
* The targets array must be pre-allocated with at least enough
* space to hold all the targets (use bake_provider_count_storage_targets
* space to hold all the targets (use bake_provider_count_targets
* to know how many storage targets are managed).
*
* @param provider Bake provider
......@@ -125,8 +125,8 @@ int bake_provider_count_storage_targets(bake_provider_t provider,
*
* @return 0 on success, -1 on failure
*/
int bake_provider_list_storage_targets(bake_provider_t provider,
bake_target_id_t* targets);
int bake_provider_list_targets(bake_provider_t provider,
bake_target_id_t* targets);
/**
* Retrieves complete configuration of bake provider, encoded as json
......
......@@ -178,11 +178,11 @@ int main(int argc, char** argv)
return (-1);
}
ret = bake_provider_add_storage_target(provider, opts.bake_pools[i],
&tid);
ret = bake_provider_attach_target(provider, opts.bake_pools[i],
&tid);
if (ret != 0) {
bake_perror("Error: bake_provider_add_storage_target()", ret);
bake_perror("Error: bake_provider_attach_target()", ret);
free(opts.bake_pools);
margo_finalize(mid);
return (-1);
......@@ -221,11 +221,11 @@ int main(int argc, char** argv)
for (i = 0; i < opts.num_pools; i++) {
bake_target_id_t tid;
ret = bake_provider_add_storage_target(provider, opts.bake_pools[i],
&tid);
ret = bake_provider_attach_target(provider, opts.bake_pools[i],
&tid);
if (ret != 0) {
bake_perror("Error: bake_provider_add_storage_target()", ret);
bake_perror("Error: bake_provider_attach_target()", ret);
free(opts.bake_pools);
margo_finalize(mid);
return (-1);
......
......@@ -321,9 +321,9 @@ int bake_provider_destroy(bake_provider_t provider)
return BAKE_SUCCESS;
}
int bake_provider_add_storage_target(bake_provider_t provider,
const char* target_name,
bake_target_id_t* target_id)
int bake_provider_attach_target(bake_provider_t provider,
const char* target_name,
bake_target_id_t* target_id)
{
int ret = BAKE_SUCCESS;
bake_target_id_t tid;
......@@ -387,8 +387,8 @@ int bake_provider_add_storage_target(bake_provider_t provider,
return ret;
}
int bake_provider_remove_storage_target(bake_provider_t provider,
bake_target_id_t target_id)
int bake_provider_detach_target(bake_provider_t provider,
bake_target_id_t target_id)
{
int ret;
ABT_rwlock_wrlock(provider->lock);
......@@ -407,7 +407,7 @@ int bake_provider_remove_storage_target(bake_provider_t provider,
return ret;
}
int bake_provider_remove_all_storage_targets(bake_provider_t provider)
int bake_provider_detach_all_targets(bake_provider_t provider)
{
ABT_rwlock_wrlock(provider->lock);
bake_target_t *p, *tmp;
......@@ -423,8 +423,7 @@ int bake_provider_remove_all_storage_targets(bake_provider_t provider)
return BAKE_SUCCESS;
}
int bake_provider_count_storage_targets(bake_provider_t provider,
uint64_t* num_targets)
int bake_provider_count_targets(bake_provider_t provider, uint64_t* num_targets)
{
ABT_rwlock_rdlock(provider->lock);
*num_targets = provider->num_targets;
......@@ -432,8 +431,8 @@ int bake_provider_count_storage_targets(bake_provider_t provider,
return BAKE_SUCCESS;
}
int bake_provider_list_storage_targets(bake_provider_t provider,
bake_target_id_t* targets)
int bake_provider_list_targets(bake_provider_t provider,
bake_target_id_t* targets)
{
ABT_rwlock_rdlock(provider->lock);
bake_target_t *p, *tmp;
......@@ -802,9 +801,9 @@ static void bake_probe_ult(hg_handle_t handle)
}
uint64_t targets_count;
bake_provider_count_storage_targets(provider, &targets_count);
bake_provider_count_targets(provider, &targets_count);
bake_target_id_t targets[targets_count];
bake_provider_list_storage_targets(provider, targets);
bake_provider_list_targets(provider, targets);
out.ret = BAKE_SUCCESS;
out.targets = targets;
......@@ -910,9 +909,7 @@ static void bake_migrate_target_ult(hg_handle_t handle)
UNLOCK_PROVIDER;
/* remove the target from the list of managed targets */
if (in.remove_src) {
bake_provider_remove_storage_target(provider, in.bti);
}
if (in.remove_src) { bake_provider_detach_target(provider, in.bti); }
LOCK_PROVIDER;
out.ret = BAKE_SUCCESS;
......@@ -963,7 +960,7 @@ static void bake_server_finalize_cb(void* data)
}
#endif
bake_provider_remove_all_storage_targets(provider);
bake_provider_detach_all_targets(provider);
json_object_put(provider->json_cfg);
......@@ -992,7 +989,7 @@ static void migration_fileset_cb(const char* filename, void* arg)
strcat(fullname, mig_args->root);
strcat(fullname, filename);
bake_target_id_t tid;
bake_provider_add_storage_target(mig_args->provider, fullname, &tid);
bake_provider_attach_target(mig_args->provider, fullname, &tid);
}
static void migration_metadata_cb(const char* key, const char* val, void* arg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment