Verified Commit 73cdd8c2 authored by ANA MANZANO RODRIGUEZ's avatar ANA MANZANO RODRIGUEZ Committed by Alberto Miranda
Browse files

types updated, declaration of server_id removed

parent c2ee36c1
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ struct storage {
        virtual ~ctx() = default;
    };

    storage(storage::type type, std::string id, std::uint64_t server_id);
    storage(storage::type type, std::string id);//std::uint64_t server_id);

    virtual ~storage() = default;

@@ -252,7 +252,7 @@ struct storage {
protected:
    std::string m_id;
    enum type m_type;
    std::uint64_t m_server_id;
    //std::uint64_t m_server_id;
};

struct adhoc_storage : public storage {
@@ -296,14 +296,14 @@ struct adhoc_storage : public storage {
        bool m_should_flush;
    };
    
    adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_id,
    adhoc_storage(enum storage::type type, std::string id, 
                  execution_mode exec_mode, access_type access_type,
                  std::uint32_t nodes, std::uint32_t walltime,
                  bool should_flush);
    adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_id,
    adhoc_storage(enum storage::type type, std::string id, 
                  ADM_adhoc_context_t ctx);
    adhoc_storage(const adhoc_storage& other) noexcept;
    adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_id,
    adhoc_storage(enum storage::type type, std::string id,
                  const admire::adhoc_storage::ctx& ctx);
    //adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_id,
                  //ADM_adhoc_context_t ctx);
@@ -344,9 +344,9 @@ struct pfs_storage : public storage {
        std::filesystem::path m_mount_point;
    };

    pfs_storage(enum storage::type type, std::string id, std::uint64_t server_id,
    pfs_storage(enum storage::type type, std::string id, //std::uint64_t server_id,
                std::filesystem::path mount_point);
    pfs_storage(enum storage::type type, std::string id, std::uint64_t server_id, ADM_pfs_context_t ctx);
    pfs_storage(enum storage::type type, std::string id, ADM_pfs_context_t ctx); //std::uint64_t server_id, ADM_pfs_context_t ctx);
    pfs_storage(const pfs_storage& other) noexcept;
    pfs_storage(pfs_storage&&) noexcept = default;
    pfs_storage&
+25 −21
Original line number Diff line number Diff line
@@ -1059,9 +1059,9 @@ dataset::id() const {
}


storage::storage(enum storage::type type, std::string id,
                 std::uint64_t server_id)
    : m_id(std::move(id)), m_type(type), m_server_id(server_id) {}
storage::storage(enum storage::type type, std::string id)
                 //std::uint64_t server_id)
    : m_id(std::move(id)), m_type(type) {}//, m_server_id(server_id) {}

std::string
storage::id() const {
@@ -1114,13 +1114,15 @@ adhoc_storage::ctx::should_flush() const {

class adhoc_storage::impl {

    
    static std::uint64_t
    generate_id() {
        return 42;
        static std::atomic_uint64_t s_current_server_id = 0;
        return s_current_server_id++;
    }

public:
    explicit impl(adhoc_storage::ctx ctx)
    explicit impl(adhoc_storage::ctx ctx) //, std::uint64_t counter)
        : m_id(generate_id()), m_ctx(std::move(ctx)) {}
    impl(const impl& rhs) = default;
    impl(impl&& rhs) = default;
@@ -1145,17 +1147,17 @@ private:
};


adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
                             std::uint64_t server_id, execution_mode exec_mode,
adhoc_storage::adhoc_storage(enum storage::type type, std::string id, //std::uint64_t server_id,
                             execution_mode exec_mode,
                             access_type access_type, std::uint32_t nodes,
                             std::uint32_t walltime, bool should_flush)
    : storage(type, std::move(id), server_id),
    : storage(type, std::move(id)),//, server_id),
      m_pimpl(std::make_unique<impl>(adhoc_storage::ctx{
              exec_mode, access_type, nodes, walltime, should_flush})) {}

adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
                             std::uint64_t server_id, ADM_adhoc_context_t ctx)
    : storage(type, std::move(id), server_id),
adhoc_storage::adhoc_storage(enum storage::type type, std::string id, //std::uint64_t server_id,
                             ADM_adhoc_context_t ctx)
    : storage(type, std::move(id)), //, server_id),
      m_pimpl(std::make_unique<impl>(adhoc_storage::ctx{ctx})) {}

/*
@@ -1166,13 +1168,13 @@ adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
      m_pimpl(std::make_unique<impl>(ctx)) {}*/

adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
                             std::uint64_t server_id,
                             //std::uint64_t server_id,
                             const adhoc_storage::ctx& ctx)
    : storage(type, std::move(id), server_id),
    : storage(type, std::move(id)),//, server_id),
      m_pimpl(std::make_unique<impl>(ctx)) {} // este es el nuevo añadido

adhoc_storage::adhoc_storage(const adhoc_storage& other) noexcept
    : storage(other.m_type, other.m_id, other.m_server_id),
    : storage(other.m_type, other.m_id), //other.m_server_id),
      m_pimpl(std::make_unique<impl>(*other.m_pimpl)) {}

adhoc_storage&
@@ -1200,7 +1202,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_id, other.m_server_id),
    : storage(other.m_type, other.m_id), //other.m_server_id),
      m_pimpl(std::make_unique<impl>(*other.m_pimpl)) {}

pfs_storage&
@@ -1234,15 +1236,15 @@ private:
    pfs_storage::ctx m_ctx;
};

pfs_storage::pfs_storage(enum storage::type type, std::string id, std::uint64_t server_id,
pfs_storage::pfs_storage(enum storage::type type, std::string id, //std::uint64_t server_id,
                         std::filesystem::path mount_point)
    : storage(type, std::move(id), server_id),
    : storage(type, std::move(id)), //server_id),
      m_pimpl(std::make_unique<impl>(
              pfs_storage::ctx{std::move(mount_point)})) {}

pfs_storage::pfs_storage(enum storage::type type, std::string id, std::uint64_t server_id,
pfs_storage::pfs_storage(enum storage::type type, std::string id, //std::uint64_t server_id,
                         ADM_pfs_context_t ctx)
    : storage(type, std::move(id), server_id),
    : storage(type, std::move(id)), //server_id),
      m_pimpl(std::make_unique<impl>(pfs_storage::ctx{ctx})) {}

pfs_storage::~pfs_storage() = default;
@@ -1290,7 +1292,7 @@ public:
                            static_cast<enum storage::type>(
                                    reqs->r_storage->s_type),
                            reqs->r_storage->s_id,
                            reqs->r_storage->s_server_id,
                            //reqs->r_storage->s_server_id,
                            reqs->r_storage->s_adhoc_ctx);
                    break;
                case ADM_STORAGE_LUSTRE:
@@ -1298,7 +1300,9 @@ public:
                    m_storage = std::make_unique<pfs_storage>(
                            static_cast<enum storage::type>(
                                    reqs->r_storage->s_type),
                            reqs->r_storage->s_id, reqs->r_storage->s_server_id, reqs->r_storage->s_pfs_ctx);
                            reqs->r_storage->s_id, 
                            //reqs->r_storage->s_server_id, 
                            reqs->r_storage->s_pfs_ctx);
                    break;
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ MERCURY_GEN_PROC(
/// ADM_register_adhoc_storage
MERCURY_GEN_PROC(ADM_register_adhoc_storage_in_t, ((ADM_job_t) (job))((hg_const_string_t) (id))((ADM_adhoc_context_t)(ctx)));

MERCURY_GEN_PROC(ADM_register_adhoc_storage_out_t, ((int32_t) (retval)));
MERCURY_GEN_PROC(ADM_register_adhoc_storage_out_t, ((int32_t) (retval)) ((uint64_t)(server_id)));

/// ADM_update_adhoc_storage
MERCURY_GEN_PROC(ADM_update_adhoc_storage_in_t, ((int32_t) (reqs)))
+1 −1
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ register_adhoc_storage(const server& srv, const job& job, const std::string& id,
        return tl::make_unexpected(static_cast<admire::error_code>(out.retval));
    }

    const auto rpc_adhoc_storage = admire::adhoc_storage{admire::storage::type::gekkofs, id, 64, ctx};
    const auto rpc_adhoc_storage = admire::adhoc_storage{admire::storage::type::gekkofs, id, ctx};

    LOGGER_INFO("RPC (ADM_{}) <= {{retval: {}}}", __FUNCTION__, ADM_SUCCESS);

+3 −2
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@ ADM_register_adhoc_storage(hg_handle_t h) {
    LOGGER_INFO("RPC ID {} ({}) <= {{job: {{{}}}}}", rpc_id, __FUNCTION__, job);

    const auto adhoc_storage = admire::adhoc_storage(
            admire::adhoc_storage::type::gekkofs, id, 64, ctx); //ctx.get()
            admire::adhoc_storage::type::gekkofs, id, ctx); //ctx.get()

    
    uint64_t server_id = adhoc_storage.id();
@@ -243,12 +243,13 @@ ADM_register_adhoc_storage(hg_handle_t h) {
    admire::error_code rv = ADM_SUCCESS;

    out.retval = rv;
    out.server_id = adhoc_storage.id();
    /*
    out.adhoc_storage = admire::api::convert(adhoc_storage).get();

    LOGGER_INFO("RPC ID {} ({}) => {{retval: {}, adhoc_storage: {{{}}}}}", rpc_id,
                __FUNCTION__, rv, adhoc_storage); */
    LOGGER_INFO("RPC ID {} ({}) => {{retval: {}}}", rpc_id,
    LOGGER_INFO("RPC ID {} ({}) => {{retval: {}, server_id: {}}}", rpc_id, out.server_id,
                __FUNCTION__, rv);

    ret = margo_respond(h, &out);