opal/mca/dstore/zht/dstore_zht.c
/* insert a (key, value) record to ZHT server */
insert a (key, value) record to ZHT server
insert a ( key value ) record to ZHT server
static int store(struct opal_dstore_base_module_t *imod,
                 const opal_process_name_t *proc,
                 opal_value_t *val)
{
    int rc;
    opal_output_verbose(1, opal_dstore_base_framework.framework_output,
                "%s dstore:zht:kvs storing data for proc %s",
                OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), OPAL_NAME_PRINT(*proc));
    if (NULL == val) {
        opal_output_verbose(1, opal_dstore_base_framework.framework_output,
                "%s dstore:zht:kvs storing empty record for proc %s",
                OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), OPAL_NAME_PRINT(*proc));
        return OPAL_ERROR;
    }
    if (NULL == val->key) {
        opal_output_verbose(1, opal_dstore_base_framework.framework_output,
                "%s dstore:zht:kvs storing record with empty key for proc %s",
                OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), OPAL_NAME_PRINT(*proc));
        return OPAL_ERROR;
    }
    opal_buffer_t *buffer = OBJ_NEW(opal_buffer_t);
    char *str_val;
    if (NULL == (str_val = pack_kvs(buffer, val))) {
        OBJ_RELEASE(buffer);
        return OPAL_ERROR;
    }
    rc = c_zht_insert(val->key, str_val);
    OBJ_RELEASE(buffer);
    free(str_val);
    str_val = NULL;
    if (0 != rc) {
        return OPAL_ERROR;
    }
    return OPAL_SUCCESS;
}
static int store ( struct opal_dstore_base_module_t * imod , const opal_process_name_t * proc , opal_value_t * val ) { int rc ; opal_output_verbose ( 1 , opal_dstore_base_framework . framework_output , " " , OPAL_NAME_PRINT ( OPAL_PROC_MY_NAME ) , OPAL_NAME_PRINT ( * proc ) ) ; if ( NULL == val ) { opal_output_verbose ( 1 , opal_dstore_base_framework . framework_output , " " , OPAL_NAME_PRINT ( OPAL_PROC_MY_NAME ) , OPAL_NAME_PRINT ( * proc ) ) ; return OPAL_ERROR ; } if ( NULL == val -> key ) { opal_output_verbose ( 1 , opal_dstore_base_framework . framework_output , " " , OPAL_NAME_PRINT ( OPAL_PROC_MY_NAME ) , OPAL_NAME_PRINT ( * proc ) ) ; return OPAL_ERROR ; } opal_buffer_t * buffer = OBJ_NEW ( opal_buffer_t ) ; char * str_val ; if ( NULL == ( str_val = pack_kvs ( buffer , val ) ) ) { OBJ_RELEASE ( buffer ) ; return OPAL_ERROR ; } rc = c_zht_insert ( val -> key , str_val ) ; OBJ_RELEASE ( buffer ) ; free ( str_val ) ; str_val = NULL ; if ( 0 != rc ) { return OPAL_ERROR ; } return OPAL_SUCCESS ; }
insert a (key, value) record to ZHT server
insert a ( key value ) record to ZHT server