diff --git a/examples/c/ADM_cancel_transfer.c b/examples/c/ADM_cancel_transfer.c index 478f3ed3e068539a2dd4f7d69a108595ff4b36fd..fb921deda24d4cb5ad65164cf336e71bb76b0a8e 100644 --- a/examples/c/ADM_cancel_transfer.c +++ b/examples/c/ADM_cancel_transfer.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_connect_data_operation.c b/examples/c/ADM_connect_data_operation.c index 8b6bf16fb95347bb16c834ea49699e5aba24ada7..d47ffa0a8d7a0144a1df735336df3327f723284e 100644 --- a/examples/c/ADM_connect_data_operation.c +++ b/examples/c/ADM_connect_data_operation.c @@ -66,9 +66,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_define_data_operation.c b/examples/c/ADM_define_data_operation.c index 0c9520abc2480dd53e99870fcc1bf22766a7a15a..cc63b0912012913502a95b771962592297292284 100644 --- a/examples/c/ADM_define_data_operation.c +++ b/examples/c/ADM_define_data_operation.c @@ -71,9 +71,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_deploy_adhoc_storage.c b/examples/c/ADM_deploy_adhoc_storage.c index 04ad737aa507708da6839d879433d03aa873887a..ef77fb0bd4ed2c958d0ca1647bdf6a31fb67644a 100644 --- a/examples/c/ADM_deploy_adhoc_storage.c +++ b/examples/c/ADM_deploy_adhoc_storage.c @@ -25,9 +25,7 @@ #include #include #include -#include #include "common.h" -#include #define NADHOC_NODES 25 #define NINPUTS 10 @@ -53,7 +51,7 @@ main(int argc, char* argv[]) { ADM_adhoc_resources_t adhoc_resources = NULL; ADM_adhoc_context_t adhoc_ctx = NULL; ADM_adhoc_context_t new_adhoc_ctx = NULL; - ADM_storage_t adhoc_storage = NULL; + ADM_adhoc_storage_t adhoc_storage = NULL; // Let's prepare all the information required by the API calls. @@ -98,8 +96,9 @@ main(int argc, char* argv[]) { } // 2. Register the adhoc storage - if(ADM_register_adhoc_storage(server, adhoc_name, ADM_STORAGE_DATACLAY, - adhoc_ctx, &adhoc_storage) != ADM_SUCCESS) { + if(ADM_register_adhoc_storage(server, adhoc_name, + ADM_ADHOC_STORAGE_DATACLAY, adhoc_ctx, + &adhoc_storage) != ADM_SUCCESS) { fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n", ADM_strerror(ret)); goto cleanup; @@ -120,8 +119,7 @@ main(int argc, char* argv[]) { } // We can now request the deployment to the server - if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage)) != - ADM_SUCCESS) { + if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage)) != ADM_SUCCESS) { fprintf(stderr, "ADM_deploy_adhoc_storage() failed: %s\n", ADM_strerror(ret)); goto cleanup; diff --git a/examples/c/ADM_finalize_data_operation.c b/examples/c/ADM_finalize_data_operation.c index 9b125281e0df4d2f50b9a9d95645d4425fa4c19d..62dd9c34994890f43ff3db65bf3faea84f6345c3 100644 --- a/examples/c/ADM_finalize_data_operation.c +++ b/examples/c/ADM_finalize_data_operation.c @@ -67,9 +67,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_get_pending_transfers.c b/examples/c/ADM_get_pending_transfers.c index d0c49c43ccd3d5ed047645c87cb9346e69a5d7f5..26ea286ad3959189aa9515bc654eac2091f1b7f7 100644 --- a/examples/c/ADM_get_pending_transfers.c +++ b/examples/c/ADM_get_pending_transfers.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_get_qos_constraints.c b/examples/c/ADM_get_qos_constraints.c index bd9ba0652f323de66d73539202100e1a68c23250..f1b15b83f084cd950eeec661d5762dbda8a068a0 100644 --- a/examples/c/ADM_get_qos_constraints.c +++ b/examples/c/ADM_get_qos_constraints.c @@ -66,9 +66,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_get_statistics.c b/examples/c/ADM_get_statistics.c index 17f9384232d12bf402a83fbcf37c90a831965c9d..fcec8a87f185240cf70ce96ad0051cd2bc6869d8 100644 --- a/examples/c/ADM_get_statistics.c +++ b/examples/c/ADM_get_statistics.c @@ -66,9 +66,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_get_transfer_priority.c b/examples/c/ADM_get_transfer_priority.c index 30593254c1ca14f0811b756967ead6c927eb3d0d..3ed3b1aeaabebe7dc48ef4a7f552dd2ad66eea65 100644 --- a/examples/c/ADM_get_transfer_priority.c +++ b/examples/c/ADM_get_transfer_priority.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_link_transfer_to_data_operation.c b/examples/c/ADM_link_transfer_to_data_operation.c index 7765f5cfb3458a9a44cf613fc7e3e4c50c452908..348d54ffe01fe3eba5ca75473580a225791ac77f 100644 --- a/examples/c/ADM_link_transfer_to_data_operation.c +++ b/examples/c/ADM_link_transfer_to_data_operation.c @@ -67,9 +67,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_register_adhoc_storage.c b/examples/c/ADM_register_adhoc_storage.c index 25abdc2dc0de0f86b9c794e7f06c6a638dea9bc4..756f2f7c1baa2fd2f0cf40ba8b6454f75138801b 100644 --- a/examples/c/ADM_register_adhoc_storage.c +++ b/examples/c/ADM_register_adhoc_storage.c @@ -49,7 +49,7 @@ main(int argc, char* argv[]) { ADM_node_t* adhoc_nodes = NULL; ADM_adhoc_resources_t adhoc_resources = NULL; ADM_adhoc_context_t adhoc_ctx = NULL; - ADM_storage_t adhoc_storage = NULL; + ADM_adhoc_storage_t adhoc_storage = NULL; // Let's prepare all the information required by the API calls. // ADM_register_adhoc_storage() requires a set of nodes for the adhoc @@ -92,7 +92,7 @@ main(int argc, char* argv[]) { } // 2. Register the adhoc storage - if(ADM_register_adhoc_storage(server, adhoc_name, ADM_STORAGE_GEKKOFS, + if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS, adhoc_ctx, &adhoc_storage) != ADM_SUCCESS) { fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n", ADM_strerror(ret)); diff --git a/examples/c/ADM_register_job.c b/examples/c/ADM_register_job.c index 3e44467e6b49dea01e9867455689ec9c80ee3fd7..2ee75d15a294ec4df6b8424038e5b201bf724c9e 100644 --- a/examples/c/ADM_register_job.c +++ b/examples/c/ADM_register_job.c @@ -50,7 +50,7 @@ main(int argc, char* argv[]) { ADM_node_t* adhoc_nodes = NULL; ADM_adhoc_resources_t adhoc_resources = NULL; ADM_adhoc_context_t adhoc_ctx = NULL; - ADM_storage_t adhoc_storage = NULL; + ADM_adhoc_storage_t adhoc_storage = NULL; // job information ADM_node_t* job_nodes = NULL; @@ -103,7 +103,7 @@ main(int argc, char* argv[]) { } // 2. Register the adhoc storage - if(ADM_register_adhoc_storage(server, adhoc_name, ADM_STORAGE_GEKKOFS, + if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS, adhoc_ctx, &adhoc_storage) != ADM_SUCCESS) { fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n", ADM_strerror(ret)); diff --git a/examples/c/ADM_register_pfs_storage.c b/examples/c/ADM_register_pfs_storage.c index 413f22e140736b852f957872fb1b460104ed8b29..7b9a806f5d6133fab1efb4c956ce3905862c6597 100644 --- a/examples/c/ADM_register_pfs_storage.c +++ b/examples/c/ADM_register_pfs_storage.c @@ -43,7 +43,7 @@ main(int argc, char* argv[]) { int exit_status = EXIT_SUCCESS; ADM_server_t server = ADM_server_create("tcp", argv[1]); - ADM_storage_t pfs_storage; + ADM_pfs_storage_t pfs_storage; ADM_pfs_context_t ctx = ADM_pfs_context_create("/gpfs"); assert(ctx); diff --git a/examples/c/ADM_remove_adhoc_storage.c b/examples/c/ADM_remove_adhoc_storage.c index 34a0dca670ae381ae5c6bd8a6ad85283ff6f2ecd..d8c1bbce2d4b596c770e8a6a7894d0177cefd064 100644 --- a/examples/c/ADM_remove_adhoc_storage.c +++ b/examples/c/ADM_remove_adhoc_storage.c @@ -50,7 +50,7 @@ main(int argc, char* argv[]) { ADM_node_t* adhoc_nodes = NULL; ADM_adhoc_resources_t adhoc_resources = NULL; ADM_adhoc_context_t adhoc_ctx = NULL; - ADM_storage_t adhoc_storage = NULL; + ADM_adhoc_storage_t adhoc_storage = NULL; // Let's prepare all the information required by the API calls. @@ -95,7 +95,7 @@ main(int argc, char* argv[]) { } // 2. Register the adhoc storage - if(ADM_register_adhoc_storage(server, adhoc_name, ADM_STORAGE_GEKKOFS, + if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS, adhoc_ctx, &adhoc_storage) != ADM_SUCCESS) { fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n", ADM_strerror(ret)); diff --git a/examples/c/ADM_remove_job.c b/examples/c/ADM_remove_job.c index 219cff71ef89f0d1d962129a72bad26e2f27f5c8..826e950f7a2f205f61cd57b1a224e4d65914229f 100644 --- a/examples/c/ADM_remove_job.c +++ b/examples/c/ADM_remove_job.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_remove_pfs_storage.c b/examples/c/ADM_remove_pfs_storage.c index ee2638b9c43e52a5837eec286064b504d5594d14..e5a81c1adcf8c8e8d907c6b361ad480aa9c63680 100644 --- a/examples/c/ADM_remove_pfs_storage.c +++ b/examples/c/ADM_remove_pfs_storage.c @@ -42,7 +42,7 @@ main(int argc, char* argv[]) { ADM_pfs_context_t ctx = ADM_pfs_context_create("/gpfs"); assert(ctx); - ADM_storage_t pfs_storage; + ADM_pfs_storage_t pfs_storage; ADM_return_t ret = ADM_register_pfs_storage(server, ctx, &pfs_storage); if(ret != ADM_SUCCESS) { diff --git a/examples/c/ADM_set_dataset_information.c b/examples/c/ADM_set_dataset_information.c index 4dd160daf7a934bea7c4e295a11a755688388942..a04735a7af1effc05f9b1218e0db13312b8b32de 100644 --- a/examples/c/ADM_set_dataset_information.c +++ b/examples/c/ADM_set_dataset_information.c @@ -67,9 +67,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_set_io_resources.c b/examples/c/ADM_set_io_resources.c index 21d0c5bd60e432469cfb8bc5b579c2f219d9af65..6b6c6f48fc0200a14dac0db7e17d94081847e7bc 100644 --- a/examples/c/ADM_set_io_resources.c +++ b/examples/c/ADM_set_io_resources.c @@ -66,9 +66,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, @@ -99,7 +99,7 @@ main(int argc, char* argv[]) { goto cleanup; } - ADM_storage_t tier = NULL; + ADM_adhoc_storage_t tier = NULL; ADM_adhoc_resources_t resources = NULL; ret = ADM_set_io_resources(server, job, tier, resources); diff --git a/examples/c/ADM_set_qos_constraints.c b/examples/c/ADM_set_qos_constraints.c index 0cfed1bf2d99f5e31f8124734fbc57a2aca7e463..b82941e27194585f65e60dd0c73e23a917ca411a 100644 --- a/examples/c/ADM_set_qos_constraints.c +++ b/examples/c/ADM_set_qos_constraints.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_set_transfer_priority.c b/examples/c/ADM_set_transfer_priority.c index 62ce6241dd09472539597439d0e85c47266805b6..dc13d14dbf6a847c9c9199232cfee9fafd340c75 100644 --- a/examples/c/ADM_set_transfer_priority.c +++ b/examples/c/ADM_set_transfer_priority.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_transfer_datasets.c b/examples/c/ADM_transfer_datasets.c index d7b2ce66e40130debb925f23b498b249fdc444b9..d0be9ed425dde7236d4cbd42bfd38bdad8c28cd9 100644 --- a/examples/c/ADM_transfer_datasets.c +++ b/examples/c/ADM_transfer_datasets.c @@ -73,9 +73,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_update_adhoc_storage.c b/examples/c/ADM_update_adhoc_storage.c index 383afbc1e59e193ba7d1a604268594e52af70dd5..89bd47380fe070fc2a01037770c6edce2df93f97 100644 --- a/examples/c/ADM_update_adhoc_storage.c +++ b/examples/c/ADM_update_adhoc_storage.c @@ -51,7 +51,7 @@ main(int argc, char* argv[]) { ADM_adhoc_resources_t adhoc_resources = NULL; ADM_adhoc_context_t adhoc_ctx = NULL; ADM_adhoc_context_t new_adhoc_ctx = NULL; - ADM_storage_t adhoc_storage = NULL; + ADM_adhoc_storage_t adhoc_storage = NULL; // Let's prepare all the information required by the API calls. @@ -96,7 +96,7 @@ main(int argc, char* argv[]) { } // 2. Register the adhoc storage - if(ADM_register_adhoc_storage(server, adhoc_name, ADM_STORAGE_GEKKOFS, + if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS, adhoc_ctx, &adhoc_storage) != ADM_SUCCESS) { fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n", ADM_strerror(ret)); diff --git a/examples/c/ADM_update_job.c b/examples/c/ADM_update_job.c index d3a876fed048e005aaee5ea72bd1dfe61fdce410..18fdb7d61968848debe39ffd1c24215011843e0d 100644 --- a/examples/c/ADM_update_job.c +++ b/examples/c/ADM_update_job.c @@ -70,9 +70,9 @@ main(int argc, char* argv[]) { const char* name = "adhoc_storage_42"; - ADM_storage_t adhoc_storage; + ADM_adhoc_storage_t adhoc_storage; ADM_return_t ret = ADM_register_adhoc_storage( - server, name, ADM_STORAGE_GEKKOFS, ctx, &adhoc_storage); + server, name, ADM_ADHOC_STORAGE_GEKKOFS, ctx, &adhoc_storage); if(ret != ADM_SUCCESS) { fprintf(stderr, diff --git a/examples/c/ADM_update_pfs_storage.c b/examples/c/ADM_update_pfs_storage.c index 90d0cf75ec65e6479b27e84f315e661371999458..eb15957562dfa425c011b86566983fc043e7511a 100644 --- a/examples/c/ADM_update_pfs_storage.c +++ b/examples/c/ADM_update_pfs_storage.c @@ -42,7 +42,7 @@ main(int argc, char* argv[]) { ADM_pfs_context_t ctx = ADM_pfs_context_create("/gpfs"); assert(ctx); - ADM_storage_t pfs_storage; + ADM_pfs_storage_t pfs_storage; ADM_return_t ret = ADM_register_pfs_storage(server, ctx, &pfs_storage); if(ret != ADM_SUCCESS) { diff --git a/examples/cxx/ADM_deploy_adhoc_storage.cpp b/examples/cxx/ADM_deploy_adhoc_storage.cpp index cc4ae7a23558af9cbd7b305eec038902947e1788..ccfc76c14c5b4473d471d118eda75be9a4cc14c1 100644 --- a/examples/cxx/ADM_deploy_adhoc_storage.cpp +++ b/examples/cxx/ADM_deploy_adhoc_storage.cpp @@ -55,7 +55,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::dataclay, + server, name, admire::adhoc_storage::type::dataclay, adhoc_storage_ctx); fmt::print(stdout, @@ -65,10 +65,10 @@ main(int argc, char* argv[]) { admire::deploy_adhoc_storage(server, adhoc_storage); } catch(const std::exception& e) { - fmt::print( - stderr, - "FATAL: ADM_register_adhoc_storage() or ADM_deploy_adhoc_storage() failed: {}\n", - e.what()); + fmt::print(stderr, + "FATAL: ADM_register_adhoc_storage() or " + "ADM_deploy_adhoc_storage() failed: {}\n", + e.what()); exit(EXIT_FAILURE); } diff --git a/examples/cxx/ADM_register_adhoc_storage.cpp b/examples/cxx/ADM_register_adhoc_storage.cpp index b18c19b649a62c5034d534bab6c6df284ecda8e6..4b00c3d44f3d61c2ed9e06aeb2d2408bb887e0e3 100644 --- a/examples/cxx/ADM_register_adhoc_storage.cpp +++ b/examples/cxx/ADM_register_adhoc_storage.cpp @@ -55,7 +55,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::dataclay, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); fmt::print(stdout, diff --git a/examples/cxx/ADM_register_job.cpp b/examples/cxx/ADM_register_job.cpp index 463e319d748403c1322aff349805575c9bc28ad7..a016ea2f6fa82fdf6ab9096f6945c04200f07d04 100644 --- a/examples/cxx/ADM_register_job.cpp +++ b/examples/cxx/ADM_register_job.cpp @@ -56,7 +56,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::gekkofs, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); admire::job_requirements reqs(inputs, outputs, adhoc_storage); diff --git a/examples/cxx/ADM_register_pfs_storage.cpp b/examples/cxx/ADM_register_pfs_storage.cpp index 5c6e23564529f28f70df1faedb619cbfc8cfba21..4ff9c5536e64e1d1cbdaf5b083d7745da135522f 100644 --- a/examples/cxx/ADM_register_pfs_storage.cpp +++ b/examples/cxx/ADM_register_pfs_storage.cpp @@ -39,7 +39,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; ADM_pfs_context_t ctx{}; - ADM_storage_t pfs_storage{}; + ADM_pfs_storage_t pfs_storage{}; ADM_return_t ret = ADM_SUCCESS; try { diff --git a/examples/cxx/ADM_remove_adhoc_storage.cpp b/examples/cxx/ADM_remove_adhoc_storage.cpp index 3c1336ed911e6245947e7a114af847a4c75fd929..a9714cc3b5be3017ce874beb76ba0454bc593009 100644 --- a/examples/cxx/ADM_remove_adhoc_storage.cpp +++ b/examples/cxx/ADM_remove_adhoc_storage.cpp @@ -55,7 +55,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::gekkofs, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); admire::remove_adhoc_storage(server, adhoc_storage); fmt::print(stdout, diff --git a/examples/cxx/ADM_remove_job.cpp b/examples/cxx/ADM_remove_job.cpp index 0f320fae317d28b0e300c3d7f18c56029849f528..1320946fb85e081649a1c3233b0ace9310555783 100644 --- a/examples/cxx/ADM_remove_job.cpp +++ b/examples/cxx/ADM_remove_job.cpp @@ -56,7 +56,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::gekkofs, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); admire::job_requirements reqs(inputs, outputs, adhoc_storage); diff --git a/examples/cxx/ADM_remove_pfs_storage.cpp b/examples/cxx/ADM_remove_pfs_storage.cpp index b4e88de1462097c1b044089c35d3b635794eda99..11e887df25f4fa0912e5efd03ff2bc384737aa2d 100644 --- a/examples/cxx/ADM_remove_pfs_storage.cpp +++ b/examples/cxx/ADM_remove_pfs_storage.cpp @@ -37,7 +37,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; - ADM_storage_t pfs_storage{}; + ADM_pfs_storage_t pfs_storage{}; ADM_return_t ret = ADM_SUCCESS; try { diff --git a/examples/cxx/ADM_set_io_resources.cpp b/examples/cxx/ADM_set_io_resources.cpp index bad2726d16aeae28ff84324c87f3e045e2be559a..ab9108a4c80d3172028099bb066e94015ce06d43 100644 --- a/examples/cxx/ADM_set_io_resources.cpp +++ b/examples/cxx/ADM_set_io_resources.cpp @@ -38,7 +38,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; ADM_job_t job{}; - ADM_storage_t tier{}; + ADM_adhoc_storage_t tier{}; ADM_adhoc_resources_t resources{}; ADM_return_t ret = ADM_SUCCESS; diff --git a/examples/cxx/ADM_transfer_datasets.cpp b/examples/cxx/ADM_transfer_datasets.cpp index 88842c19865c0c8f8eb05fd45742e45a086cd5ba..efd6214497fc07435fc9d67a45dfacb281318972 100644 --- a/examples/cxx/ADM_transfer_datasets.cpp +++ b/examples/cxx/ADM_transfer_datasets.cpp @@ -63,7 +63,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::gekkofs, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); admire::job_requirements reqs(inputs, outputs, adhoc_storage); diff --git a/examples/cxx/ADM_update_adhoc_storage.cpp b/examples/cxx/ADM_update_adhoc_storage.cpp index cf1116daea430b082f8d1aa2c49364a11cb4d49a..54b6033b7345cf0a1111b91dd698690116774fdb 100644 --- a/examples/cxx/ADM_update_adhoc_storage.cpp +++ b/examples/cxx/ADM_update_adhoc_storage.cpp @@ -60,7 +60,7 @@ main(int argc, char* argv[]) { try { const auto adhoc_storage = admire::register_adhoc_storage( - server, name, admire::storage::type::gekkofs, + server, name, admire::adhoc_storage::type::gekkofs, adhoc_storage_ctx); admire::update_adhoc_storage(server, adhoc_storage, diff --git a/examples/cxx/ADM_update_job.cpp b/examples/cxx/ADM_update_job.cpp index c335942124803498be12ee224bca212f0af1a7c2..1d8152f69abe4a9a8da1cd475489b9fa62b73ca8 100644 --- a/examples/cxx/ADM_update_job.cpp +++ b/examples/cxx/ADM_update_job.cpp @@ -49,7 +49,7 @@ main(int argc, char* argv[]) { const auto outputs = prepare_datasets("output-dataset-{}", NOUTPUTS); const auto gkfs_storage = admire::register_adhoc_storage( - server, "foobar", admire::storage::type::gekkofs, + server, "foobar", admire::adhoc_storage::type::gekkofs, admire::adhoc_storage::ctx{ admire::adhoc_storage::execution_mode::separate_new, admire::adhoc_storage::access_type::read_write, diff --git a/examples/cxx/ADM_update_pfs_storage.cpp b/examples/cxx/ADM_update_pfs_storage.cpp index 904519020aa82dbff9d73f89eee043b101053235..fa2b6de62e587c97b2e27ee99da936f397c52c62 100644 --- a/examples/cxx/ADM_update_pfs_storage.cpp +++ b/examples/cxx/ADM_update_pfs_storage.cpp @@ -38,7 +38,7 @@ main(int argc, char* argv[]) { admire::server server{"tcp", argv[1]}; ADM_pfs_context_t ctx{}; - ADM_storage_t pfs_storage{}; + ADM_pfs_storage_t pfs_storage{}; ADM_return_t ret = ADM_SUCCESS; try { diff --git a/src/common/api/admire_types.h b/src/common/api/admire_types.h index 40de25e7173059c480d4de512660da8ecc7db70f..727fc8419432866425ebaa627822f3550802a69b 100644 --- a/src/common/api/admire_types.h +++ b/src/common/api/admire_types.h @@ -108,18 +108,25 @@ typedef struct adm_qos_limit_list* ADM_qos_limit_list_t; /* Storage tiers */ /* ----------------------------------------------------- */ -/** Storage tier types */ +/** Adhoc storage tier types */ typedef enum { - ADM_STORAGE_GEKKOFS, - ADM_STORAGE_DATACLAY, - ADM_STORAGE_EXPAND, - ADM_STORAGE_HERCULES, - ADM_STORAGE_LUSTRE, - ADM_STORAGE_GPFS, -} ADM_storage_type_t; + ADM_ADHOC_STORAGE_GEKKOFS, + ADM_ADHOC_STORAGE_DATACLAY, + ADM_ADHOC_STORAGE_EXPAND, + ADM_ADHOC_STORAGE_HERCULES, +} ADM_adhoc_storage_type_t; -/** A storage tier */ -typedef struct adm_storage* ADM_storage_t; +/** Adhoc storage tier types */ +typedef enum { + ADM_PFS_STORAGE_LUSTRE, + ADM_PFS_STORAGE_GPFS, +} ADM_pfs_storage_type_t; + +/** An adhoc storage tier */ +typedef struct adm_adhoc_storage* ADM_adhoc_storage_t; + +/** A PFS storage tier */ +typedef struct adm_pfs_storage* ADM_pfs_storage_t; /** Information about resources assigned to a storage tier */ typedef struct adm_adhoc_resources* ADM_adhoc_resources_t; @@ -314,7 +321,7 @@ ADM_job_resources_destroy(ADM_job_resources_t res); * @param[in] outputs An array of DATASET_DESCRIPTORS describing the output * information generated by the job. * @param[in] outputs_len The number of DATASET_DESCRIPTORS stored in outputs. - * @param[in] storage An optional ADHOC_DESCRIPTOR describing the adhoc + * @param[in] adhoc_storage An optional ADHOC_DESCRIPTOR describing the adhoc * storage system required by the job (can be set to NULL if no adhoc storage * system is required). * @return A valid ADM_job_requirements_t if sucessfull or NULL in case of @@ -323,7 +330,7 @@ ADM_job_resources_destroy(ADM_job_resources_t res); ADM_job_requirements_t ADM_job_requirements_create(ADM_dataset_t inputs[], size_t inputs_len, ADM_dataset_t outputs[], size_t outputs_len, - ADM_storage_t storage); + ADM_adhoc_storage_t adhoc_storage); /** * Destroy a ADM_job_requirements_t created by ADM_job_requirements_create(). @@ -411,30 +418,31 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list); /* ----------------------------------------------------- */ /** - * Create a ADM_STORAGE to represent a storage tier. + * Create a ADM_ADHOC_STORAGE to represent an adhoc storage tier. * - * @remark ADM_STORAGEs need to be freed by calling ADM_storage_destroy(). + * @remark ADM_ADHOC_STORAGEs need to be freed by calling + * ADM_adhoc_storage_destroy(). * * @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. + * @param[in] adhoc_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_ADHOC_STORAGE if successful, or NULL in case of failure. */ -ADM_storage_t -ADM_storage_create(const char* name, ADM_storage_type_t type, uint64_t id, - void* ctx); +ADM_adhoc_storage_t +ADM_adhoc_storage_create(const char* name, ADM_adhoc_storage_type_t type, + uint64_t id, ADM_adhoc_context_t adhoc_ctx); /** - * Destroy a ADM_STORAGE created by ADM_storage_destroy(). + * Destroy an ADM_ADHOC_STORAGE created by ADM_adhoc_storage_destroy(). * * @param[in] storage A valid ADM_STORAGE * @return ADM_SUCCESS or corresponding ADM error code */ ADM_return_t -ADM_storage_destroy(ADM_storage_t storage); +ADM_adhoc_storage_destroy(ADM_adhoc_storage_t adhoc_storage); /** * Create an ADM_ADHOC_RESOURCES from information about storage resources. @@ -490,6 +498,33 @@ ADM_adhoc_context_create(ADM_adhoc_mode_t exec_mode, ADM_return_t ADM_adhoc_context_destroy(ADM_adhoc_context_t ctx); +/** + * Create a ADM_PFS_STORAGE to represent a PFS storage tier. + * + * @remark ADM_PFS_STORAGEs need to be freed by calling + * ADM_pfs_storage_destroy(). + * + * @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] pfs_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_ADHOC_STORAGE if successful, or NULL in case of failure. + */ +ADM_adhoc_storage_t +ADM_pfs_storage_create(const char* name, ADM_adhoc_storage_type_t type, + uint64_t id, ADM_adhoc_context_t adhoc_ctx); + +/** + * Destroy an ADM_ADHOC_STORAGE created by ADM_adhoc_storage_destroy(). + * + * @param[in] storage A valid ADM_STORAGE + * @return ADM_SUCCESS or corresponding ADM error code + */ +ADM_return_t +ADM_pfs_storage_destroy(ADM_pfs_storage_t pfs_storage); + /** * Create an ADM_PFS_CONTEXT from information about how a PFS is configured. * diff --git a/src/common/api/admire_types.hpp b/src/common/api/admire_types.hpp index cfaf9c79cb71b6fc3cd0cc47a0fe36f55fa6ccff..a6613afaa3cfe510dc3621aa9d4ea4a5d217d0d3 100644 --- a/src/common/api/admire_types.hpp +++ b/src/common/api/admire_types.hpp @@ -310,43 +310,15 @@ private: std::unique_ptr m_pimpl; }; -struct storage { - - enum class type : std::underlying_type::type { - gekkofs = ADM_STORAGE_GEKKOFS, - dataclay = ADM_STORAGE_DATACLAY, - expand = ADM_STORAGE_EXPAND, - hercules = ADM_STORAGE_HERCULES, - lustre = ADM_STORAGE_LUSTRE, - gpfs = ADM_STORAGE_GPFS - }; +struct adhoc_storage { - struct ctx { - virtual ~ctx() = default; + enum class type : std::underlying_type::type { + gekkofs = ADM_ADHOC_STORAGE_GEKKOFS, + dataclay = ADM_ADHOC_STORAGE_DATACLAY, + expand = ADM_ADHOC_STORAGE_EXPAND, + hercules = ADM_ADHOC_STORAGE_HERCULES, }; - storage(storage::type type, std::string name, std::uint64_t id); - - virtual ~storage() = default; - - std::string - name() const; - type - type() const; - std::uint64_t - id() const; - - virtual std::shared_ptr - context() const = 0; - -protected: - std::string m_name; - enum type m_type; - std::uint64_t m_id; -}; - -struct adhoc_storage : public storage { - enum class execution_mode : std::underlying_type::type { in_job_shared = ADM_ADHOC_MODE_IN_JOB_SHARED, in_job_dedicated = ADM_ADHOC_MODE_IN_JOB_DEDICATED, @@ -371,7 +343,7 @@ struct adhoc_storage : public storage { std::vector m_nodes; }; - struct ctx : storage::ctx { + struct ctx { ctx(execution_mode exec_mode, access_type access_type, adhoc_storage::resources resources, std::uint32_t walltime, @@ -398,15 +370,13 @@ struct adhoc_storage : public storage { bool m_should_flush; }; - 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); - explicit adhoc_storage(ADM_storage_t storage); - 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 name, std::uint64_t id, - const admire::adhoc_storage::ctx& ctx); + adhoc_storage(enum adhoc_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); + explicit adhoc_storage(ADM_adhoc_storage_t storage); + adhoc_storage(enum adhoc_storage::type type, std::string name, + std::uint64_t id, const admire::adhoc_storage::ctx& ctx); adhoc_storage(const adhoc_storage& other) noexcept; adhoc_storage(adhoc_storage&&) noexcept; @@ -414,10 +384,16 @@ struct adhoc_storage : public storage { operator=(const adhoc_storage&) noexcept; adhoc_storage& operator=(adhoc_storage&&) noexcept; - ~adhoc_storage() override; + ~adhoc_storage(); - std::shared_ptr - context() const final; + std::string + name() const; + type + type() const; + std::uint64_t + id() const; + adhoc_storage::ctx + context() const; void update(admire::adhoc_storage::ctx new_ctx); @@ -427,9 +403,14 @@ private: std::unique_ptr m_pimpl; }; -struct pfs_storage : public storage { +struct pfs_storage { - struct ctx : storage::ctx { + enum class type : std::underlying_type::type { + lustre = ADM_PFS_STORAGE_LUSTRE, + gpfs = ADM_PFS_STORAGE_GPFS + }; + + struct ctx { explicit ctx(std::filesystem::path mount_point); @@ -442,20 +423,24 @@ struct pfs_storage : public storage { std::filesystem::path m_mount_point; }; - pfs_storage(enum storage::type type, std::string name, std::uint64_t id, + pfs_storage(enum pfs_storage::type type, std::string name, std::uint64_t id, std::filesystem::path mount_point); - 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& operator=(const pfs_storage& other) noexcept; pfs_storage& operator=(pfs_storage&&) noexcept = default; - ~pfs_storage() override; + ~pfs_storage(); - std::shared_ptr - context() const final; + std::string + name() const; + type + type() const; + std::uint64_t + id() const; + pfs_storage::ctx + context() const; private: class impl; @@ -547,34 +532,29 @@ struct fmt::formatter : formatter { }; template <> -struct fmt::formatter +struct fmt::formatter : formatter { // parse is inherited from formatter. template auto - format(const enum admire::storage::type& t, FormatContext& ctx) const { + format(const enum admire::adhoc_storage::type& t, + FormatContext& ctx) const { - using admire::storage; + using admire::adhoc_storage; std::string_view name = "unknown"; switch(t) { - case storage::type::gekkofs: - name = "ADM_STORAGE_GEKKOFS"; - break; - case storage::type::dataclay: - name = "ADM_STORAGE_DATACLAY"; + case adhoc_storage::type::gekkofs: + name = "ADM_ADHOC_STORAGE_GEKKOFS"; break; - case storage::type::expand: - name = "ADM_STORAGE_EXPAND"; + case adhoc_storage::type::dataclay: + name = "ADM_ADHOC_STORAGE_DATACLAY"; break; - case storage::type::hercules: - name = "ADM_STORAGE_HERCULES"; + case adhoc_storage::type::expand: + name = "ADM_ADHOC_STORAGE_EXPAND"; break; - case storage::type::lustre: - name = "ADM_STORAGE_LUSTRE"; - break; - case storage::type::gpfs: - name = "ADM_STORAGE_GPFS"; + case adhoc_storage::type::hercules: + name = "ADM_ADHOC_STORAGE_HERCULES"; break; } @@ -643,41 +623,6 @@ struct fmt::formatter } }; -template <> -struct fmt::formatter> - : formatter { - // parse is inherited from formatter. - template - auto - format(const std::shared_ptr& s, - FormatContext& ctx) const { - - if(!s) { - return formatter::format("NULL", ctx); - } - - switch(s->type()) { - case admire::storage::type::gekkofs: - case admire::storage::type::dataclay: - case admire::storage::type::expand: - case admire::storage::type::hercules: - return formatter::format( - fmt::format("{}", - *(dynamic_cast( - s.get()))), - ctx); - case admire::storage::type::lustre: - case admire::storage::type::gpfs: - return formatter::format( - fmt::format("{}", *(dynamic_cast( - s.get()))), - ctx); - default: - return formatter::format("unknown", ctx); - } - } -}; - template struct fmt::formatter> : formatter { @@ -696,14 +641,9 @@ struct fmt::formatter : formatter { template auto format(const admire::adhoc_storage& s, FormatContext& ctx) const { - - const auto pctx = std::dynamic_pointer_cast( - s.context()); - - const auto str = - fmt::format("{{type: {}, id: {}, name: {}, context: {}}}", - s.type(), s.id(), std::quoted(s.name()), - (pctx ? fmt::format("{}", *pctx) : "NULL")); + const auto str = fmt::format( + "{{type: {}, id: {}, name: {}, context: {}}}", s.type(), s.id(), + std::quoted(s.name()), s.context()); return formatter::format(str, ctx); } }; @@ -742,6 +682,29 @@ struct fmt::formatter } }; +template <> +struct fmt::formatter + : formatter { + // parse is inherited from formatter. + template + auto + format(const enum admire::pfs_storage::type& t, FormatContext& ctx) const { + + using admire::pfs_storage; + std::string_view name = "unknown"; + + switch(t) { + case pfs_storage::type::lustre: + name = "ADM_PFS_STORAGE_LUSTRE"; + break; + case pfs_storage::type::gpfs: + name = "ADM_PFS_STORAGE_GPFS"; + break; + } + + return formatter::format(name, ctx); + } +}; template <> struct fmt::formatter : formatter { @@ -749,11 +712,7 @@ struct fmt::formatter : formatter { template auto format(const admire::pfs_storage& s, FormatContext& ctx) const { - - const auto pctx = std::dynamic_pointer_cast( - s.context()); - const auto str = fmt::format( - "{{context: {}}}", (pctx ? fmt::format("{}", *pctx) : "NULL")); + const auto str = fmt::format("{{context: {}}}", s.context()); return formatter::format(str, ctx); } }; diff --git a/src/common/api/convert.cpp b/src/common/api/convert.cpp index 6f1e131a77ff0f1933ffd7e3f36be14099c9ddc0..3dc82ce3ef9840c6e74db8c3ac33f3c47c73d9fa 100644 --- a/src/common/api/convert.cpp +++ b/src/common/api/convert.cpp @@ -96,27 +96,25 @@ convert(const adhoc_storage::ctx& ctx) { std::move(managed_adhoc_resources)}; } -managed_ctype +managed_ctype convert(const std::optional& adhoc_storage) { if(!adhoc_storage) { - return managed_ctype{}; + return managed_ctype{}; } return convert(adhoc_storage.value()); } -managed_ctype +managed_ctype convert(const admire::adhoc_storage& st) { - auto managed_ctx = - convert(*std::static_pointer_cast( - st.context())); - ADM_storage_t c_st = ADM_storage_create( - st.name().c_str(), static_cast(st.type()), + auto managed_ctx = convert(st.context()); + ADM_adhoc_storage_t c_st = ADM_adhoc_storage_create( + st.name().c_str(), static_cast(st.type()), st.id(), managed_ctx.get()); - return managed_ctype{c_st, std::move(managed_ctx)}; + return managed_ctype{c_st, std::move(managed_ctx)}; } managed_ctype diff --git a/src/common/api/convert.hpp b/src/common/api/convert.hpp index e8ed9bbc226eb2442565f23a100f5e07a7885470..1104baba40ae52a66dfc80e13ba6f791fe701ac7 100644 --- a/src/common/api/convert.hpp +++ b/src/common/api/convert.hpp @@ -48,7 +48,7 @@ convert(const adhoc_storage::resources& res); managed_ctype convert(const adhoc_storage::ctx& ctx); -managed_ctype +managed_ctype convert(const admire::adhoc_storage& st); managed_ctype @@ -200,26 +200,27 @@ struct admire::api::managed_ctype { }; template <> -struct admire::api::managed_ctype { +struct admire::api::managed_ctype { managed_ctype() = default; - explicit managed_ctype(ADM_storage_t st, + explicit managed_ctype(ADM_adhoc_storage_t st, managed_ctype&& ctx) : m_storage(st), m_ctx(std::move(ctx)) {} - ADM_storage_t + ADM_adhoc_storage_t get() const { return m_storage.get(); } - ADM_storage_t + ADM_adhoc_storage_t release() { std::ignore = m_ctx.release(); return m_storage.release(); } - scord::utils::ctype_ptr m_storage; + scord::utils::ctype_ptr + m_storage; managed_ctype m_ctx; }; @@ -321,9 +322,10 @@ struct admire::api::managed_ctype { explicit managed_ctype(ADM_job_requirements_t reqs, managed_ctype_array&& inputs, managed_ctype_array&& outputs, - managed_ctype&& storage) + managed_ctype&& adhoc_storage) : m_reqs(reqs), m_inputs(std::move(inputs)), - m_outputs(std::move(outputs)), m_storage(std::move(storage)) {} + m_outputs(std::move(outputs)), + m_adhoc_storage(std::move(adhoc_storage)) {} ADM_job_requirements_t get() const { @@ -341,7 +343,7 @@ struct admire::api::managed_ctype { m_reqs; managed_ctype_array m_inputs; managed_ctype_array m_outputs; - managed_ctype m_storage; + managed_ctype m_adhoc_storage; }; diff --git a/src/common/api/types.cpp b/src/common/api/types.cpp index 2a337e98349df2b49ca8aae6a20554ed14d60aaa..56a4135943b192cfd8c3aee1bcc0297afc8da775 100644 --- a/src/common/api/types.cpp +++ b/src/common/api/types.cpp @@ -439,16 +439,16 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list) { return ret; } -ADM_storage_t -ADM_storage_create(const char* name, ADM_storage_type_t type, uint64_t id, - void* ctx) { +ADM_adhoc_storage_t +ADM_adhoc_storage_create(const char* name, ADM_adhoc_storage_type_t type, + uint64_t id, ADM_adhoc_context_t adhoc_ctx) { - struct adm_storage* adm_storage = - (struct adm_storage*) malloc(sizeof(*adm_storage)); + struct adm_adhoc_storage* adm_adhoc_storage = + (struct adm_adhoc_storage*) malloc(sizeof(*adm_adhoc_storage)); const char* error_msg = NULL; - if(!adm_storage) { - LOGGER_ERROR("Could not allocate ADM_storage_t"); + if(!adm_adhoc_storage) { + LOGGER_ERROR("Could not allocate ADM_adhoc_storage_t"); return NULL; } @@ -457,92 +457,59 @@ ADM_storage_create(const char* name, ADM_storage_type_t type, uint64_t id, return NULL; } - if(!ctx) { + if(!adhoc_ctx) { LOGGER_ERROR("Null storage context") return NULL; } - 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_id = id; - - switch(adm_storage->s_type) { - case ADM_STORAGE_GEKKOFS: - case ADM_STORAGE_DATACLAY: - case ADM_STORAGE_EXPAND: - case ADM_STORAGE_HERCULES: - adm_storage->s_adhoc_ctx = - (ADM_adhoc_context_t) calloc(1, sizeof(adm_adhoc_context)); - if(!adm_storage->s_adhoc_ctx) { - error_msg = "Could not allocate ADM_adhoc_context_t"; - goto cleanup_on_error; - } - - memcpy(adm_storage->s_adhoc_ctx, (ADM_adhoc_context_t) ctx, - sizeof(*(ADM_adhoc_context_t) ctx)); - break; - - case ADM_STORAGE_LUSTRE: - case ADM_STORAGE_GPFS: - adm_storage->s_pfs_ctx = - (ADM_pfs_context_t) calloc(1, sizeof(adm_pfs_context)); - if(!adm_storage->s_pfs_ctx) { - error_msg = "Could not allocate ADM_pfs_context_t"; - goto cleanup_on_error; - } + adm_adhoc_storage->s_name = + (const char*) calloc(strlen(name) + 1, sizeof(char)); + strcpy((char*) adm_adhoc_storage->s_name, name); + adm_adhoc_storage->s_type = type; + adm_adhoc_storage->s_id = id; - memcpy(adm_storage->s_pfs_ctx, (ADM_pfs_context_t) ctx, - sizeof(*(ADM_pfs_context_t) ctx)); - break; + adm_adhoc_storage->s_adhoc_ctx = + (ADM_adhoc_context_t) calloc(1, sizeof(adm_adhoc_context)); + if(!adm_adhoc_storage->s_adhoc_ctx) { + error_msg = "Could not allocate ADM_adhoc_context_t"; + goto cleanup_on_error; } - return adm_storage; + memcpy(adm_adhoc_storage->s_adhoc_ctx, adhoc_ctx, sizeof(*adhoc_ctx)); + + return adm_adhoc_storage; cleanup_on_error: if(error_msg) { LOGGER_ERROR(error_msg); } - [[maybe_unused]] ADM_return_t ret = ADM_storage_destroy(adm_storage); + [[maybe_unused]] ADM_return_t ret = + ADM_adhoc_storage_destroy(adm_adhoc_storage); assert(ret); return NULL; } ADM_return_t -ADM_storage_destroy(ADM_storage_t storage) { +ADM_adhoc_storage_destroy(ADM_adhoc_storage_t adhoc_storage) { ADM_return_t ret = ADM_SUCCESS; - if(!storage) { - LOGGER_ERROR("Invalid ADM_storage_t") + if(!adhoc_storage) { + LOGGER_ERROR("Invalid ADM_adhoc_storage_t") return ADM_EBADARGS; } - if(storage->s_name) { - free((void*) storage->s_name); + if(adhoc_storage->s_name) { + free((void*) adhoc_storage->s_name); } - switch(storage->s_type) { - case ADM_STORAGE_GEKKOFS: - case ADM_STORAGE_DATACLAY: - case ADM_STORAGE_EXPAND: - case ADM_STORAGE_HERCULES: - if(storage->s_adhoc_ctx) { - free(storage->s_adhoc_ctx); - } - break; - - case ADM_STORAGE_LUSTRE: - case ADM_STORAGE_GPFS: - if(storage->s_pfs_ctx) { - free(storage->s_pfs_ctx); - } - break; + if(adhoc_storage->s_adhoc_ctx) { + free(adhoc_storage->s_adhoc_ctx); } - free(storage); + free(adhoc_storage); return ret; } @@ -601,6 +568,80 @@ ADM_adhoc_resources_destroy(ADM_adhoc_resources_t res) { return ret; } +ADM_pfs_storage_t +ADM_pfs_storage_create(const char* name, ADM_pfs_storage_type_t type, + uint64_t id, ADM_pfs_context_t pfs_ctx) { + + struct adm_pfs_storage* adm_pfs_storage = + (struct adm_pfs_storage*) malloc(sizeof(*adm_pfs_storage)); + const char* error_msg = NULL; + + if(!adm_pfs_storage) { + LOGGER_ERROR("Could not allocate ADM_pfs_storage_t"); + return NULL; + } + + if(!name) { + LOGGER_ERROR("Null storage name") + return NULL; + } + + if(!pfs_ctx) { + LOGGER_ERROR("Null storage context") + return NULL; + } + + adm_pfs_storage->s_name = + (const char*) calloc(strlen(name) + 1, sizeof(char)); + strcpy((char*) adm_pfs_storage->s_name, name); + adm_pfs_storage->s_type = type; + adm_pfs_storage->s_id = id; + + adm_pfs_storage->s_pfs_ctx = + (ADM_pfs_context_t) calloc(1, sizeof(adm_pfs_context)); + if(!adm_pfs_storage->s_pfs_ctx) { + error_msg = "Could not allocate ADM_pfs_context_t"; + goto cleanup_on_error; + } + + memcpy(adm_pfs_storage->s_pfs_ctx, pfs_ctx, sizeof(*pfs_ctx)); + + return adm_pfs_storage; + +cleanup_on_error: + if(error_msg) { + LOGGER_ERROR(error_msg); + } + + [[maybe_unused]] ADM_return_t ret = + ADM_pfs_storage_destroy(adm_pfs_storage); + assert(ret); + + return NULL; +} + +ADM_return_t +ADM_pfs_storage_destroy(ADM_pfs_storage_t pfs_storage) { + + ADM_return_t ret = ADM_SUCCESS; + + if(!pfs_storage) { + LOGGER_ERROR("Invalid ADM_pfs_storage_t") + return ADM_EBADARGS; + } + + if(pfs_storage->s_name) { + free((void*) pfs_storage->s_name); + } + + if(pfs_storage->s_pfs_ctx) { + free(pfs_storage->s_pfs_ctx); + } + + free(pfs_storage); + return ret; +} + ADM_data_operation_t ADM_data_operation_create() { @@ -755,7 +796,7 @@ ADM_job_resources_destroy(ADM_job_resources_t res) { ADM_job_requirements_t ADM_job_requirements_create(ADM_dataset_t inputs[], size_t inputs_len, ADM_dataset_t outputs[], size_t outputs_len, - ADM_storage_t storage) { + ADM_adhoc_storage_t adhoc_storage) { struct adm_job_requirements* adm_job_reqs = (struct adm_job_requirements*) calloc( @@ -787,21 +828,21 @@ ADM_job_requirements_create(ADM_dataset_t inputs[], size_t inputs_len, adm_job_reqs->r_inputs = inputs_list; adm_job_reqs->r_outputs = outputs_list; - if(!storage) { + if(!adhoc_storage) { return adm_job_reqs; } - if(storage->s_type != ADM_STORAGE_GEKKOFS && - storage->s_type != ADM_STORAGE_DATACLAY && - storage->s_type != ADM_STORAGE_EXPAND && - storage->s_type != ADM_STORAGE_HERCULES) { + if(adhoc_storage->s_type != ADM_ADHOC_STORAGE_GEKKOFS && + adhoc_storage->s_type != ADM_ADHOC_STORAGE_DATACLAY && + adhoc_storage->s_type != ADM_ADHOC_STORAGE_EXPAND && + adhoc_storage->s_type != ADM_ADHOC_STORAGE_HERCULES) { error_msg = "Invalid adhoc_storage type"; goto cleanup_on_error; } - adm_job_reqs->r_storage = - ADM_storage_create(storage->s_name, storage->s_type, storage->s_id, - storage->s_adhoc_ctx); + adm_job_reqs->r_adhoc_storage = ADM_adhoc_storage_create( + adhoc_storage->s_name, adhoc_storage->s_type, adhoc_storage->s_id, + adhoc_storage->s_adhoc_ctx); return adm_job_reqs; @@ -835,8 +876,8 @@ ADM_job_requirements_destroy(ADM_job_requirements_t reqs) { ADM_dataset_list_destroy(reqs->r_outputs); } - if(reqs->r_storage) { - ADM_storage_destroy(reqs->r_storage); + if(reqs->r_adhoc_storage) { + ADM_adhoc_storage_destroy(reqs->r_adhoc_storage); } free(reqs); @@ -1279,24 +1320,6 @@ dataset::id() const { return m_pimpl->id(); } -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::name() const { - return m_name; -} - -enum storage::type -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)) {} @@ -1356,7 +1379,10 @@ adhoc_storage::ctx::should_flush() const { class adhoc_storage::impl { public: - explicit impl(adhoc_storage::ctx ctx) : m_ctx(std::move(ctx)) {} + explicit impl(enum adhoc_storage::type type, std::string name, + std::uint64_t id, adhoc_storage::ctx ctx) + : m_type(type), m_name(std::move(name)), m_id(id), + m_ctx(std::move(ctx)) {} impl(const impl& rhs) = default; impl(impl&& rhs) = default; impl& @@ -1365,6 +1391,21 @@ public: operator=(impl&&) noexcept = default; ~impl() = default; + std::string + name() const { + return m_name; + } + + enum type + type() const { + return m_type; + } + + std::uint64_t + id() const { + return m_id; + } + adhoc_storage::ctx context() const { return m_ctx; @@ -1376,50 +1417,33 @@ public: } private: + enum type m_type; + std::string m_name; + std::uint64_t m_id; adhoc_storage::ctx m_ctx; }; -adhoc_storage::adhoc_storage(enum storage::type type, std::string name, +adhoc_storage::adhoc_storage(enum adhoc_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(name), id), - m_pimpl(std::make_unique( + : m_pimpl(std::make_unique( + type, std::move(name), id, adhoc_storage::ctx{exec_mode, access_type, std::move(res), walltime, should_flush})) {} -adhoc_storage::adhoc_storage(ADM_storage_t st) - : storage(static_cast(st->s_type), st->s_name, - st->s_id) { - - switch(st->s_type) { - case ADM_STORAGE_LUSTRE: - case ADM_STORAGE_GPFS: - throw std::runtime_error( - fmt::format("Invalid type {} for adhoc_storage", - static_cast(st->s_type))); - break; - - default: - break; - } - m_pimpl = std::make_unique(adhoc_storage::ctx{st->s_adhoc_ctx}); -} - -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(ADM_adhoc_storage_t st) + : m_pimpl(std::make_unique( + static_cast(st->s_type), st->s_name, + st->s_id, adhoc_storage::ctx{st->s_adhoc_ctx})) {} -adhoc_storage::adhoc_storage(enum storage::type type, std::string name, +adhoc_storage::adhoc_storage(enum adhoc_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)) { -} + : m_pimpl(std::make_unique(type, std::move(name), id, ctx)) {} adhoc_storage::adhoc_storage(const adhoc_storage& other) noexcept - : storage(other.m_type, other.m_name, other.m_id), - m_pimpl(std::make_unique(*other.m_pimpl)) {} + : m_pimpl(std::make_unique(*other.m_pimpl)) {} adhoc_storage::adhoc_storage(adhoc_storage&&) noexcept = default; @@ -1432,9 +1456,24 @@ adhoc_storage::operator=(const adhoc_storage& other) noexcept { adhoc_storage& adhoc_storage::operator=(adhoc_storage&&) noexcept = default; -std::shared_ptr +std::string +adhoc_storage::name() const { + return m_pimpl->name(); +} + +enum adhoc_storage::type +adhoc_storage::type() const { + return m_pimpl->type(); +} + +std::uint64_t +adhoc_storage::id() const { + return m_pimpl->id(); +} + +adhoc_storage::ctx adhoc_storage::context() const { - return std::make_shared(m_pimpl->context()); + return m_pimpl->context(); } void @@ -1450,8 +1489,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_name, other.m_id), - m_pimpl(std::make_unique(*other.m_pimpl)) {} + : m_pimpl(std::make_unique(*other.m_pimpl)) {} pfs_storage& pfs_storage::operator=(const pfs_storage& other) noexcept { @@ -1465,9 +1503,11 @@ pfs_storage::ctx::mount_point() const { } class pfs_storage::impl { - public: - explicit impl(pfs_storage::ctx ctx) : m_ctx(std::move(ctx)) {} + explicit impl(enum pfs_storage::type type, std::string name, + std::uint64_t id, pfs_storage::ctx ctx) + : m_type(type), m_name(std::move(name)), m_id(id), + m_ctx(std::move(ctx)) {} impl(const impl& rhs) = default; impl(impl&& rhs) = default; impl& @@ -1475,35 +1515,62 @@ public: impl& operator=(impl&&) noexcept = default; + enum type + type() const { + return m_type; + }; + + std::string + name() const { + return m_name; + } + + std::uint64_t + id() const { + return m_id; + }; + pfs_storage::ctx context() const { return m_ctx; } private: + enum type m_type; + std::string m_name; + std::uint64_t m_id; pfs_storage::ctx m_ctx; }; -pfs_storage::pfs_storage(enum storage::type type, std::string name, +pfs_storage::pfs_storage(enum pfs_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( + : m_pimpl(std::make_unique( + type, std::move(name), id, pfs_storage::ctx{std::move(mount_point)})) {} -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; -std::shared_ptr +std::string +pfs_storage::name() const { + return m_pimpl->name(); +} + +enum pfs_storage::type +pfs_storage::type() const { + return m_pimpl->type(); +} + +std::uint64_t +pfs_storage::id() const { + return m_pimpl->id(); +} + +pfs_storage::ctx pfs_storage::context() const { - return std::make_shared(m_pimpl->context()); + return m_pimpl->context(); } class job_requirements::impl { - public: impl(std::vector inputs, std::vector outputs) @@ -1529,12 +1596,8 @@ public: m_outputs.emplace_back(reqs->r_outputs->l_datasets[i].d_id); } - if(reqs->r_storage) { - // TODO add a conversion constructor - m_adhoc_storage = admire::adhoc_storage( - static_cast(reqs->r_storage->s_type), - reqs->r_storage->s_name, reqs->r_storage->s_id, - reqs->r_storage->s_adhoc_ctx); + if(reqs->r_adhoc_storage) { + m_adhoc_storage = admire::adhoc_storage(reqs->r_adhoc_storage); } } @@ -1612,7 +1675,6 @@ job_requirements::adhoc_storage() const { } namespace qos { - class entity::impl { public: template diff --git a/src/common/net/proto/rpc_types.c b/src/common/net/proto/rpc_types.c index c2df5d57e38b5d90c6b901ebcd8a0179c59df473..623d9803fe744af85de219182fd84b5c7d17703e 100644 --- a/src/common/net/proto/rpc_types.c +++ b/src/common/net/proto/rpc_types.c @@ -24,8 +24,10 @@ #include "rpc_types.h" -hg_return_t (*hg_proc_ADM_storage_type_t)(hg_proc_t, - void*) = hg_proc_hg_uint32_t; +hg_return_t (*hg_proc_ADM_adhoc_storage_type_t)(hg_proc_t, + void*) = hg_proc_hg_uint32_t; +hg_return_t (*hg_proc_ADM_pfs_storage_type_t)(hg_proc_t, + void*) = hg_proc_hg_uint32_t; hg_return_t (*hg_proc_ADM_qos_scope_t)(hg_proc_t, void*) = hg_proc_hg_uint32_t; hg_return_t (*hg_proc_ADM_qos_class_t)(hg_proc_t, void*) = hg_proc_hg_uint32_t; @@ -387,20 +389,19 @@ hg_proc_ADM_dataset_list_t(hg_proc_t proc, void* data) { hg_return_t -hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { - (void) proc; - (void) data; +hg_proc_ADM_adhoc_storage_t(hg_proc_t proc, void* data) { hg_return_t ret = HG_SUCCESS; - ADM_storage_t* storage = (ADM_storage_t*) data; - ADM_storage_t tmp = NULL; + ADM_adhoc_storage_t* storage = (ADM_adhoc_storage_t*) data; + ADM_adhoc_storage_t tmp = NULL; hg_size_t storage_length = 0; switch(hg_proc_get_op(proc)) { case HG_ENCODE: - // find out the length of the adm_storage object we need to send - storage_length = *storage ? sizeof(adm_storage) : 0; + // find out the length of the adm_adhoc_storage object we need to + // send + storage_length = *storage ? sizeof(adm_adhoc_storage) : 0; ret = hg_proc_hg_size_t(proc, &storage_length); if(ret != HG_SUCCESS) { @@ -411,7 +412,7 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { return HG_SUCCESS; } - // if we actually need to send an adm_storage object, + // if we actually need to send an adm_adhoc_storage object, // write each of its fields to the mercury buffer tmp = *storage; @@ -437,23 +438,16 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { } // 4. the appropriate storage context - switch(tmp->s_type) { - case ADM_STORAGE_GEKKOFS: - case ADM_STORAGE_DATACLAY: - case ADM_STORAGE_EXPAND: - case ADM_STORAGE_HERCULES: - ret = hg_proc_ADM_adhoc_context_t(proc, &tmp->s_adhoc_ctx); - break; - case ADM_STORAGE_LUSTRE: - case ADM_STORAGE_GPFS: - ret = hg_proc_ADM_pfs_context_t(proc, &tmp->s_pfs_ctx); - break; + ret = hg_proc_ADM_adhoc_context_t(proc, &tmp->s_adhoc_ctx); + + if(ret != HG_SUCCESS) { + break; } break; case HG_DECODE: - // find out the length of the adm_storage object + // find out the length of the adm_adhoc_storage object ret = hg_proc_hg_size_t(proc, &storage_length); if(ret != HG_SUCCESS) { @@ -465,9 +459,9 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { break; } - // if the received adm_storage object was not NULL, read each of - // its fields from the mercury buffer - tmp = (adm_storage*) calloc(1, sizeof(adm_storage)); + // if the received adm_adhoc_storage object was not NULL, read each + // of its fields from the mercury buffer + tmp = (adm_adhoc_storage*) calloc(1, sizeof(adm_adhoc_storage)); // 1. the storage type ret = hg_proc_uint32_t(proc, &tmp->s_type); @@ -491,17 +485,10 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { } // 4. the appropriate storage context - switch(tmp->s_type) { - case ADM_STORAGE_GEKKOFS: - case ADM_STORAGE_DATACLAY: - case ADM_STORAGE_EXPAND: - case ADM_STORAGE_HERCULES: - ret = hg_proc_ADM_adhoc_context_t(proc, &tmp->s_adhoc_ctx); - break; - case ADM_STORAGE_LUSTRE: - case ADM_STORAGE_GPFS: - ret = hg_proc_ADM_pfs_context_t(proc, &tmp->s_adhoc_ctx); - break; + ret = hg_proc_ADM_adhoc_context_t(proc, &tmp->s_adhoc_ctx); + + if(ret != HG_SUCCESS) { + break; } // return the newly-created ctx @@ -588,6 +575,116 @@ hg_proc_ADM_adhoc_context_t(hg_proc_t proc, void* data) { return ret; } +hg_return_t +hg_proc_ADM_pfs_storage_t(hg_proc_t proc, void* data) { + + hg_return_t ret = HG_SUCCESS; + ADM_pfs_storage_t* storage = (ADM_pfs_storage_t*) data; + ADM_pfs_storage_t tmp = NULL; + hg_size_t storage_length = 0; + + switch(hg_proc_get_op(proc)) { + + case HG_ENCODE: + // find out the length of the adm_pfs_storage object we need to send + storage_length = *storage ? sizeof(adm_pfs_storage) : 0; + ret = hg_proc_hg_size_t(proc, &storage_length); + + if(ret != HG_SUCCESS) { + break; + } + + if(!storage_length) { + return HG_SUCCESS; + } + + // if we actually need to send an adm_pfs_storage object, + // write each of its fields to the mercury buffer + tmp = *storage; + + // 1. the storage type + ret = hg_proc_hg_uint32_t(proc, &tmp->s_type); + + if(ret != HG_SUCCESS) { + break; + } + + // 2. the storage id + ret = hg_proc_hg_const_string_t(proc, &tmp->s_name); + + if(ret != HG_SUCCESS) { + break; + } + + // 3. the server-assigned id + ret = hg_proc_hg_int64_t(proc, &tmp->s_id); + + if(ret != HG_SUCCESS) { + break; + } + + // 4. the appropriate storage context + ret = hg_proc_ADM_pfs_context_t(proc, &tmp->s_pfs_ctx); + break; + + case HG_DECODE: + // find out the length of the adm_pfs_storage object + ret = hg_proc_hg_size_t(proc, &storage_length); + + if(ret != HG_SUCCESS) { + break; + } + + if(!storage_length) { + *storage = NULL; + break; + } + + // if the received adm_pfs_storage object was not NULL, read each of + // its fields from the mercury buffer + tmp = (adm_pfs_storage*) calloc(1, sizeof(adm_pfs_storage)); + + // 1. the storage type + ret = hg_proc_uint32_t(proc, &tmp->s_type); + + if(ret != HG_SUCCESS) { + break; + } + + // 2. the storage id + ret = hg_proc_hg_const_string_t(proc, &tmp->s_name); + + if(ret != HG_SUCCESS) { + break; + } + + // 3. the server-assigned id + ret = hg_proc_hg_int64_t(proc, &tmp->s_id); + + if(ret != HG_SUCCESS) { + break; + } + + // 4. the appropriate storage context + ret = hg_proc_ADM_pfs_context_t(proc, &tmp->s_pfs_ctx); + + if(ret != HG_SUCCESS) { + break; + } + + // return the newly-created ctx + *storage = tmp; + break; + + case HG_FREE: + tmp = *storage; + free(tmp); + break; + } + + return ret; +} + hg_return_t hg_proc_ADM_pfs_context_t(hg_proc_t proc, void* data) { diff --git a/src/common/net/proto/rpc_types.h b/src/common/net/proto/rpc_types.h index b624c8281bafa00d1c243dac1c89c1e3c64edb86..07a8c02919564959f083c6abe21faaf7122cab8f 100644 --- a/src/common/net/proto/rpc_types.h +++ b/src/common/net/proto/rpc_types.h @@ -182,21 +182,29 @@ MERCURY_GEN_STRUCT_PROC( ); // clang-format on -extern hg_return_t (*hg_proc_ADM_storage_type_t)(hg_proc_t, void*); +extern hg_return_t (*hg_proc_ADM_adhoc_storage_type_t)(hg_proc_t, void*); -typedef struct adm_storage { +typedef struct adm_adhoc_storage { const char* s_name; - ADM_storage_type_t s_type; + ADM_adhoc_storage_type_t s_type; uint64_t s_id; - union { - ADM_adhoc_context_t s_adhoc_ctx; - ADM_pfs_context_t s_pfs_ctx; - }; -} adm_storage; + ADM_adhoc_context_t s_adhoc_ctx; +} adm_adhoc_storage; hg_return_t -hg_proc_ADM_storage_t(hg_proc_t proc, void* data); +hg_proc_ADM_adhoc_storage_t(hg_proc_t proc, void* data); +extern hg_return_t (*hg_proc_ADM_pfs_storage_type_t)(hg_proc_t, void*); + +typedef struct adm_pfs_storage { + const char* s_name; + ADM_pfs_storage_type_t s_type; + uint64_t s_id; + ADM_pfs_context_t s_pfs_ctx; +} adm_pfs_storage; + +hg_return_t +hg_proc_ADM_pfs_storage_t(hg_proc_t proc, void* data); struct adm_node_list { /** An array of nodes */ @@ -256,15 +264,15 @@ typedef struct adm_job_requirements { /** An array of output datasets */ ADM_dataset_list_t r_outputs; /** An optional definition for a specific storage instance */ - ADM_storage_t r_storage; + ADM_adhoc_storage_t r_adhoc_storage; } adm_job_requirements; // clang-format off MERCURY_GEN_STRUCT_PROC( adm_job_requirements, // NOLINT - ((ADM_dataset_list_t) (r_inputs)) - ((ADM_dataset_list_t) (r_outputs)) - ((ADM_storage_t) (r_storage)) + ((ADM_dataset_list_t) (r_inputs)) + ((ADM_dataset_list_t) (r_outputs)) + ((ADM_adhoc_storage_t) (r_adhoc_storage)) ); // clang-format on @@ -334,9 +342,9 @@ MERCURY_GEN_PROC( /// ADM_register_adhoc_storage MERCURY_GEN_PROC( ADM_register_adhoc_storage_in_t, - ((hg_const_string_t) (name)) - ((ADM_storage_type_t) (type)) - ((ADM_adhoc_context_t) (ctx)) + ((hg_const_string_t) (name)) + ((ADM_adhoc_storage_type_t) (type)) + ((ADM_adhoc_context_t) (ctx)) ); MERCURY_GEN_PROC( diff --git a/src/lib/admire.cpp b/src/lib/admire.cpp index e3e74f11655525d482433ce5e8e6a28da629bc18..3e0a964899b790e86ae5ad0b2d70b4c204c4a002 100644 --- a/src/lib/admire.cpp +++ b/src/lib/admire.cpp @@ -292,12 +292,11 @@ deploy_adhoc_storage(const server& srv, const adhoc_storage& adhoc_storage) { throw std::runtime_error(fmt::format( "ADM_deploy_adhoc_storage() error: {}", ec.message())); } - } ADM_return_t register_pfs_storage(const server& srv, ADM_pfs_context_t ctx, - ADM_storage_t* pfs_storage) { + ADM_pfs_storage_t* pfs_storage) { (void) srv; (void) ctx; (void) pfs_storage; @@ -324,7 +323,7 @@ register_pfs_storage(const server& srv, ADM_pfs_context_t ctx, ADM_return_t update_pfs_storage(const server& srv, ADM_pfs_context_t ctx, - ADM_storage_t pfs_storage) { + ADM_pfs_storage_t pfs_storage) { (void) srv; (void) ctx; (void) pfs_storage; @@ -350,7 +349,7 @@ update_pfs_storage(const server& srv, ADM_pfs_context_t ctx, } ADM_return_t -remove_pfs_storage(const server& srv, ADM_storage_t pfs_storage) { +remove_pfs_storage(const server& srv, ADM_pfs_storage_t pfs_storage) { (void) srv; (void) pfs_storage; @@ -423,7 +422,7 @@ set_dataset_information(const server& srv, ADM_job_t job, ADM_dataset_t target, } ADM_return_t -set_io_resources(const server& srv, ADM_job_t job, ADM_storage_t tier, +set_io_resources(const server& srv, ADM_job_t job, ADM_adhoc_storage_t tier, ADM_adhoc_resources_t resources) { (void) srv; (void) job; diff --git a/src/lib/admire.h b/src/lib/admire.h index 2545d6c465b18ff5885afe46b2ff8dacc752fa0d..87b623498dd8f83cfbfcbb19e9b3c7123553e84c 100644 --- a/src/lib/admire.h +++ b/src/lib/admire.h @@ -113,8 +113,9 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job); */ ADM_return_t ADM_register_adhoc_storage(ADM_server_t server, const char* name, - ADM_storage_type_t type, ADM_adhoc_context_t ctx, - ADM_storage_t* adhoc_storage); + ADM_adhoc_storage_type_t type, + ADM_adhoc_context_t ctx, + ADM_adhoc_storage_t* adhoc_storage); /** * Update an already-registered adhoc storage system. @@ -127,7 +128,7 @@ ADM_register_adhoc_storage(ADM_server_t server, const char* name, * successfully. */ ADM_return_t -ADM_update_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage, +ADM_update_adhoc_storage(ADM_server_t server, ADM_adhoc_storage_t adhoc_storage, ADM_adhoc_context_t ctx); /** @@ -141,7 +142,8 @@ ADM_update_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage, * successfully. */ ADM_return_t -ADM_remove_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage); +ADM_remove_adhoc_storage(ADM_server_t server, + ADM_adhoc_storage_t adhoc_storage); /** * Initiate the deployment of an adhoc storage system instance. @@ -153,7 +155,8 @@ ADM_remove_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage); * @return Returns ADM_SUCCESS if the remote procedure has completed */ ADM_return_t -ADM_deploy_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage); +ADM_deploy_adhoc_storage(ADM_server_t server, + ADM_adhoc_storage_t adhoc_storage); /** * Register a PFS storage tier. @@ -167,7 +170,7 @@ ADM_deploy_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage); */ ADM_return_t ADM_register_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, - ADM_storage_t* pfs_storage); + ADM_pfs_storage_t* pfs_storage); /** * Update an already-registered PFS storage tier. @@ -181,7 +184,7 @@ ADM_register_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, */ ADM_return_t ADM_update_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, - ADM_storage_t adhoc_storage); + ADM_pfs_storage_t adhoc_storage); /** * Remove an already-registered PFS storage tier. @@ -194,7 +197,7 @@ ADM_update_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, * successfully. */ ADM_return_t -ADM_remove_pfs_storage(ADM_server_t server, ADM_storage_t adhoc_storage); +ADM_remove_pfs_storage(ADM_server_t server, ADM_pfs_storage_t adhoc_storage); /** * Transfers the dataset identified by the source_name to the storage tier @@ -258,8 +261,8 @@ ADM_set_dataset_information(ADM_server_t server, ADM_job_t job, * successfully. */ ADM_return_t -ADM_set_io_resources(ADM_server_t server, ADM_job_t job, ADM_storage_t tier, - ADM_adhoc_resources_t resources); +ADM_set_io_resources(ADM_server_t server, ADM_job_t job, + ADM_adhoc_storage_t tier, ADM_adhoc_resources_t resources); /** diff --git a/src/lib/admire.hpp b/src/lib/admire.hpp index 980fcb277834831ade37c3efbd4139e9915f9b27..2980244f0d48efb34d2b743df9d04c55e9be23f9 100644 --- a/src/lib/admire.hpp +++ b/src/lib/admire.hpp @@ -74,14 +74,14 @@ deploy_adhoc_storage(const server& srv, const adhoc_storage& adhoc_storage); ADM_return_t register_pfs_storage(const server& srv, ADM_pfs_context_t ctx, - ADM_storage_t* pfs_storage); + ADM_pfs_storage_t* pfs_storage); ADM_return_t update_pfs_storage(const server& srv, ADM_pfs_context_t ctx, - ADM_storage_t pfs_storage); + ADM_pfs_storage_t pfs_storage); ADM_return_t -remove_pfs_storage(const server& srv, ADM_storage_t pfs_storage); +remove_pfs_storage(const server& srv, ADM_pfs_storage_t pfs_storage); admire::transfer transfer_datasets(const server& srv, const job& job, @@ -95,7 +95,7 @@ set_dataset_information(const server& srv, ADM_job_t job, ADM_dataset_t target, ADM_dataset_info_t info); ADM_return_t -set_io_resources(const server& srv, ADM_job_t job, ADM_storage_t tier, +set_io_resources(const server& srv, ADM_job_t job, ADM_adhoc_storage_t tier, ADM_adhoc_resources_t resources); ADM_return_t diff --git a/src/lib/c_wrapper.cpp b/src/lib/c_wrapper.cpp index fd5744e5d9db65f82d89cfc07b4e21fc20f4cb8f..be03a19722ecf18d350ab582b52097f6842f6839 100644 --- a/src/lib/c_wrapper.cpp +++ b/src/lib/c_wrapper.cpp @@ -82,8 +82,9 @@ ADM_remove_job(ADM_server_t server, ADM_job_t job) { ADM_return_t ADM_register_adhoc_storage(ADM_server_t server, const char* name, - ADM_storage_type_t type, ADM_adhoc_context_t ctx, - ADM_storage_t* adhoc_storage) { + ADM_adhoc_storage_type_t type, + ADM_adhoc_context_t ctx, + ADM_adhoc_storage_t* adhoc_storage) { const admire::server srv{server}; @@ -101,7 +102,7 @@ ADM_register_adhoc_storage(ADM_server_t server, const char* name, } ADM_return_t -ADM_update_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage, +ADM_update_adhoc_storage(ADM_server_t server, ADM_adhoc_storage_t adhoc_storage, ADM_adhoc_context_t ctx) { const admire::server srv{server}; @@ -112,7 +113,8 @@ ADM_update_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage, } ADM_return_t -ADM_remove_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage) { +ADM_remove_adhoc_storage(ADM_server_t server, + ADM_adhoc_storage_t adhoc_storage) { const admire::server srv{server}; @@ -121,7 +123,8 @@ ADM_remove_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage) { } ADM_return_t -ADM_deploy_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage) { +ADM_deploy_adhoc_storage(ADM_server_t server, + ADM_adhoc_storage_t adhoc_storage) { const admire::server srv{server}; @@ -131,7 +134,7 @@ ADM_deploy_adhoc_storage(ADM_server_t server, ADM_storage_t adhoc_storage) { ADM_return_t ADM_register_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, - ADM_storage_t* pfs_storage) { + ADM_pfs_storage_t* pfs_storage) { const admire::server srv{server}; @@ -140,7 +143,7 @@ ADM_register_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, ADM_return_t ADM_update_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, - ADM_storage_t pfs_storage) { + ADM_pfs_storage_t pfs_storage) { const admire::server srv{server}; @@ -148,7 +151,7 @@ ADM_update_pfs_storage(ADM_server_t server, ADM_pfs_context_t ctx, } ADM_return_t -ADM_remove_pfs_storage(ADM_server_t server, ADM_storage_t pfs_storage) { +ADM_remove_pfs_storage(ADM_server_t server, ADM_pfs_storage_t pfs_storage) { const admire::server srv{server}; @@ -189,7 +192,8 @@ ADM_set_dataset_information(ADM_server_t server, ADM_job_t job, } ADM_return_t -ADM_set_io_resources(ADM_server_t server, ADM_job_t job, ADM_storage_t tier, +ADM_set_io_resources(ADM_server_t server, ADM_job_t job, + ADM_adhoc_storage_t tier, ADM_adhoc_resources_t resources) { const admire::server srv{server}; diff --git a/src/lib/detail/impl.cpp b/src/lib/detail/impl.cpp index e2d84d41d55ed3febaa4b2b644536a143be111f3..40f809308332c06a7adc40ba136e3b4abcdddba0 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -330,7 +330,7 @@ register_adhoc_storage(const server& srv, const std::string& name, std::quoted(rpc_client.self_address()), name, type, ctx); const auto rpc_name = name.c_str(); - const auto rpc_type = static_cast(type); + const auto rpc_type = static_cast(type); const auto rpc_ctx = api::convert(ctx); ADM_register_adhoc_storage_in_t in{rpc_name, rpc_type, rpc_ctx.get()}; diff --git a/src/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index 8bc7ef8190466f97f1ce2649eadfdf35aa263572..515caed7dcb14a600f78c23957860a93180d10a2 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -457,16 +457,15 @@ ADM_deploy_adhoc_storage(hg_handle_t h) { am_result.has_value()) { const auto& storage_info = am_result.value(); const auto adhoc_storage = storage_info->adhoc_storage(); - ec = admire::error_code::success; - if(adhoc_storage.type() == admire::storage::type::gekkofs) { - const auto adhoc_ctx = - (admire::adhoc_storage::ctx*) adhoc_storage.context().get(); + + if(adhoc_storage.type() == admire::adhoc_storage::type::gekkofs) { + const auto adhoc_ctx = adhoc_storage.context(); /* Number of nodes */ const std::string nodes = - std::to_string(adhoc_ctx->resources().nodes().size()); + std::to_string(adhoc_ctx.resources().nodes().size()); /* Walltime */ - const std::string walltime = std::to_string(adhoc_ctx->walltime()); + const std::string walltime = std::to_string(adhoc_ctx.walltime()); /* Launch script */ switch(const auto pid = fork()) {