diff options
-rw-r--r-- | src/H5VLiod.c | 38 | ||||
-rw-r--r-- | src/H5VLiod_client.c | 58 | ||||
-rw-r--r-- | src/H5VLiod_client.h | 9 | ||||
-rw-r--r-- | src/H5X.c | 10 |
4 files changed, 77 insertions, 38 deletions
diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 5649e4e..af6c684 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -3123,7 +3123,7 @@ H5VL_iod_dataset_open(void *_obj, H5VL_loc_params_t UNUSED loc_params, const cha #ifdef H5_HAVE_INDEXING /* TODO create a new req here */ if (FAIL == H5VL_iod_dataset_get_index_info(dset, &dset->idx_plugin_id, - &dset->metadata_size, &dset->metadata, req)) + &dset->metadata_size, &dset->metadata, rcxt_id, req)) HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index info for dataset"); #endif @@ -10259,6 +10259,32 @@ done: } /* end H5VL_iod_dataset_get_index() */ /*------------------------------------------------------------------------- + * Function: H5VL_iod_dataset_set_index_plugin_id + * + * Purpose: Set a new index plugin ID to a dataset. + * + * Return: Success: SUCCEED + * Failure: FAIL + *------------------------------------------------------------------------- + */ +herr_t +H5VL_iod_dataset_set_index_plugin_id(void *dset, unsigned plugin_id) +{ + H5VL_iod_dset_t *iod_dset = (H5VL_iod_dset_t *) dset; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(dset); + + iod_dset->idx_plugin_id = plugin_id; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_dataset_set_index_plugin_id() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_iod_dataset_get_index_plugin_id * * Purpose: Get the index plugin id associated to a dataset. @@ -10413,16 +10439,14 @@ H5VL_iod_dataset_get_index_info(void *_dset, unsigned *plugin_id, size_t *metada if (NULL == (info = (H5VL_iod_dataset_get_index_info_t *) H5MM_calloc(sizeof(H5VL_iod_dataset_get_index_info_t)))) HGOTO_ERROR(H5E_INDEX, H5E_NOSPACE, FAIL, "can't allocate info"); - info->idx_handle = dset->idx_handle; - info->idx_plugin_id = dset->idx_plugin_id; - info->metadata = metadata; + info->plugin_id = plugin_id; info->metadata_size = metadata_size; - info->dset = dset; + info->metadata = metadata; info->output = output; if(H5VL__iod_create_and_forward(H5VL_DSET_GET_INDEX_INFO_ID, HG_DSET_GET_INDEX_INFO, (H5VL_iod_object_t *)dset, 0, num_parents, parent_reqs, - (H5VL_iod_req_info_t *)tr, &input, output, info, req) < 0) + (H5VL_iod_req_info_t *)rc, &input, output, info, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to create and ship get index info"); done: @@ -10443,7 +10467,7 @@ H5VL_iod_dataset_remove_index_info(void *_dset, hid_t trans_id, void **req) { H5VL_iod_request_t **parent_reqs = NULL; H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *) _dset; - dset_get_index_info_in_t input; + dset_rm_index_info_in_t input; H5TR_t *tr = NULL; size_t num_parents = 0; int *status = NULL; diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index cd4714f..e78b295 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -1652,51 +1652,69 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) break; } #ifdef H5_HAVE_INDEXING + case HG_DSET_SET_INDEX_INFO: + { + req->data = NULL; + H5VL_iod_request_delete(file, req); + break; + } case HG_DSET_GET_INDEX_INFO: { H5VL_iod_dataset_get_index_info_t *index_info = (H5VL_iod_dataset_get_index_info_t *)req->data; + unsigned plugin_id = index_info->output->idx_plugin_id; - if(!index_info->idx_plugin_id) { + if(!plugin_id) { HERROR(H5E_INDEX, H5E_BADVALUE, "invalid index plugin ID\n"); req->status = H5ES_STATUS_FAIL; req->state = H5VL_IOD_COMPLETED; } else { - H5X_class_t *idx_class = NULL; - H5P_genplist_t *xxpl_plist; /* Property list pointer */ - unsigned plugin_id = index_info->idx_plugin_id; - void *dset = index_info->dset; - hid_t xapl_id = H5P_INDEX_ACCESS_DEFAULT; + size_t metadata_size = index_info->output->idx_metadata.buf_size; + void *metadata = index_info->output->idx_metadata.buf; + void *new_metadata; + + if (!metadata_size) + HGOTO_ERROR(H5E_INDEX, H5E_BADVALUE, FAIL, "invalid metadata size"); + + if (NULL == (new_metadata = H5MM_calloc(metadata_size))) + HGOTO_ERROR(H5E_INDEX, H5E_NOSPACE, FAIL, "can't allocate metadata"); + if (FAIL == HDmemcpy(new_metadata, metadata, metadata_size)) + HGOTO_ERROR(H5E_INDEX, H5E_CANTCOPY, FAIL, "can't copy metadata"); + + *index_info->plugin_id = plugin_id; + *index_info->metadata_size = metadata_size; + *index_info->metadata = new_metadata; + + // H5X_class_t *idx_class = NULL; + // H5P_genplist_t *xxpl_plist; /* Property list pointer */ + + // hid_t xapl_id = H5P_INDEX_ACCESS_DEFAULT; /* store the transaction ID in the xxpl */ - if(NULL == (xxpl_plist = (H5P_genplist_t *)H5I_object(xapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_set(xxpl_plist, H5VL_TRANS_ID, &index_info->trans_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for trans_id") +// if(NULL == (xxpl_plist = (H5P_genplist_t *)H5I_object(xapl_id))) +// HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") +// if(H5P_set(xxpl_plist, H5VL_CONTEXT_ID, &index_info->rcxt_id) < 0) +// HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for trans_id"); - if (!(plugin_id = H5VL_iod_dataset_set_index_plugin_id(dset))) - HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "can't set index plugin ID for dataset"); - if (NULL == (idx_class = H5X_registered(plugin_id))) - HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index plugin class"); +// if (NULL == (idx_class = H5X_registered(plugin_id))) +// HGOTO_ERROR(H5E_INDEX, H5E_CANTGET, FAIL, "can't get index plugin class"); /* TODO registered tmp IDs for file and dset ?? */ - if (FAIL == idx_class->open(file_id, dataset_id, xapl_id, - metadata_size, metadata)) - HGOTO_ERROR(H5E_INDEX, H5E_CANTOPENOBJ, FAIL, "indexing open callback failed"); +// if (NULL == (idx_handle = idx_class->open(file_id, dataset_id, xapl_id, +// metadata_size, metadata))) +// HGOTO_ERROR(H5E_INDEX, H5E_CANTOPENOBJ, FAIL, "indexing open callback failed"); } req->data = NULL; H5VL_iod_request_delete(file, req); break; } - case HG_DSET_SET_INDEX_INFO: + case HG_DSET_RM_INDEX_INFO: { req->data = NULL; H5VL_iod_request_delete(file, req); break; } - case HG_DSET_RM_INDEX_INFO: - break; #endif case HG_LINK_ITERATE: case HG_OBJECT_VISIT: diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 801da12..6c179c1 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -393,10 +393,10 @@ typedef struct H5VL_iod_exists_info_t { #ifdef H5_HAVE_INDEXING /* information about a dataset write request */ typedef struct H5VL_iod_dataset_get_index_info_t { - void *idx_handle; - unsigned idx_plugin_id; - void *dset; - hid_t trans_id; + unsigned *plugin_id; + size_t *metadata_size; + void **metadata; + dset_get_index_info_out_t *output; } H5VL_iod_dataset_get_index_info_t; #endif @@ -496,6 +496,7 @@ H5_DLL herr_t H5VL_iod_analysis_execute(const char *file_name, const char *obj_n /* private routines for X */ H5_DLL herr_t H5VL_iod_dataset_set_index(void *dset, void *idx_handle); H5_DLL void *H5VL_iod_dataset_get_index(void *dset); +H5_DLL herr_t H5VL_iod_dataset_set_index_plugin_id(void *dset, unsigned plugin_id); H5_DLL unsigned H5VL_iod_dataset_get_index_plugin_id(void *dset); H5_DLL herr_t H5VL_iod_dataset_set_index_info(void *dset, unsigned plugin_id, size_t metadata_size, void *metadata, hid_t trans_id, void **req); @@ -588,11 +588,6 @@ H5Xremove_ff(hid_t file_id, unsigned plugin_id, hid_t scope_id, hid_t trans_id, vol_plugin->nrefs ++; } - /* Get idx_handle from dataset */ - if (FAIL == H5VL_iod_dataset_get_index_info(dset, &plugin_id, - &metadata_size, &metadata, NULL)) - HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "cannot get index from dataset"); - /* Store the transaction ID in the xapl_id */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(xapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") @@ -681,8 +676,9 @@ H5Xget_count_ff(hid_t scope_id, hsize_t *idx_count, hid_t rcxt_id, vol_plugin->nrefs ++; } - if (FAIL == H5VL_iod_dataset_get_index_info(dset, idx_count, NULL, - NULL, NULL, req)) + /* TODO for now idx_count is flag exist */ + if (FAIL == H5VL_iod_dataset_get_index_info(dset, idx_count, NULL, NULL, + rcxt_id, req)) HGOTO_ERROR(H5E_INDEX, H5E_CANTSET, FAIL, "cannot get indexing info from dataset"); if (request && *req) { |