diff --git a/examples/c/ADM_cancel_transfer.c b/examples/c/ADM_cancel_transfer.c index 193279f8007aabc8501450fe471b2eda1ba9e2a3..26dc84d537db74db5aa64eef806a4c4f6c40565b 100644 --- a/examples/c/ADM_cancel_transfer.c +++ b/examples/c/ADM_cancel_transfer.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, "ADM_register_adhoc_storage() remote procedure not " diff --git a/examples/c/ADM_connect_data_operation.c b/examples/c/ADM_connect_data_operation.c index cf205bdfbab824b5fb04299eb00aeb11ba6177e6..aeb1978879921122c618c043fe77c52f196caab6 100644 --- a/examples/c/ADM_connect_data_operation.c +++ b/examples/c/ADM_connect_data_operation.c @@ -64,11 +64,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_define_data_operation.c b/examples/c/ADM_define_data_operation.c index 894f0593b62cb3e6d0b808f46cb9b0d37a5adec1..d451429380887b157edbb6f4cdbcab8b3fab5b3f 100644 --- a/examples/c/ADM_define_data_operation.c +++ b/examples/c/ADM_define_data_operation.c @@ -69,11 +69,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_deploy_adhoc_storage.c b/examples/c/ADM_deploy_adhoc_storage.c index d5533ddfb8c5172b8c26538f67e504f245035688..52b37bee3f6557150b2ece893ad03c493768ba69 100644 --- a/examples/c/ADM_deploy_adhoc_storage.c +++ b/examples/c/ADM_deploy_adhoc_storage.c @@ -60,11 +60,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_finalize_data_operation.c b/examples/c/ADM_finalize_data_operation.c index 226ddb0384b5a7873a42b5ec109cdc4bde11de36..d84fdeaf18d0ef67513ce3adbbc8ab6992d4ae6e 100644 --- a/examples/c/ADM_finalize_data_operation.c +++ b/examples/c/ADM_finalize_data_operation.c @@ -65,11 +65,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_get_pending_transfers.c b/examples/c/ADM_get_pending_transfers.c index 90329761de7bdfc6265b98158543d7af53c9108f..907a17780ada44fb9a71514f012a5a033b724cf6 100644 --- a/examples/c/ADM_get_pending_transfers.c +++ b/examples/c/ADM_get_pending_transfers.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_get_qos_constraints.c b/examples/c/ADM_get_qos_constraints.c index 339afe5d66a4a02a959f24996e3269b26a058388..93ec70aa19285c471dbfc6e233f5ad261156af6f 100644 --- a/examples/c/ADM_get_qos_constraints.c +++ b/examples/c/ADM_get_qos_constraints.c @@ -64,11 +64,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_get_statistics.c b/examples/c/ADM_get_statistics.c index 0d9a56033dcb8c42ae62851b7d737f1586b9c4ff..080dedb7bc7faa99e3e520c34c6d3ff8504f18b2 100644 --- a/examples/c/ADM_get_statistics.c +++ b/examples/c/ADM_get_statistics.c @@ -64,11 +64,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_get_transfer_priority.c b/examples/c/ADM_get_transfer_priority.c index 7c33200e8912bb9efbe1f2a66c81136477e65b4b..211c693a1deb4b78951ebb64843fd59f198952d4 100644 --- a/examples/c/ADM_get_transfer_priority.c +++ b/examples/c/ADM_get_transfer_priority.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_link_transfer_to_data_operation.c b/examples/c/ADM_link_transfer_to_data_operation.c index c333e7e3be951253c08525b5e2ce5695e5b64bca..18a353bc6434ffcb839aaa10422551169de7225a 100644 --- a/examples/c/ADM_link_transfer_to_data_operation.c +++ b/examples/c/ADM_link_transfer_to_data_operation.c @@ -65,11 +65,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_register_adhoc_storage.c b/examples/c/ADM_register_adhoc_storage.c index 0302f30770914afc399a41b904939a1ddee04364..144f0a71bc207ec7d17344e88c4af25f24d57018 100644 --- a/examples/c/ADM_register_adhoc_storage.c +++ b/examples/c/ADM_register_adhoc_storage.c @@ -60,11 +60,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_register_job.c b/examples/c/ADM_register_job.c index 8e7c7c1b1c44b3e62764fae3368ad24f5bcd6723..75a8fd4af2947e1120916f3c40f6691a28f66f4d 100644 --- a/examples/c/ADM_register_job.c +++ b/examples/c/ADM_register_job.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_remove_adhoc_storage.c b/examples/c/ADM_remove_adhoc_storage.c index f8b5eaba80e687b3e5dd3c1d9ca1526f933be785..f35f6accce3724ecc72fa246117c8b2144765aa7 100644 --- a/examples/c/ADM_remove_adhoc_storage.c +++ b/examples/c/ADM_remove_adhoc_storage.c @@ -60,11 +60,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_remove_job.c b/examples/c/ADM_remove_job.c index 73dedbe4e192b27caa11a6652892fc08fab7a749..299c85d52eca2c51bff20ee44e935bd689b3fced 100644 --- a/examples/c/ADM_remove_job.c +++ b/examples/c/ADM_remove_job.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_set_dataset_information.c b/examples/c/ADM_set_dataset_information.c index 5e342f72f4f534f45ad5417b9319302d1a6d5e19..fa4a10425df3475a3732061aa7287f369c449ead 100644 --- a/examples/c/ADM_set_dataset_information.c +++ b/examples/c/ADM_set_dataset_information.c @@ -65,11 +65,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_set_io_resources.c b/examples/c/ADM_set_io_resources.c index eabe6fa9426f0f90a585338af3e77a2d52649ad4..0be040a1fe52835786857c37f8fa12c00bd245ae 100644 --- a/examples/c/ADM_set_io_resources.c +++ b/examples/c/ADM_set_io_resources.c @@ -64,11 +64,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_set_qos_constraints.c b/examples/c/ADM_set_qos_constraints.c index 6353f92e04f0edec907cbdf17da97fbfbe0a98ef..aa665752142306285b322dbd0d091c996e0217c7 100644 --- a/examples/c/ADM_set_qos_constraints.c +++ b/examples/c/ADM_set_qos_constraints.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_set_transfer_priority.c b/examples/c/ADM_set_transfer_priority.c index 018b294313f8e3a969c8ac8a6a110ad9b31de7c8..22067d1f6ca5154ddc4d71b79fdb258973d96fb2 100644 --- a/examples/c/ADM_set_transfer_priority.c +++ b/examples/c/ADM_set_transfer_priority.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_transfer_datasets.c b/examples/c/ADM_transfer_datasets.c index bd918ec2b8cbde8ba93bb2a8651e4e4d52e65eab..9af2580940ef6ecaf7f6a06188c12726f2b6e8cf 100644 --- a/examples/c/ADM_transfer_datasets.c +++ b/examples/c/ADM_transfer_datasets.c @@ -71,11 +71,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_update_adhoc_storage.c b/examples/c/ADM_update_adhoc_storage.c index 7080e7728e6d737244b04fb88b414cb164f0126e..ee3b96d7a08a275a116401b9924fda74dd4e2d7f 100644 --- a/examples/c/ADM_update_adhoc_storage.c +++ b/examples/c/ADM_update_adhoc_storage.c @@ -60,11 +60,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/c/ADM_update_job.c b/examples/c/ADM_update_job.c index 35deba4b4987f9f0471376436c701966e4aee102..639727bdf71540065c6d1257d5e1fcc807d72e39 100644 --- a/examples/c/ADM_update_job.c +++ b/examples/c/ADM_update_job.c @@ -68,11 +68,11 @@ main(int argc, char* argv[]) { 100, false); assert(ctx); - const char* user_id = "adhoc_storage_42"; + const char* name = "adhoc_storage_42"; ADM_storage_t adhoc_storage; ADM_return_t ret = - ADM_register_adhoc_storage(server, user_id, ctx, &adhoc_storage); + ADM_register_adhoc_storage(server, name, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stdout, diff --git a/examples/cxx/ADM_register_adhoc_storage.cpp b/examples/cxx/ADM_register_adhoc_storage.cpp index 8a74085a9bfb6d91b50b25cf112f92be1fe4c1b3..3029d619edbbf8f0ba00e56ca2a3d006486faf3b 100644 --- a/examples/cxx/ADM_register_adhoc_storage.cpp +++ b/examples/cxx/ADM_register_adhoc_storage.cpp @@ -47,15 +47,15 @@ main(int argc, char* argv[]) { const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); - std::string user_id = "adhoc_storage_42"; + std::string name = "adhoc_storage_42"; const auto adhoc_storage_ctx = admire::adhoc_storage::ctx{ admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, admire::adhoc_storage::resources{adhoc_nodes}, 100, false}; try { - const auto adhoc_storage = admire::register_adhoc_storage( - server, user_id, adhoc_storage_ctx); + const auto adhoc_storage = + admire::register_adhoc_storage(server, name, adhoc_storage_ctx); fmt::print(stdout, "ADM_register_adhoc_storage() remote procedure completed " diff --git a/examples/cxx/ADM_register_job.cpp b/examples/cxx/ADM_register_job.cpp index 9eda2df17107d5e9033dc338f27b38f9b5db2544..d757c39e988e9e65b0c4e676acd7ae4235694320 100644 --- a/examples/cxx/ADM_register_job.cpp +++ b/examples/cxx/ADM_register_job.cpp @@ -47,7 +47,7 @@ main(int argc, char* argv[]) { const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); - std::string user_id = "adhoc_storage_42"; + std::string name = "adhoc_storage_42"; const auto adhoc_storage_ctx = admire::adhoc_storage::ctx{ admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, @@ -55,8 +55,8 @@ main(int argc, char* argv[]) { try { - const auto adhoc_storage = admire::register_adhoc_storage( - server, user_id, adhoc_storage_ctx); + const auto adhoc_storage = + admire::register_adhoc_storage(server, name, adhoc_storage_ctx); admire::job_requirements reqs(inputs, outputs, adhoc_storage); diff --git a/examples/cxx/ADM_transfer_datasets.cpp b/examples/cxx/ADM_transfer_datasets.cpp index 381b07778477cfe2cca74016fb3a614a87d1bb53..ff19f803c1017c5ea897d7b588790303e79323d6 100644 --- a/examples/cxx/ADM_transfer_datasets.cpp +++ b/examples/cxx/ADM_transfer_datasets.cpp @@ -55,15 +55,15 @@ main(int argc, char* argv[]) { const auto qos_limits = prepare_qos_limits(NLIMITS); const auto mapping = admire::transfer::mapping::n_to_n; - std::string user_id = "adhoc_storage_42"; + std::string name = "adhoc_storage_42"; const auto adhoc_storage_ctx = admire::adhoc_storage::ctx{ admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, admire::adhoc_storage::resources{adhoc_nodes}, 100, false}; try { - const auto adhoc_storage = admire::register_adhoc_storage( - server, user_id, adhoc_storage_ctx); + const auto adhoc_storage = + admire::register_adhoc_storage(server, name, adhoc_storage_ctx); admire::job_requirements reqs(inputs, outputs, adhoc_storage); diff --git a/examples/cxx/ADM_update_job.cpp b/examples/cxx/ADM_update_job.cpp index 84b92008487d1610e2c94e20ff328051d91c19a6..7df3a8c489739923f681067ab00f55152c632abe 100644 --- a/examples/cxx/ADM_update_job.cpp +++ b/examples/cxx/ADM_update_job.cpp @@ -47,14 +47,12 @@ main(int argc, char* argv[]) { const auto inputs = prepare_datasets("input-dataset-{}", NINPUTS); const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); - const auto gkfs_storage = admire::adhoc_storage{ - admire::storage::type::gekkofs, - "foobar", - admire::adhoc_storage::execution_mode::separate_new, - admire::adhoc_storage::access_type::read_write, - admire::adhoc_storage::resources{adhoc_nodes}, - 100, - false}; + const auto gkfs_storage = admire::register_adhoc_storage( + server, "foobar", + admire::adhoc_storage::ctx{ + admire::adhoc_storage::execution_mode::separate_new, + admire::adhoc_storage::access_type::read_write, + admire::adhoc_storage::resources{adhoc_nodes}, 100, false}); admire::job_requirements reqs{inputs, outputs, gkfs_storage}; diff --git a/src/common/api/admire_types.h b/src/common/api/admire_types.h index 10e419bd71fe7568106e59d6033137e94a1fbbce..37a61db1dcceac7c6579d7c3ad853e1e1ef5e9d1 100644 --- a/src/common/api/admire_types.h +++ b/src/common/api/admire_types.h @@ -412,15 +412,17 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list); * * @remark ADM_STORAGEs need to be freed by calling ADM_storage_destroy(). * - * @param[in] id An identifier for the storage tier + * @param[in] name A name for the storage tier * @param[in] type The type for the storage tier being created. + * @param[in] id The assigned id for the storage tier being created. * @param[in] ctx Some specific context information for the storage tier or * NULL if none is required. For instance, an adhoc storage system may find it * useful to provide an ADM_adhoc_context_t describing the instance. * @return A valid ADM_STORAGE if successful, or NULL in case of failure. */ ADM_storage_t -ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx); +ADM_storage_create(const char* name, ADM_storage_type_t type, uint64_t id, + void* ctx); /** * Destroy a ADM_STORAGE created by ADM_storage_destroy(). diff --git a/src/common/api/admire_types.hpp b/src/common/api/admire_types.hpp index 9ce2f8aa7d41ee25fdcc5dcba4df979ef1e9a32a..3ca979b32889464766d9380bd53450ecb1c84d8f 100644 --- a/src/common/api/admire_types.hpp +++ b/src/common/api/admire_types.hpp @@ -247,21 +247,24 @@ struct storage { virtual ~ctx() = default; }; - storage(storage::type type, std::string user_id); + storage(storage::type type, std::string name, std::uint64_t id); virtual ~storage() = default; std::string - user_id() const; + name() const; type type() const; + std::uint64_t + id() const; virtual std::shared_ptr context() const = 0; protected: - std::string m_user_id; + std::string m_name; enum type m_type; + std::uint64_t m_id; }; struct adhoc_storage : public storage { @@ -317,13 +320,13 @@ struct adhoc_storage : public storage { bool m_should_flush; }; - adhoc_storage(enum storage::type type, std::string user_id, + adhoc_storage(enum storage::type type, std::string name, std::uint64_t id, execution_mode exec_mode, access_type access_type, adhoc_storage::resources res, std::uint32_t walltime, bool should_flush); - adhoc_storage(enum storage::type type, std::string user_id, + adhoc_storage(enum storage::type type, std::string name, std::uint64_t id, ADM_adhoc_context_t ctx); - adhoc_storage(enum storage::type type, std::string user_id, + adhoc_storage(enum storage::type type, std::string name, std::uint64_t id, const admire::adhoc_storage::ctx& ctx); adhoc_storage(const adhoc_storage& other) noexcept; @@ -334,10 +337,10 @@ struct adhoc_storage : public storage { operator=(adhoc_storage&&) noexcept; ~adhoc_storage() override; - const std::optional& + const std::uint64_t& id() const; - std::optional& + std::uint64_t& id(); std::shared_ptr @@ -363,9 +366,10 @@ struct pfs_storage : public storage { std::filesystem::path m_mount_point; }; - pfs_storage(enum storage::type type, std::string id, + pfs_storage(enum storage::type type, std::string name, std::uint64_t id, std::filesystem::path mount_point); - pfs_storage(enum storage::type type, std::string id, ADM_pfs_context_t ctx); + pfs_storage(enum storage::type type, std::string name, std::uint64_t id, + ADM_pfs_context_t ctx); pfs_storage(const pfs_storage& other) noexcept; pfs_storage(pfs_storage&&) noexcept = default; pfs_storage& @@ -657,8 +661,8 @@ struct fmt::formatter : formatter { s.context()); const auto str = - fmt::format("{{type: {}, id: {}, user_id: {}, context: {}}}", - s.type(), s.id(), std::quoted(s.user_id()), + fmt::format("{{type: {}, id: {}, name: {}, context: {}}}", + s.type(), s.id(), std::quoted(s.name()), (pctx ? fmt::format("{}", *pctx) : "NULL")); return formatter::format(str, ctx); } diff --git a/src/common/api/convert.cpp b/src/common/api/convert.cpp index 2d256784e46cacce2e53bcc639a65e4b53a5c060..341ccb4f525dd8a319964f6006fe1a33fbc8fcde 100644 --- a/src/common/api/convert.cpp +++ b/src/common/api/convert.cpp @@ -113,12 +113,8 @@ convert(const admire::adhoc_storage& st) { convert(*std::static_pointer_cast( st.context())); ADM_storage_t c_st = ADM_storage_create( - st.user_id().c_str(), static_cast(st.type()), - managed_ctx.get()); - - if(st.id()) { - c_st->s_server_id = static_cast(st.id().value()); - } + st.name().c_str(), static_cast(st.type()), + st.id(), managed_ctx.get()); return managed_ctype{c_st, std::move(managed_ctx)}; } diff --git a/src/common/api/types.cpp b/src/common/api/types.cpp index 39375b361ee3f86c8c2dcf1b6e09ff9662ebbd00..644e06730f4ee769a173ec2b25d04eef09ba2ccb 100644 --- a/src/common/api/types.cpp +++ b/src/common/api/types.cpp @@ -439,7 +439,8 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list) { } ADM_storage_t -ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx) { +ADM_storage_create(const char* name, ADM_storage_type_t type, uint64_t id, + void* ctx) { struct adm_storage* adm_storage = (struct adm_storage*) malloc(sizeof(*adm_storage)); @@ -450,8 +451,8 @@ ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx) { return NULL; } - if(!id) { - LOGGER_ERROR("Null storage id") + if(!name) { + LOGGER_ERROR("Null storage name") return NULL; } @@ -460,10 +461,10 @@ ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx) { return NULL; } - adm_storage->s_id = (const char*) calloc(strlen(id) + 1, sizeof(char)); - strcpy((char*) adm_storage->s_id, id); + adm_storage->s_name = (const char*) calloc(strlen(name) + 1, sizeof(char)); + strcpy((char*) adm_storage->s_name, name); adm_storage->s_type = type; - adm_storage->s_server_id = -1; + adm_storage->s_id = id; switch(adm_storage->s_type) { case ADM_STORAGE_GEKKOFS: @@ -518,8 +519,8 @@ ADM_storage_destroy(ADM_storage_t storage) { return ADM_EBADARGS; } - if(storage->s_id) { - free((void*) storage->s_id); + if(storage->s_name) { + free((void*) storage->s_name); } switch(storage->s_type) { @@ -798,9 +799,9 @@ ADM_job_requirements_create(ADM_dataset_t inputs[], size_t inputs_len, goto cleanup_on_error; } - adm_job_reqs->r_storage = ADM_storage_create(storage->s_id, storage->s_type, - storage->s_adhoc_ctx); - adm_job_reqs->r_storage->s_server_id = storage->s_server_id; + adm_job_reqs->r_storage = + ADM_storage_create(storage->s_name, storage->s_type, storage->s_id, + storage->s_adhoc_ctx); return adm_job_reqs; @@ -1254,12 +1255,12 @@ dataset::id() const { return m_pimpl->id(); } -storage::storage(enum storage::type type, std::string user_id) - : m_user_id(std::move(user_id)), m_type(type) {} +storage::storage(enum storage::type type, std::string name, std::uint64_t id) + : m_name(std::move(name)), m_type(type), m_id(id) {} std::string -storage::user_id() const { - return m_user_id; +storage::name() const { + return m_name; } enum storage::type @@ -1267,6 +1268,11 @@ storage::type() const { return m_type; } +std::uint64_t +storage::id() const { + return m_id; +} + adhoc_storage::resources::resources(std::vector nodes) : m_nodes(std::move(nodes)) {} @@ -1335,12 +1341,12 @@ public: operator=(impl&&) noexcept = default; ~impl() = default; - const std::optional& + const std::uint64_t& id() const { return m_id; } - std::optional& + std::uint64_t& id() { return m_id; } @@ -1351,30 +1357,33 @@ public: } private: - std::optional m_id; + std::uint64_t m_id; adhoc_storage::ctx m_ctx; }; -adhoc_storage::adhoc_storage(enum storage::type type, std::string user_id, - execution_mode exec_mode, access_type access_type, +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, + std::uint64_t id, execution_mode exec_mode, + access_type access_type, adhoc_storage::resources res, std::uint32_t walltime, bool should_flush) - : storage(type, std::move(user_id)), - m_pimpl(std::make_unique(adhoc_storage::ctx{ - exec_mode, access_type, res, walltime, should_flush})) {} + : storage(type, std::move(name), id), + m_pimpl(std::make_unique( + adhoc_storage::ctx{exec_mode, access_type, std::move(res), + walltime, should_flush})) {} -adhoc_storage::adhoc_storage(enum storage::type type, std::string user_id, - ADM_adhoc_context_t ctx) - : storage(type, std::move(user_id)), +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, + std::uint64_t id, ADM_adhoc_context_t ctx) + : storage(type, std::move(name), id), m_pimpl(std::make_unique(adhoc_storage::ctx{ctx})) {} -adhoc_storage::adhoc_storage(enum storage::type type, std::string user_id, - const adhoc_storage::ctx& ctx) - : storage(type, std::move(user_id)), m_pimpl(std::make_unique(ctx)) {} +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, + std::uint64_t id, const adhoc_storage::ctx& ctx) + : storage(type, std::move(name), id), m_pimpl(std::make_unique(ctx)) { +} adhoc_storage::adhoc_storage(const adhoc_storage& other) noexcept - : storage(other.m_type, other.m_user_id), + : storage(other.m_type, other.m_name, other.m_id), m_pimpl(std::make_unique(*other.m_pimpl)) {} adhoc_storage::adhoc_storage(adhoc_storage&&) noexcept = default; @@ -1388,12 +1397,12 @@ adhoc_storage::operator=(const adhoc_storage& other) noexcept { adhoc_storage& adhoc_storage::operator=(adhoc_storage&&) noexcept = default; -const std::optional& +const std::uint64_t& adhoc_storage::id() const { return m_pimpl->id(); } -std::optional& +std::uint64_t& adhoc_storage::id() { return m_pimpl->id(); } @@ -1410,7 +1419,7 @@ pfs_storage::ctx::ctx(std::filesystem::path mount_point) pfs_storage::ctx::ctx(ADM_pfs_context_t ctx) : pfs_storage::ctx(ctx->c_mount) {} pfs_storage::pfs_storage(const pfs_storage& other) noexcept - : storage(other.m_type, other.m_user_id), + : storage(other.m_type, other.m_name, other.m_id), m_pimpl(std::make_unique(*other.m_pimpl)) {} pfs_storage& @@ -1444,15 +1453,15 @@ private: pfs_storage::ctx m_ctx; }; -pfs_storage::pfs_storage(enum storage::type type, std::string id, - std::filesystem::path mount_point) - : storage(type, std::move(id)), +pfs_storage::pfs_storage(enum storage::type type, std::string name, + std::uint64_t id, std::filesystem::path mount_point) + : storage(type, std::move(name), id), m_pimpl(std::make_unique( pfs_storage::ctx{std::move(mount_point)})) {} -pfs_storage::pfs_storage(enum storage::type type, std::string id, - ADM_pfs_context_t ctx) - : storage(type, std::move(id)), +pfs_storage::pfs_storage(enum storage::type type, std::string name, + std::uint64_t id, ADM_pfs_context_t ctx) + : storage(type, std::move(name), id), m_pimpl(std::make_unique(pfs_storage::ctx{ctx})) {} pfs_storage::~pfs_storage() = default; @@ -1493,12 +1502,8 @@ public: // TODO add a conversion constructor m_adhoc_storage = admire::adhoc_storage( static_cast(reqs->r_storage->s_type), - reqs->r_storage->s_id, reqs->r_storage->s_adhoc_ctx); - - if(const auto server_id = reqs->r_storage->s_server_id; - server_id != -1) { - m_adhoc_storage->id() = server_id; - } + reqs->r_storage->s_name, reqs->r_storage->s_id, + reqs->r_storage->s_adhoc_ctx); } } diff --git a/src/common/net/proto/rpc_types.c b/src/common/net/proto/rpc_types.c index 2f8379842bce156627b119cded5dc40630be9b64..6bcbca113f2c7ef4360080e5255ed7e9425570ad 100644 --- a/src/common/net/proto/rpc_types.c +++ b/src/common/net/proto/rpc_types.c @@ -421,14 +421,14 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { } // 2. the storage id - ret = hg_proc_hg_const_string_t(proc, &tmp->s_id); + ret = hg_proc_hg_const_string_t(proc, &tmp->s_name); if(ret != HG_SUCCESS) { break; } - // 3. the server_id - ret = hg_proc_hg_int64_t(proc, &tmp->s_server_id); + // 3. the server-assigned id + ret = hg_proc_hg_int64_t(proc, &tmp->s_id); if(ret != HG_SUCCESS) { break; @@ -475,14 +475,14 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { } // 2. the storage id - ret = hg_proc_hg_const_string_t(proc, &tmp->s_id); + ret = hg_proc_hg_const_string_t(proc, &tmp->s_name); if(ret != HG_SUCCESS) { break; } - // 3. the server_id - ret = hg_proc_hg_int64_t(proc, &tmp->s_server_id); + // 3. the server-assigned id + ret = hg_proc_hg_int64_t(proc, &tmp->s_id); if(ret != HG_SUCCESS) { break; diff --git a/src/common/net/proto/rpc_types.h b/src/common/net/proto/rpc_types.h index 94ffe7eda4d62075ed0f20069196757cbe38677c..4caa3fc879f11fa4ab6a6d90457152a58260380d 100644 --- a/src/common/net/proto/rpc_types.h +++ b/src/common/net/proto/rpc_types.h @@ -180,9 +180,9 @@ MERCURY_GEN_STRUCT_PROC( // clang-format on typedef struct adm_storage { - const char* s_id; + const char* s_name; ADM_storage_type_t s_type; - int64_t s_server_id; + uint64_t s_id; union { ADM_adhoc_context_t s_adhoc_ctx; ADM_pfs_context_t s_pfs_ctx; @@ -329,15 +329,15 @@ MERCURY_GEN_PROC( /// ADM_register_adhoc_storage MERCURY_GEN_PROC( ADM_register_adhoc_storage_in_t, - ((hg_const_string_t) (id)) - ((ADM_adhoc_context_t)(ctx)) + ((hg_const_string_t) (name)) + ((ADM_adhoc_context_t) (ctx)) ); MERCURY_GEN_PROC( ADM_register_adhoc_storage_out_t, ((hg_uint64_t) (op_id)) - ((int32_t) (retval)) - ((uint64_t)(server_id)) + ((int32_t) (retval)) + ((uint64_t) (id)) ); /// ADM_update_adhoc_storage diff --git a/src/lib/admire.cpp b/src/lib/admire.cpp index a7991fabd21f4222c639d0349659b9af269db45f..e3c5dc88d2157c498578865c40012c04278b7b24 100644 --- a/src/lib/admire.cpp +++ b/src/lib/admire.cpp @@ -234,10 +234,10 @@ remove_job(const server& srv, const job& job) { } admire::adhoc_storage -register_adhoc_storage(const server& srv, const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& name, const adhoc_storage::ctx& ctx) { - const auto rv = detail::register_adhoc_storage(srv, user_id, ctx); + const auto rv = detail::register_adhoc_storage(srv, name, ctx); if(!rv) { throw std::runtime_error( diff --git a/src/lib/admire.h b/src/lib/admire.h index aa52deff6baf1b443df90495d6c08f4cf6d42d8c..a74337a5504bdacc81abf9b632d1d433ff3471f7 100644 --- a/src/lib/admire.h +++ b/src/lib/admire.h @@ -89,7 +89,7 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job); * Register an adhoc storage system. * * @param[in] server The server to which the request is directed - * @param[in] user_id The desired user id for the adhoc storage system. + * @param[in] name The desired name for the adhoc storage system. * @param[in] ctx The EXECUTION_CONTEXT for the adhoc storage system. * @param[out] adhoc_storage An ADM_STORAGE referring to the newly-created * adhoc storage instance. @@ -97,7 +97,7 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job); * successfully. */ ADM_return_t -ADM_register_adhoc_storage(ADM_server_t server, const char* user_id, +ADM_register_adhoc_storage(ADM_server_t server, const char* name, ADM_adhoc_context_t ctx, ADM_storage_t* adhoc_storage); diff --git a/src/lib/admire.hpp b/src/lib/admire.hpp index d62a9850d2988a9dd081e790da9438b202be9b01..a26848b19f8ea761c54305fef165760d3f6ba5d3 100644 --- a/src/lib/admire.hpp +++ b/src/lib/admire.hpp @@ -59,7 +59,7 @@ ADM_return_t remove_job(const server& srv, const job& job); admire::adhoc_storage -register_adhoc_storage(const server& srv, const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& name, const adhoc_storage::ctx& ctx); ADM_return_t diff --git a/src/lib/c_wrapper.cpp b/src/lib/c_wrapper.cpp index 6ac4a26d35ad3568ec8539916ea35cda8ba166cd..9100970cffd272e04c9333e9dd7c308c3a6bf6fd 100644 --- a/src/lib/c_wrapper.cpp +++ b/src/lib/c_wrapper.cpp @@ -81,14 +81,14 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job) { } ADM_return_t -ADM_register_adhoc_storage(ADM_server_t server, const char* user_id, +ADM_register_adhoc_storage(ADM_server_t server, const char* name, ADM_adhoc_context_t ctx, ADM_storage_t* adhoc_storage) { const admire::server srv{server}; const auto rv = admire::detail::register_adhoc_storage( - srv, user_id, admire::adhoc_storage::ctx{ctx}); + srv, name, admire::adhoc_storage::ctx{ctx}); if(!rv) { diff --git a/src/lib/detail/impl.cpp b/src/lib/detail/impl.cpp index 7e9f712070f691f3747a356c9808a42c38d6110c..96a637f39e4bafaa9ddc511915458a02078269eb 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -315,7 +315,7 @@ remove_job(const server& srv, const job& job) { } tl::expected -register_adhoc_storage(const server& srv, const std::string& user_id, +register_adhoc_storage(const server& srv, const std::string& name, const adhoc_storage::ctx& ctx) { scord::network::rpc_client rpc_client{srv.protocol(), rpc_registration_cb}; @@ -324,14 +324,14 @@ register_adhoc_storage(const server& srv, const std::string& user_id, auto endp = rpc_client.lookup(srv.address()); LOGGER_INFO("rpc id: {} name: {} from: {} => " - "body: {{user_id: {}, adhoc_ctx: {}}}", + "body: {{name: {}, adhoc_ctx: {}}}", rpc_id, std::quoted("ADM_"s + __FUNCTION__), - std::quoted(rpc_client.self_address()), user_id, ctx); + std::quoted(rpc_client.self_address()), name, ctx); - const auto rpc_user_id = user_id.c_str(); + const auto rpc_name = name.c_str(); const auto rpc_ctx = api::convert(ctx); - ADM_register_adhoc_storage_in_t in{rpc_user_id, rpc_ctx.get()}; + ADM_register_adhoc_storage_in_t in{rpc_name, rpc_ctx.get()}; ADM_register_adhoc_storage_out_t out; const auto rpc = endp.call("ADM_register_adhoc_storage", &in, &out); @@ -345,16 +345,14 @@ register_adhoc_storage(const server& srv, const std::string& user_id, return tl::make_unexpected(retval); } - auto rpc_adhoc_storage = - admire::adhoc_storage{admire::storage::type::gekkofs, user_id, ctx}; - - rpc_adhoc_storage.id() = out.server_id; + auto rpc_adhoc_storage = admire::adhoc_storage{ + admire::storage::type::gekkofs, name, out.id, ctx}; LOGGER_INFO("rpc id: {} name: {} from: {} <= " - "body: {{retval: {}, server_id: {}}} [op_id: {}]", + "body: {{retval: {}, id: {}}} [op_id: {}]", rpc_id, std::quoted("ADM_"s + __FUNCTION__), - std::quoted(rpc_client.self_address()), ADM_SUCCESS, - out.server_id, out.op_id); + std::quoted(rpc_client.self_address()), ADM_SUCCESS, out.id, + out.op_id); return rpc_adhoc_storage; } diff --git a/src/lib/detail/impl.hpp b/src/lib/detail/impl.hpp index 8505b16832698570a3c93006d5ef83d3020e00d5..4580914f173dac1afcf9b242438a09b0900be466 100644 --- a/src/lib/detail/impl.hpp +++ b/src/lib/detail/impl.hpp @@ -53,7 +53,7 @@ transfer_datasets(const server& srv, const job& job, transfer::mapping mapping); tl::expected -register_adhoc_storage(const server& srv, const std::string& id, +register_adhoc_storage(const server& srv, const std::string& name, const adhoc_storage::ctx& ctx); } // namespace admire::detail diff --git a/src/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index 3bbeefaf42e543e56c93060a7be7cc3c53eb0035..1a672de9e5c9cd3ff71ce44ec43d32015560137c 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -41,11 +41,10 @@ struct adhoc_storage_manager { template static admire::adhoc_storage - create(Args&&... args) { + create(enum admire::adhoc_storage::type type, const std::string& name, + const admire::adhoc_storage::ctx& ctx) { static std::atomic_uint64_t current_id; - auto adhoc_storage = admire::adhoc_storage(std::forward(args)...); - adhoc_storage.id() = current_id++; - return adhoc_storage; + return admire::adhoc_storage(type, name, current_id++, ctx); } }; @@ -236,28 +235,28 @@ ADM_register_adhoc_storage(hg_handle_t h) { ret = margo_get_input(h, &in); assert(ret == HG_SUCCESS); - const std::string id(in.id); + const std::string name(in.name); const admire::adhoc_storage::ctx ctx(in.ctx); const auto rpc_id = remote_procedure::new_id(); LOGGER_INFO("rpc id: {} name: {} from: {} => " - "body: {{user_id: {}, adhoc_ctx: {}}}", + "body: {{name: {}, adhoc_ctx: {}}}", rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)), - id, ctx); + name, ctx); const auto adhoc_storage = adhoc_storage_manager::create( - admire::adhoc_storage::type::gekkofs, id, ctx); + admire::adhoc_storage::type::gekkofs, name, ctx); admire::error_code rv = ADM_SUCCESS; out.op_id = rpc_id; out.retval = rv; - out.server_id = *adhoc_storage.id(); + out.id = adhoc_storage.id(); LOGGER_INFO("rpc id: {} name: {} to: {} => " - "body: {{retval: {}, server_id: {}}}", + "body: {{retval: {}, id: {}}}", rpc_id, std::quoted(__FUNCTION__), std::quoted(get_address(h)), - rv, out.server_id); + rv, out.id); ret = margo_respond(h, &out); assert(ret == HG_SUCCESS);