int orte_sstore_central_app_set_attr(orte_sstore_base_handle_t handle, orte_sstore_base_key_t key, char *value) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_app_snapshot_info_t *handle_info = NULL; char *key_str = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(app): set_attr(%d = %s)", key, value)); if( NULL == value ) { ORTE_ERROR_LOG(ORTE_ERROR); exit_status = ORTE_ERROR; goto cleanup; } if( key >= SSTORE_METADATA_MAX ) { ORTE_ERROR_LOG(ORTE_ERROR); exit_status = ORTE_ERROR; goto cleanup; } /* * Lookup the handle */ handle_info = find_handle_info(handle); /* * Access metadata */ if( SSTORE_METADATA_LOCAL_CRS_COMP == key ) { if( NULL != handle_info->crs_comp ) { free(handle_info->crs_comp); } handle_info->crs_comp = strdup(value); } else if(SSTORE_METADATA_LOCAL_SKIP_CKPT == key ) { handle_info->ckpt_skipped = true; } else if( SSTORE_METADATA_LOCAL_MKDIR == key || SSTORE_METADATA_LOCAL_TOUCH == key ) { orte_sstore_base_convert_key_to_string(key, &key_str); if( ORTE_SUCCESS != (ret = metadata_write_str(handle_info, key_str, value))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } else { exit_status = ORTE_ERROR; goto cleanup; } cleanup: if( NULL != key_str ) { free(key_str); key_str = NULL; } return exit_status; }
int orte_sstore_central_global_register(orte_sstore_base_handle_t handle) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_global_snapshot_info_t *handle_info = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(global): register(%d) - Global", handle)); /* * Lookup the handle */ handle_info = find_handle_info(handle); if( SSTORE_GLOBAL_REG != handle_info->state ) { handle_info->state = SSTORE_GLOBAL_REG; } else { return orte_sstore_central_local_register(handle); } orte_sstore_handle_current = handle; /* * Associate the metadata */ if( handle_info->migrating ) { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_INTERNAL_MIG_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } else { if( ORTE_SUCCESS != (ret = metadata_write_int(handle_info, SSTORE_METADATA_GLOBAL_SNAP_SEQ_STR, handle_info->seq_num)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } if( ORTE_SUCCESS != (ret = metadata_write_str(handle_info, SSTORE_METADATA_LOCAL_SNAP_REF_FMT_STR, orte_sstore_base_local_snapshot_fmt)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_write_timestamp(handle_info)) ) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } cleanup: return exit_status; }
int orte_sstore_central_global_set_attr(orte_sstore_base_handle_t handle, orte_sstore_base_key_t key, char *value) { int ret, exit_status = ORTE_SUCCESS; orte_sstore_central_global_snapshot_info_t *handle_info = NULL; char *key_str = NULL; OPAL_OUTPUT_VERBOSE((10, mca_sstore_central_component.super.output_handle, "sstore:central:(global): set_attr()")); /* * Lookup the handle */ handle_info = find_handle_info(handle); /* * Process key (Access metadata) */ if( key == SSTORE_METADATA_GLOBAL_MIGRATING ) { handle_info->migrating = true; } else { orte_sstore_base_convert_key_to_string(key, &key_str); if( NULL == key_str ) { ORTE_ERROR_LOG(ORTE_ERROR); exit_status = ORTE_ERROR; goto cleanup; } if( ORTE_SUCCESS != (ret = metadata_write_str(handle_info, key_str, value))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } } cleanup: if( NULL != key_str ) { free(key_str); key_str = NULL; } return exit_status; }
static int process_local_push(orte_process_name_t* peer, opal_buffer_t* buffer, orte_sstore_central_global_snapshot_info_t *handle_info) { int ret, exit_status = ORTE_SUCCESS; orte_std_cntr_t count; size_t num_entries, i; orte_process_name_t name; bool ckpt_skipped = false; char * crs_comp = NULL; char * proc_name = NULL; /* * Unpack the data */ count = 1; if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &num_entries, &count, OPAL_SIZE))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } for(i = 0; i < num_entries; ++i ) { count = 1; if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &name, &count, ORTE_NAME))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } count = 1; if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &ckpt_skipped, &count, OPAL_BOOL))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } if( !ckpt_skipped ) { count = 1; if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &crs_comp, &count, OPAL_STRING))) { ORTE_ERROR_LOG(ret); exit_status = ret; goto cleanup; } /* * Write this information to the global metadata */ orte_util_convert_process_name_to_string(&proc_name, &name); metadata_write_str(handle_info, SSTORE_METADATA_INTERNAL_PROCESS_STR, proc_name); metadata_write_str(handle_info, SSTORE_METADATA_LOCAL_CRS_COMP_STR, crs_comp); } if( NULL != crs_comp ) { free(crs_comp); crs_comp = NULL; } if( NULL != proc_name ) { free(proc_name); proc_name = NULL; } (handle_info->num_procs_synced)++; } cleanup: if( NULL != crs_comp ) { free(crs_comp); crs_comp = NULL; } if( NULL != proc_name ) { free(proc_name); proc_name = NULL; } return exit_status; }