Verified Commit c59bd35c authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

adm_storage: add missing server_id field and update

hg_proc_ADM_storage_t: encode/decode server_id
parent 7b72f113
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -463,6 +463,7 @@ ADM_storage_create(const char* id, ADM_storage_type_t type, void* ctx) {
    adm_storage->s_id = (const char*) calloc(strlen(id) + 1, sizeof(char));
    strcpy((char*) adm_storage->s_id, id);
    adm_storage->s_type = type;
    adm_storage->s_server_id = -1;

    switch(adm_storage->s_type) {
        case ADM_STORAGE_GEKKOFS:
@@ -799,6 +800,7 @@ ADM_job_requirements_create(ADM_dataset_t inputs[], size_t inputs_len,

    adm_job_reqs->r_storage = ADM_storage_create(storage->s_id, storage->s_type,
                                                 storage->s_adhoc_ctx);
    adm_job_reqs->r_storage->s_server_id = storage->s_server_id;

    return adm_job_reqs;

@@ -1488,9 +1490,15 @@ public:
        }

        if(reqs->r_storage) {
            // TODO add a conversion constructor
            m_adhoc_storage = admire::adhoc_storage(
                    static_cast<enum storage::type>(reqs->r_storage->s_type),
                    reqs->r_storage->s_id, reqs->r_storage->s_adhoc_ctx);

            if(const auto server_id = reqs->r_storage->s_server_id;
               server_id != -1) {
                m_adhoc_storage->id() = server_id;
            }
        }
    }

+16 −2
Original line number Diff line number Diff line
@@ -427,7 +427,14 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) {
                break;
            }

            // 3. the appropriate storage context
            // 3. the server_id
            ret = hg_proc_hg_int64_t(proc, &tmp->s_server_id);

            if(ret != HG_SUCCESS) {
                break;
            }

            // 4. the appropriate storage context
            switch(tmp->s_type) {
                case ADM_STORAGE_GEKKOFS:
                case ADM_STORAGE_DATACLAY:
@@ -474,7 +481,14 @@ hg_proc_ADM_storage_t(hg_proc_t proc, void* data) {
                break;
            }

            // 3. the appropriate storage context
            // 3. the server_id
            ret = hg_proc_hg_int64_t(proc, &tmp->s_server_id);

            if(ret != HG_SUCCESS) {
                break;
            }

            // 4. the appropriate storage context
            switch(tmp->s_type) {
                case ADM_STORAGE_GEKKOFS:
                case ADM_STORAGE_DATACLAY:
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ MERCURY_GEN_STRUCT_PROC(
typedef struct adm_storage {
    const char* s_id;
    ADM_storage_type_t s_type;
    uint64_t s_server_id;
    int64_t s_server_id;
    union {
        ADM_adhoc_context_t s_adhoc_ctx;
        ADM_pfs_context_t s_pfs_ctx;