From d9b8e33482637a8a57d28c2ec75613c1614e0908 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Thu, 13 Oct 2022 21:37:57 +0200 Subject: [PATCH 1/3] admire::storage: Rename `user_id` to `name` --- src/common/api/admire_types.h | 4 +-- src/common/api/admire_types.hpp | 20 ++++++------ src/common/api/convert.cpp | 7 ++--- src/common/api/types.cpp | 52 ++++++++++++++++---------------- src/common/net/proto/rpc_types.c | 4 +-- src/common/net/proto/rpc_types.h | 6 ++-- src/lib/admire.cpp | 4 +-- src/lib/admire.h | 4 +-- src/lib/admire.hpp | 2 +- src/lib/c_wrapper.cpp | 4 +-- src/lib/detail/impl.cpp | 12 ++++---- src/lib/detail/impl.hpp | 2 +- src/scord/rpc_handlers.cpp | 10 +++--- 13 files changed, 65 insertions(+), 66 deletions(-) diff --git a/src/common/api/admire_types.h b/src/common/api/admire_types.h index 10e419bd..5a0eaaa9 100644 --- a/src/common/api/admire_types.h +++ b/src/common/api/admire_types.h @@ -412,7 +412,7 @@ 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] ctx Some specific context information for the storage tier or * NULL if none is required. For instance, an adhoc storage system may find it @@ -420,7 +420,7 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list); * @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, 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 9ce2f8aa..18e60d8c 100644 --- a/src/common/api/admire_types.hpp +++ b/src/common/api/admire_types.hpp @@ -247,12 +247,12 @@ struct storage { virtual ~ctx() = default; }; - storage(storage::type type, std::string user_id); + storage(storage::type type, std::string name); virtual ~storage() = default; std::string - user_id() const; + name() const; type type() const; @@ -260,7 +260,7 @@ struct storage { context() const = 0; protected: - std::string m_user_id; + std::string m_name; enum type m_type; }; @@ -317,13 +317,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, 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, ADM_adhoc_context_t ctx); - adhoc_storage(enum storage::type type, std::string user_id, + adhoc_storage(enum storage::type type, std::string name, const admire::adhoc_storage::ctx& ctx); adhoc_storage(const adhoc_storage& other) noexcept; @@ -334,10 +334,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 @@ -657,8 +657,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 2d256784..2eb5198d 100644 --- a/src/common/api/convert.cpp +++ b/src/common/api/convert.cpp @@ -113,12 +113,11 @@ 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()), + st.name().c_str(), static_cast(st.type()), managed_ctx.get()); - if(st.id()) { - c_st->s_server_id = static_cast(st.id().value()); - } + // TODO: remove + c_st->s_server_id = static_cast(st.id()); return managed_ctype{c_st, std::move(managed_ctx)}; } diff --git a/src/common/api/types.cpp b/src/common/api/types.cpp index 39375b36..555f6baa 100644 --- a/src/common/api/types.cpp +++ b/src/common/api/types.cpp @@ -439,7 +439,7 @@ 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, void* ctx) { struct adm_storage* adm_storage = (struct adm_storage*) malloc(sizeof(*adm_storage)); @@ -450,7 +450,7 @@ ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx) { return NULL; } - if(!id) { + if(!name) { LOGGER_ERROR("Null storage id") return NULL; } @@ -460,8 +460,8 @@ 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; @@ -518,8 +518,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,8 +798,8 @@ 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 = ADM_storage_create( + storage->s_name, storage->s_type, storage->s_adhoc_ctx); adm_job_reqs->r_storage->s_server_id = storage->s_server_id; return adm_job_reqs; @@ -1254,12 +1254,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) + : m_name(std::move(name)), m_type(type) {} std::string -storage::user_id() const { - return m_user_id; +storage::name() const { + return m_name; } enum storage::type @@ -1335,12 +1335,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 +1351,30 @@ 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, +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, 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)), + : storage(type, std::move(name)), m_pimpl(std::make_unique(adhoc_storage::ctx{ exec_mode, access_type, res, walltime, should_flush})) {} -adhoc_storage::adhoc_storage(enum storage::type type, std::string user_id, +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, ADM_adhoc_context_t ctx) - : storage(type, std::move(user_id)), + : storage(type, std::move(name)), m_pimpl(std::make_unique(adhoc_storage::ctx{ctx})) {} -adhoc_storage::adhoc_storage(enum storage::type type, std::string user_id, +adhoc_storage::adhoc_storage(enum storage::type type, std::string name, const adhoc_storage::ctx& ctx) - : storage(type, std::move(user_id)), m_pimpl(std::make_unique(ctx)) {} + : storage(type, std::move(name)), 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), m_pimpl(std::make_unique(*other.m_pimpl)) {} adhoc_storage::adhoc_storage(adhoc_storage&&) noexcept = default; @@ -1388,12 +1388,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 +1410,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), m_pimpl(std::make_unique(*other.m_pimpl)) {} pfs_storage& @@ -1493,7 +1493,7 @@ 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); + reqs->r_storage->s_name, reqs->r_storage->s_adhoc_ctx); if(const auto server_id = reqs->r_storage->s_server_id; server_id != -1) { diff --git a/src/common/net/proto/rpc_types.c b/src/common/net/proto/rpc_types.c index 2f837984..fcd12b72 100644 --- a/src/common/net/proto/rpc_types.c +++ b/src/common/net/proto/rpc_types.c @@ -421,7 +421,7 @@ 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; @@ -475,7 +475,7 @@ 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; diff --git a/src/common/net/proto/rpc_types.h b/src/common/net/proto/rpc_types.h index 94ffe7ed..2f2b830b 100644 --- a/src/common/net/proto/rpc_types.h +++ b/src/common/net/proto/rpc_types.h @@ -180,7 +180,7 @@ 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; union { @@ -329,8 +329,8 @@ 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( diff --git a/src/lib/admire.cpp b/src/lib/admire.cpp index a7991fab..e3c5dc88 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 aa52deff..a74337a5 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 d62a9850..a26848b1 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 6ac4a26d..9100970c 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 7e9f7120..6e15a5ee 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); @@ -346,7 +346,7 @@ register_adhoc_storage(const server& srv, const std::string& user_id, } auto rpc_adhoc_storage = - admire::adhoc_storage{admire::storage::type::gekkofs, user_id, ctx}; + admire::adhoc_storage{admire::storage::type::gekkofs, name, ctx}; rpc_adhoc_storage.id() = out.server_id; diff --git a/src/lib/detail/impl.hpp b/src/lib/detail/impl.hpp index 8505b168..4580914f 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 3bbeefaf..b22e68f7 100644 --- a/src/scord/rpc_handlers.cpp +++ b/src/scord/rpc_handlers.cpp @@ -236,23 +236,23 @@ 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.server_id = adhoc_storage.id(); LOGGER_INFO("rpc id: {} name: {} to: {} => " "body: {{retval: {}, server_id: {}}}", -- GitLab From 64ed4cbb5c331770e0cd97ad767d373a55b758fd Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Fri, 14 Oct 2022 10:53:37 +0200 Subject: [PATCH 2/3] ADM_storage_t: Add `id` as an explicit field Similarly for ADM_storage_create(), admire::storage, admire::adhoc_storage, and admire::pfs_storage. Also, rename any references to `server_id` to just `id`. --- src/common/api/admire_types.h | 4 +- src/common/api/admire_types.hpp | 16 +++++--- src/common/api/convert.cpp | 5 +-- src/common/api/types.cpp | 65 +++++++++++++++++--------------- src/common/net/proto/rpc_types.c | 8 ++-- src/common/net/proto/rpc_types.h | 6 +-- src/lib/detail/impl.cpp | 12 +++--- src/scord/rpc_handlers.cpp | 13 +++---- 8 files changed, 67 insertions(+), 62 deletions(-) diff --git a/src/common/api/admire_types.h b/src/common/api/admire_types.h index 5a0eaaa9..37a61db1 100644 --- a/src/common/api/admire_types.h +++ b/src/common/api/admire_types.h @@ -414,13 +414,15 @@ ADM_dataset_list_destroy(ADM_dataset_list_t list); * * @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* name, 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 18e60d8c..3ca979b3 100644 --- a/src/common/api/admire_types.hpp +++ b/src/common/api/admire_types.hpp @@ -247,7 +247,7 @@ struct storage { virtual ~ctx() = default; }; - storage(storage::type type, std::string name); + storage(storage::type type, std::string name, std::uint64_t id); virtual ~storage() = default; @@ -255,6 +255,8 @@ struct storage { name() const; type type() const; + std::uint64_t + id() const; virtual std::shared_ptr context() const = 0; @@ -262,6 +264,7 @@ struct storage { protected: 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 name, + 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 name, + 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, + 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; @@ -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& diff --git a/src/common/api/convert.cpp b/src/common/api/convert.cpp index 2eb5198d..341ccb4f 100644 --- a/src/common/api/convert.cpp +++ b/src/common/api/convert.cpp @@ -114,10 +114,7 @@ convert(const admire::adhoc_storage& st) { st.context())); ADM_storage_t c_st = ADM_storage_create( st.name().c_str(), static_cast(st.type()), - managed_ctx.get()); - - // TODO: remove - c_st->s_server_id = static_cast(st.id()); + 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 555f6baa..644e0673 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* name, 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)); @@ -451,7 +452,7 @@ ADM_storage_create(const char* name, ADM_storage_type_t type, void* ctx) { } if(!name) { - LOGGER_ERROR("Null storage id") + LOGGER_ERROR("Null storage name") return NULL; } @@ -463,7 +464,7 @@ ADM_storage_create(const char* name, ADM_storage_type_t type, void* ctx) { 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: @@ -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_name, 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,8 +1255,8 @@ dataset::id() const { return m_pimpl->id(); } -storage::storage(enum storage::type type, std::string name) - : m_name(std::move(name)), 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::name() const { @@ -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)) {} @@ -1357,24 +1363,27 @@ private: adhoc_storage::adhoc_storage(enum storage::type type, std::string name, - execution_mode exec_mode, access_type access_type, + 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)), - 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 name, - ADM_adhoc_context_t ctx) - : storage(type, std::move(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 name, - const adhoc_storage::ctx& ctx) - : storage(type, std::move(name)), m_pimpl(std::make_unique(ctx)) {} + 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_name), + : 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; @@ -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_name), + : 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_name, 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 fcd12b72..6bcbca11 100644 --- a/src/common/net/proto/rpc_types.c +++ b/src/common/net/proto/rpc_types.c @@ -427,8 +427,8 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { 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; @@ -481,8 +481,8 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) { 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 2f2b830b..4caa3fc8 100644 --- a/src/common/net/proto/rpc_types.h +++ b/src/common/net/proto/rpc_types.h @@ -182,7 +182,7 @@ MERCURY_GEN_STRUCT_PROC( typedef struct adm_storage { 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; @@ -336,8 +336,8 @@ MERCURY_GEN_PROC( 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/detail/impl.cpp b/src/lib/detail/impl.cpp index 6e15a5ee..96a637f3 100644 --- a/src/lib/detail/impl.cpp +++ b/src/lib/detail/impl.cpp @@ -345,16 +345,14 @@ register_adhoc_storage(const server& srv, const std::string& name, return tl::make_unexpected(retval); } - auto rpc_adhoc_storage = - admire::adhoc_storage{admire::storage::type::gekkofs, name, 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/scord/rpc_handlers.cpp b/src/scord/rpc_handlers.cpp index b22e68f7..1a672de9 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); } }; @@ -252,12 +251,12 @@ ADM_register_adhoc_storage(hg_handle_t h) { 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); -- GitLab From 13c5f9cbcef6eca0d4cf7ee31032bf25bd39c9da Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Fri, 14 Oct 2022 11:00:41 +0200 Subject: [PATCH 3/3] examples: Update with new API changes --- examples/c/ADM_cancel_transfer.c | 4 ++-- examples/c/ADM_connect_data_operation.c | 4 ++-- examples/c/ADM_define_data_operation.c | 4 ++-- examples/c/ADM_deploy_adhoc_storage.c | 4 ++-- examples/c/ADM_finalize_data_operation.c | 4 ++-- examples/c/ADM_get_pending_transfers.c | 4 ++-- examples/c/ADM_get_qos_constraints.c | 4 ++-- examples/c/ADM_get_statistics.c | 4 ++-- examples/c/ADM_get_transfer_priority.c | 4 ++-- examples/c/ADM_link_transfer_to_data_operation.c | 4 ++-- examples/c/ADM_register_adhoc_storage.c | 4 ++-- examples/c/ADM_register_job.c | 4 ++-- examples/c/ADM_remove_adhoc_storage.c | 4 ++-- examples/c/ADM_remove_job.c | 4 ++-- examples/c/ADM_set_dataset_information.c | 4 ++-- examples/c/ADM_set_io_resources.c | 4 ++-- examples/c/ADM_set_qos_constraints.c | 4 ++-- examples/c/ADM_set_transfer_priority.c | 4 ++-- examples/c/ADM_transfer_datasets.c | 4 ++-- examples/c/ADM_update_adhoc_storage.c | 4 ++-- examples/c/ADM_update_job.c | 4 ++-- examples/cxx/ADM_register_adhoc_storage.cpp | 6 +++--- examples/cxx/ADM_register_job.cpp | 6 +++--- examples/cxx/ADM_transfer_datasets.cpp | 6 +++--- examples/cxx/ADM_update_job.cpp | 14 ++++++-------- 25 files changed, 57 insertions(+), 59 deletions(-) diff --git a/examples/c/ADM_cancel_transfer.c b/examples/c/ADM_cancel_transfer.c index 193279f8..26dc84d5 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 cf205bdf..aeb19788 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 894f0593..d4514293 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 d5533ddf..52b37bee 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 226ddb03..d84fdeaf 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 90329761..907a1778 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 339afe5d..93ec70aa 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 0d9a5603..080dedb7 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 7c33200e..211c693a 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 c333e7e3..18a353bc 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 0302f307..144f0a71 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 8e7c7c1b..75a8fd4a 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 f8b5eaba..f35f6acc 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 73dedbe4..299c85d5 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 5e342f72..fa4a1042 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 eabe6fa9..0be040a1 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 6353f92e..aa665752 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 018b2943..22067d1f 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 bd918ec2..9af25809 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 7080e772..ee3b96d7 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 35deba4b..639727bd 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 8a74085a..3029d619 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 9eda2df1..d757c39e 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 381b0777..ff19f803 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 84b92008..7df3a8c4 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}; -- GitLab