Verified Commit 9d032dbb authored by ANA MANZANO RODRIGUEZ's avatar ANA MANZANO RODRIGUEZ Committed by Alberto Miranda
Browse files

type files updated

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

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

    virtual ~storage() = default;

@@ -245,12 +245,14 @@ struct storage {
    type
    type() const;


    virtual std::shared_ptr<ctx>
    context() const = 0;

protected:
    std::string m_id;
    enum type m_type;
    std::uint64_t m_server_id;
};

struct adhoc_storage : public storage {
@@ -294,18 +296,18 @@ struct adhoc_storage : public storage {
        bool m_should_flush;
    };
    
    adhoc_storage(enum storage::type type, std::string id,
    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);
    adhoc_storage(enum storage::type type, std::string id,
    adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_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,
                  ADM_adhoc_context_t ctx);
    adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_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);
    adhoc_storage(enum storage::type type, std::string id,
    /*adhoc_storage(enum storage::type type, std::string id, std::uint64_t server_id,
                  const admire::adhoc_storage::ctx& ctx);*/
                  
    adhoc_storage(adhoc_storage&&) noexcept = default;
@@ -342,9 +344,9 @@ 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 id, std::uint64_t server_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 id, 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&
+39 −22
Original line number Diff line number Diff line
@@ -1059,8 +1059,9 @@ dataset::id() const {
}


storage::storage(enum storage::type type, std::string id)
    : m_id(std::move(id)), m_type(type) {}
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 {
@@ -1072,6 +1073,7 @@ storage::type() const {
    return m_type;
}


adhoc_storage::ctx::ctx(adhoc_storage::execution_mode exec_mode,
                        adhoc_storage::access_type access_type,
                        std::uint32_t nodes, std::uint32_t walltime,
@@ -1112,12 +1114,14 @@ adhoc_storage::ctx::should_flush() const {

class adhoc_storage::impl {

    static std::uint64_t generate_id() {
    static std::uint64_t
    generate_id() {
        return 42;
    }

public:
    explicit impl(adhoc_storage::ctx ctx) : m_id(generate_id()), m_ctx(std::move(ctx)) {}
    explicit impl(adhoc_storage::ctx ctx)
        : m_id(generate_id()), m_ctx(std::move(ctx)) {}
    impl(const impl& rhs) = default;
    impl(impl&& rhs) = default;
    impl&
@@ -1125,7 +1129,10 @@ public:
    impl&
    operator=(impl&&) noexcept = default;

    std::uint64_t id() const { return m_id; }
    std::uint64_t
    id() const {
        return m_id;
    }

    adhoc_storage::ctx
    context() const {
@@ -1139,20 +1146,33 @@ private:


adhoc_storage::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)
    : storage(type, std::move(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),
      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,
                             ADM_adhoc_context_t ctx)
    : storage(type, std::move(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})) {}

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

adhoc_storage::adhoc_storage(enum storage::type type, std::string id,
                             std::uint64_t server_id,
                             const adhoc_storage::ctx& ctx)
    : 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),
    : storage(other.m_type, other.m_id, other.m_server_id),
      m_pimpl(std::make_unique<impl>(*other.m_pimpl)) {}

adhoc_storage&
@@ -1161,10 +1181,6 @@ adhoc_storage::operator=(const adhoc_storage& other) noexcept {
    return *this;
}

/*adhoc_storage::adhoc_storage(enum storage::type type, std::string id, const adhoc_storage::ctx& ctx)
    : storage(type, std::move(id)),
      m_pimpl(std::make_unique<impl>(ctx)) {}*/

std::uint64_t
adhoc_storage::id() const {
    return m_pimpl->id();
@@ -1184,7 +1200,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),
    : storage(other.m_type, other.m_id, other.m_server_id),
      m_pimpl(std::make_unique<impl>(*other.m_pimpl)) {}

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

pfs_storage::pfs_storage(enum storage::type type, std::string 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)),
    : 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,
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)),
    : storage(type, std::move(id), server_id),
      m_pimpl(std::make_unique<impl>(pfs_storage::ctx{ctx})) {}

pfs_storage::~pfs_storage() = default;
@@ -1274,6 +1290,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_adhoc_ctx);
                    break;
                case ADM_STORAGE_LUSTRE:
@@ -1281,7 +1298,7 @@ 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_pfs_ctx);
                            reqs->r_storage->s_id, reqs->r_storage->s_server_id, reqs->r_storage->s_pfs_ctx);
                    break;
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ MERCURY_GEN_STRUCT_PROC(
typedef struct adm_storage {
    const char* s_id;
    ADM_storage_type_t s_type;
    uint64_t s_server_id; 
    union {
        ADM_adhoc_context_t s_adhoc_ctx;
        ADM_pfs_context_t s_pfs_ctx;
@@ -298,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))((ADM_storage_t)(adhoc_storage)));
MERCURY_GEN_PROC(ADM_register_adhoc_storage_out_t, ((int32_t) (retval)));

/// ADM_update_adhoc_storage
MERCURY_GEN_PROC(ADM_update_adhoc_storage_in_t, ((int32_t) (reqs)))