summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2014-02-24 20:40:45 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2014-02-24 20:40:45 (GMT)
commitb9f277756bd66cd60dd2150e9800598fe3757135 (patch)
tree4715f2a70db7e0f4f154ae7922ba52fa68765b60 /src
parent0b58f62c773d3b46c62908610686a01435a6e0c5 (diff)
downloadhdf5-b9f277756bd66cd60dd2150e9800598fe3757135.zip
hdf5-b9f277756bd66cd60dd2150e9800598fe3757135.tar.gz
hdf5-b9f277756bd66cd60dd2150e9800598fe3757135.tar.bz2
[svn-r24734] - Add iteration feature at the server with a callback on every object under the starting location.
- Implement view creation for element region on all dataset under a group. - Add the creation propertly list to the token buffer since they are used now in the FF plugin.
Diffstat (limited to 'src')
-rw-r--r--src/H5VLiod.c130
-rw-r--r--src/H5VLiod_server.h8
-rw-r--r--src/H5VLiod_util.c180
-rw-r--r--src/H5VLiod_view.c138
4 files changed, 433 insertions, 23 deletions
diff --git a/src/H5VLiod.c b/src/H5VLiod.c
index 1dbd8d0..bd5be88 100644
--- a/src/H5VLiod.c
+++ b/src/H5VLiod.c
@@ -21,6 +21,8 @@
* by the function shipper.
*/
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5VL_iod_init_interface
@@ -31,6 +33,7 @@
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
+#include "H5Ppkg.h" /* Property lists */
#include "H5Sprivate.h" /* Dataspaces */
#include "H5VLprivate.h" /* VOL plugins */
#include "H5VLiod.h" /* Iod VOL plugin */
@@ -6097,7 +6100,18 @@ H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type,
dset->remote_dset.attrkv_id = attrkv_id;
dset->dapl_id = H5Pcopy(H5P_DATASET_ACCESS_DEFAULT);
- dset->remote_dset.dcpl_id = H5Pcopy(H5P_DATASET_CREATE_DEFAULT);
+
+ /* decode creation property list */
+ {
+ size_t plist_size;
+
+ HDmemcpy(&plist_size, buf_ptr, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ /* Create plist by decoding buffer */
+ if((dset->remote_dset.dcpl_id = H5P__decode((const void *)buf_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, NULL, "can't decode object");
+ buf_ptr += plist_size;
+ }
/* decode dtype */
{
@@ -6166,7 +6180,18 @@ H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type,
dtype->remote_dtype.attrkv_id = attrkv_id;
dtype->tapl_id = H5Pcopy(H5P_DATATYPE_ACCESS_DEFAULT);
- dtype->remote_dtype.tcpl_id = H5Pcopy(H5P_DATATYPE_CREATE_DEFAULT);
+
+ /* decode creation property list */
+ {
+ size_t plist_size;
+
+ HDmemcpy(&plist_size, buf_ptr, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ /* Create plist by decoding buffer */
+ if((dtype->remote_dtype.tcpl_id = H5P__decode((const void *)buf_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, NULL, "can't decode object");
+ buf_ptr += plist_size;
+ }
/* decode dtype */
{
@@ -6220,9 +6245,20 @@ H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type,
grp->remote_group.mdkv_id = mdkv_id;
grp->remote_group.attrkv_id = attrkv_id;
- grp->remote_group.gcpl_id = H5Pcopy(H5P_GROUP_CREATE_DEFAULT);
grp->gapl_id = H5Pcopy(H5P_GROUP_ACCESS_DEFAULT);
+ /* decode creation property list */
+ {
+ size_t plist_size;
+
+ HDmemcpy(&plist_size, buf_ptr, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ /* Create plist by decoding buffer */
+ if((grp->remote_group.gcpl_id = H5P__decode((const void *)buf_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, NULL, "can't decode object");
+ buf_ptr += plist_size;
+ }
+
/* set the input structure for the HG encode routine */
input.coh = tr->file->remote_file.coh;
input.iod_id = iod_id;
@@ -6259,9 +6295,20 @@ H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type,
map->remote_map.mdkv_id = mdkv_id;
map->remote_map.attrkv_id = attrkv_id;
- map->remote_map.mcpl_id = H5Pcopy(H5P_MAP_CREATE_DEFAULT);
map->mapl_id = H5Pcopy(H5P_MAP_ACCESS_DEFAULT);
+ /* decode creation property list */
+ {
+ size_t plist_size;
+
+ HDmemcpy(&plist_size, buf_ptr, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ /* Create plist by decoding buffer */
+ if((map->remote_map.mcpl_id = H5P__decode((const void *)buf_ptr)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, NULL, "can't decode object");
+ buf_ptr += plist_size;
+ }
+
/* decode key_type */
{
H5T_t *dt = NULL;
@@ -6430,9 +6477,11 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
iod_obj_id_t iod_id, mdkv_id, attrkv_id;
H5O_type_t type;
uint8_t *buf_ptr = (uint8_t *)token;
- size_t dt_size = 0, space_size = 0;
+ size_t dt_size = 0, space_size = 0, plist_size = 0;
H5T_t *dt = NULL;
H5S_t *space = NULL;
+ H5P_genplist_t *plist = NULL;
+ hid_t cpl_id;
size_t keytype_size = 0, valtype_size;
H5T_t *kt = NULL, *vt = NULL;
herr_t ret_value = SUCCEED; /* Return value */
@@ -6443,11 +6492,23 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
switch(obj->obj_type) {
case H5I_GROUP:
- iod_id = ((const H5VL_iod_group_t *)obj)->remote_group.iod_id;
- mdkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.mdkv_id;
- attrkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.attrkv_id;
- type = H5O_TYPE_GROUP;
- break;
+ {
+ H5VL_iod_group_t *grp = (H5VL_iod_group_t *)obj;
+
+ iod_id = grp->remote_group.iod_id;
+ mdkv_id = grp->remote_group.mdkv_id;
+ attrkv_id = grp->remote_group.attrkv_id;
+ type = H5O_TYPE_GROUP;
+
+ cpl_id = grp->remote_group.gcpl_id;
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(cpl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ if(H5P__encode(plist, TRUE, NULL, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode plist")
+
+ *token_size += plist_size + sizeof(size_t);
+ break;
+ }
case H5I_DATASET:
{
H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)obj;
@@ -6470,7 +6531,13 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
if(H5S_encode(space, NULL, &space_size) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
- *token_size += dt_size + space_size + sizeof(size_t)*2;
+ cpl_id = dset->remote_dset.dcpl_id;
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(cpl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ if(H5P__encode(plist, TRUE, NULL, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode plist")
+
+ *token_size += plist_size + dt_size + space_size + sizeof(size_t)*3;
break;
}
@@ -6490,7 +6557,13 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
if(H5T_encode(dt, NULL, &dt_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
- *token_size += dt_size + sizeof(size_t);
+ cpl_id = dtype->remote_dtype.tcpl_id;
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(cpl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ if(H5P__encode(plist, TRUE, NULL, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode plist")
+
+ *token_size += dt_size + plist_size + sizeof(size_t)*2;
break;
}
@@ -6517,7 +6590,13 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
if(H5T_encode(vt, NULL, &valtype_size) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype")
- *token_size += keytype_size + valtype_size + sizeof(size_t)*2;
+ cpl_id = map->remote_map.mcpl_id;
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(cpl_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ if(H5P__encode(plist, TRUE, NULL, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode plist")
+
+ *token_size += keytype_size + valtype_size + plist_size + sizeof(size_t)*3;
break;
}
@@ -6556,8 +6635,19 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
switch(obj->obj_type) {
case H5I_GROUP:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5P__encode(plist, TRUE, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+ buf_ptr += plist_size;
break;
case H5I_DATASET:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5P__encode(plist, TRUE, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &dt_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5T_encode(dt, buf_ptr, &dt_size) < 0)
@@ -6571,6 +6661,12 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
buf_ptr += space_size;
break;
case H5I_DATATYPE:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5P__encode(plist, TRUE, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &dt_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5T_encode(dt, buf_ptr, &dt_size) < 0)
@@ -6578,6 +6674,12 @@ H5VL_iod_get_token(void *_obj, void *token, size_t *token_size)
buf_ptr += dt_size;
break;
case H5I_MAP:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5P__encode(plist, TRUE, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace")
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &keytype_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5T_encode(kt, buf_ptr, &keytype_size) < 0)
@@ -9907,7 +10009,7 @@ H5VL_iod_view_create(void *_obj, hid_t query_id, hid_t vcpl_id, hid_t rcxt_id, v
/* store the query ID */
view->query_id = query_id;
- if(H5I_inc_ref(query_id, FALSE) < 0)
+ if(H5I_inc_ref(query_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, NULL, "can't increment ID ref count");
/* copy property list */
diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h
index d49e323..7ebb609 100644
--- a/src/H5VLiod_server.h
+++ b/src/H5VLiod_server.h
@@ -90,6 +90,10 @@ extern hg_id_t H5VL_EFF_CLOSE_CONTAINER;
extern hg_id_t H5VL_EFF_ANALYSIS_FARM;
extern hg_id_t H5VL_EFF_ANALYSIS_FARM_TRANSFER;
+/* Define the operator function pointer for H5Diterate() */
+typedef herr_t (*H5VL_operator_t)(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
+ H5I_type_t obj_type, uint32_t cs_scope, void *operator_data);
+
H5_DLL void EFF__mercury_register_callbacks(void);
H5_DLL int H5VL_iod_server_analysis_execute(hg_handle_t handle);
@@ -444,6 +448,10 @@ H5_DLL herr_t H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, siz
hbool_t write_op, void *buf, size_t buf_size,
iod_checksum_t cs, uint32_t cs_scope, iod_trans_id_t tid);
+H5_DLL herr_t H5VL_iod_server_iterate(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
+ H5I_type_t obj_type, uint32_t cs_scope,
+ H5VL_operator_t op, void *op_data);
+
H5_DLL herr_t H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim,
const hsize_t *point, void *_udata);
#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c
index c577ecb..a67d7b8 100644
--- a/src/H5VLiod_util.c
+++ b/src/H5VLiod_util.c
@@ -22,6 +22,9 @@
#ifdef H5_HAVE_EFF
+static H5I_type_t H5VL__iod_get_h5_obj_type(iod_obj_id_t oid, iod_handle_t coh,
+ iod_trans_id_t rtid, uint32_t cs_scope);
+
/*
* Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
* February, 2013
@@ -1243,6 +1246,183 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5VL_iod_verify_kv_pair */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__iod_get_h5_obj_type
+ *
+ * Purpose: Function to retrieve the HDF5 object type of an IOD object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5I_type_t
+H5VL__iod_get_h5_obj_type(iod_obj_id_t oid, iod_handle_t coh, iod_trans_id_t rtid, uint32_t cs_scope)
+{
+ iod_handle_t mdkv_oh, oh;
+ H5I_type_t obj_type;
+ iod_obj_type_t iod_type;
+ herr_t ret_value = -1;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ iod_type = IOD_OBJID_GETTYPE(oid);
+
+ if(IOD_OBJ_ARRAY == iod_type)
+ obj_type = H5I_DATASET;
+ else if(IOD_OBJ_BLOB == iod_type)
+ obj_type = H5I_DATATYPE;
+ else {
+ scratch_pad sp;
+ iod_checksum_t sp_cs = 0;
+
+ if (iod_obj_open_read(coh, oid, rtid, NULL /*hints*/, &oh, NULL) < 0)
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open object");
+
+ /* get scratch pad of the object */
+ if(iod_obj_get_scratch(oh, rtid, &sp, &sp_cs, NULL) < 0)
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) {
+ /* verify scratch pad integrity */
+ if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check");
+ }
+
+ /* open the metadata KV */
+ if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0)
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE,
+ cs_scope, NULL, &obj_type) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count");
+
+ if(iod_obj_close(mdkv_oh, NULL, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle");
+ if(iod_obj_close(oh, NULL, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle");
+ }
+
+ ret_value = obj_type;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__iod_get_h5_obj_type() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_iterate
+ *
+ * Purpose:
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_iod_server_iterate(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
+ H5I_type_t obj_type, uint32_t cs_scope,
+ H5VL_operator_t op, void *op_data)
+{
+ iod_handle_t obj_oh;
+ herr_t ret;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ ret = (*op)(coh, obj_id, rtid, obj_type, cs_scope, op_data);
+
+ /* Get the object type, if it is not a group do not check for links */
+ if(H5I_GROUP == obj_type) {
+ int num_entries;
+
+ /* Get the object ID and iterate into every member in the group */
+ if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ ret = iod_kv_get_num(obj_oh, rtid, &num_entries, NULL);
+ if(ret != 0)
+ HGOTO_ERROR_IOD(ret, FAIL, "can't get number of KV entries");
+
+ if(0 != num_entries) {
+ iod_kv_params_t *kvs = NULL;
+ iod_kv_t *kv = NULL;
+ iod_checksum_t *oid_cs = NULL;
+ iod_ret_t *oid_ret = NULL;
+ int i;
+
+ kvs = (iod_kv_params_t *)malloc(sizeof(iod_kv_params_t) * (size_t)num_entries);
+ kv = (iod_kv_t *)malloc(sizeof(iod_kv_t) * (size_t)num_entries);
+ oid_cs = (iod_checksum_t *)malloc(sizeof(iod_checksum_t) * (size_t)num_entries);
+ oid_ret = (iod_ret_t *)malloc(sizeof(iod_ret_t) * (size_t)num_entries);
+
+ for(i=0 ; i<num_entries ; i++) {
+ kv[i].key = malloc(IOD_KV_KEY_MAXLEN);
+ kv[i].key_len = IOD_KV_KEY_MAXLEN;
+ //kv[i].value = malloc(sizeof(iod_obj_id_t));
+ //kv[i].value_len = sizeof(iod_obj_id_t);
+ kvs[i].kv = &kv[i];
+ kvs[i].cs = &oid_cs[i];
+ kvs[i].ret = &oid_ret[i];
+ }
+
+ ret = iod_kv_list_key(obj_oh, rtid, NULL, 0, &num_entries, kvs, NULL);
+ if(ret != 0)
+ HGOTO_ERROR_IOD(ret, FAIL, "can't get list of keys");
+ //ret = iod_kv_get_list(obj_oh, rtid, NULL, 0, &num_entries, kvs, NULL);
+ //if(ret != 0)
+ //HGOTO_ERROR_IOD(ret, FAIL, "can't get KV list from group KV");
+
+ for(i=0 ; i<num_entries ; i++) {
+
+ H5I_type_t otype;
+ iod_obj_id_t oid;// = *((iod_obj_id_t *)kv[i].value);
+ H5VL_iod_link_t value;
+
+ /* lookup object in the current group */
+ if(H5VL_iod_get_metadata(obj_oh, rtid, H5VL_IOD_LINK,
+ (char *)(kv[i].key), cs_scope, NULL, &value) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link value");
+
+ if(H5L_TYPE_SOFT == value.link_type) {
+ continue;
+ }
+ else
+ oid = value.u.iod_id;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Iterating into %s OID %"PRIx64"\n", ((char *)kv[i].key), oid);
+#endif
+
+ /* Get the object type. */
+ if((otype = H5VL__iod_get_h5_obj_type(oid, coh, rtid, cs_scope)) < 0)
+ HGOTO_ERROR_IOD(ret, FAIL, "can't get object type");
+
+ if(H5VL_iod_server_iterate(coh, oid, rtid, otype, cs_scope, op, op_data) < 0)
+ HGOTO_ERROR_IOD(ret, FAIL, "can't iterate");
+ }
+
+ for(i=0 ; i<num_entries ; i++) {
+ free(kv[i].key);
+ //free(kv[i].value);
+ }
+
+ free(kv);
+ free(oid_cs);
+ free(oid_ret);
+ free(kvs);
+ }
+
+ if(iod_obj_close(obj_oh, NULL, NULL) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle");
+ }
+
+ ret_value = ret;
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
#if 0
herr_t
H5VL_iod_map_type_convert(hid_t src_id, hid_t dst_id, void *buf, size_t buf_size)
diff --git a/src/H5VLiod_view.c b/src/H5VLiod_view.c
index 62bc9af..4383572 100644
--- a/src/H5VLiod_view.c
+++ b/src/H5VLiod_view.c
@@ -28,6 +28,14 @@
#ifdef H5_HAVE_EFF
+typedef struct {
+ hid_t query_id;
+ hid_t vcpl_id;
+ region_info_t region_info;
+ obj_info_t obj_info;
+ attr_info_t attr_info;
+} H5VL_view_op_t;
+
static hid_t H5VL__iod_get_elmt_region(iod_handle_t coh, iod_obj_id_t dset_id,
iod_trans_id_t rtid, hid_t query_id,
hid_t vcpl_id, uint32_t cs_scope, binary_buf_t *token);
@@ -37,6 +45,35 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
iod_obj_id_t attrkv_id, hid_t cpl_id, hid_t id1, hid_t id2,
binary_buf_t *token);
+static herr_t
+H5VL__iod_view_iterate_cb(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid,
+ H5I_type_t obj_type, uint32_t cs_scope, void *_op_data)
+{
+ H5VL_view_op_t *op_data = (H5VL_view_op_t *)_op_data;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ if(obj_type == H5I_DATASET) {
+ hsize_t i = op_data->region_info.count;
+
+ op_data->region_info.tokens = (binary_buf_t *)realloc(op_data->region_info.tokens,
+ (i+1) * sizeof(binary_buf_t));
+ op_data->region_info.regions = (hid_t *)realloc(op_data->region_info.regions,
+ (i+1) * sizeof(hid_t));
+
+ if((op_data->region_info.regions[i] =
+ H5VL__iod_get_elmt_region(coh, obj_id, rtid, op_data->query_id, op_data->vcpl_id,
+ cs_scope, &op_data->region_info.tokens[i])) < 0)
+ HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get region from query");
+
+ op_data->region_info.count ++;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
/*-------------------------------------------------------------------------
* Function: H5VL_iod_server_view_create_cb
*
@@ -65,10 +102,7 @@ H5VL_iod_server_view_create_cb(AXE_engine_t UNUSED axe_engine,
hid_t vcpl_id;
iod_trans_id_t rtid = input->rcxt_num;
uint32_t cs_scope = input->cs_scope;
- iod_handle_t mdkv_oh;
- scratch_pad sp;
- iod_ret_t ret;
- hid_t region = FAIL;
+ hsize_t i;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -96,7 +130,33 @@ H5VL_iod_server_view_create_cb(AXE_engine_t UNUSED axe_engine,
output.obj_info.tokens = NULL;
output.attr_info.count = 0;
output.attr_info.tokens = NULL;
-
+ }
+ else if (H5I_GROUP == obj_type) {
+ H5VL_view_op_t udata;
+
+ udata.query_id = query_id;
+ udata.vcpl_id = vcpl_id;
+
+ udata.region_info.count = 0;
+ udata.region_info.tokens = NULL;
+ udata.region_info.regions = NULL;
+ udata.obj_info.count = 0;
+ udata.obj_info.tokens = NULL;
+ udata.attr_info.count = 0;
+ udata.attr_info.tokens = NULL;
+
+ if(H5VL_iod_server_iterate(coh, loc_id, rtid, obj_type, cs_scope,
+ H5VL__iod_view_iterate_cb, &udata) < 0)
+ HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't iterate to create group");
+
+ output.region_info.count = udata.region_info.count;
+ output.region_info.tokens = udata.region_info.tokens;
+ output.region_info.regions = udata.region_info.regions;
+ output.valid_view = TRUE;
+ output.obj_info.count = 0;
+ output.obj_info.tokens = NULL;
+ output.attr_info.count = 0;
+ output.attr_info.tokens = NULL;
}
else {
/* MSC - for now this is only what is supported */
@@ -117,6 +177,31 @@ done:
HG_Handler_start_output(op_data->hg_handle, &output);
+ for(i=0 ; i<output.region_info.count ; i++) {
+ free(output.region_info.tokens[i].buf);
+ H5Sclose(output.region_info.regions[i]);
+ }
+
+ for(i=0 ; i<output.obj_info.count ; i++) {
+ free(output.obj_info.tokens[i].buf);
+ }
+
+ for(i=0 ; i<output.attr_info.count ; i++) {
+ free(output.attr_info.tokens[i].buf);
+ }
+
+ if(output.region_info.tokens)
+ free(output.region_info.tokens);
+
+ if(output.region_info.regions)
+ free(output.region_info.regions);
+
+ if(output.obj_info.tokens)
+ free(output.obj_info.tokens);
+
+ if(output.attr_info.tokens)
+ free(output.attr_info.tokens);
+
input = (view_create_in_t *)H5MM_xfree(input);
op_data = (op_data_t *)H5MM_xfree(op_data);
@@ -244,7 +329,7 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
iod_obj_id_t attrkv_id, hid_t cpl_id, hid_t id1, hid_t id2,
binary_buf_t *token)
{
- size_t dt_size = 0, space_size = 0;
+ size_t dt_size = 0, space_size = 0, plist_size = 0;
size_t keytype_size = 0, valtype_size;
uint8_t *buf_ptr = NULL;
size_t token_size = 0;
@@ -256,30 +341,42 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
switch(obj_type) {
case H5O_TYPE_GROUP:
+ if(H5Pencode(cpl_id, NULL, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+ token_size += plist_size + sizeof(size_t);
break;
case H5O_TYPE_DATASET:
+ if(H5Pencode(cpl_id, NULL, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+
if(H5Tencode(id1, NULL, &dt_size) < 0)
HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
if(H5Sencode(id2, NULL, &space_size) < 0)
HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace");
- token_size += dt_size + space_size + sizeof(size_t)*2;
+ token_size += plist_size + dt_size + space_size + sizeof(size_t)*3;
break;
case H5O_TYPE_NAMED_DATATYPE:
+ if(H5Pencode(cpl_id, NULL, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+
if(H5Tencode(id1, NULL, &dt_size) < 0)
HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
- token_size += dt_size + sizeof(size_t);
+ token_size += plist_size + dt_size + sizeof(size_t)*2;
break;
case H5O_TYPE_MAP:
+ if(H5Pencode(cpl_id, NULL, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+
if(H5Tencode(id1, NULL, &keytype_size) < 0)
HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
if(H5Tencode(id2, NULL, &valtype_size) < 0)
HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
- token_size += keytype_size + valtype_size + sizeof(size_t)*2;
+ token_size += plist_size + keytype_size + valtype_size + sizeof(size_t)*3;
break;
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
@@ -302,8 +399,19 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
switch(obj_type) {
case H5O_TYPE_GROUP:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5Pencode(cpl_id, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+ buf_ptr += plist_size;
break;
case H5O_TYPE_DATASET:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5Pencode(cpl_id, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &dt_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5Tencode(id1, buf_ptr, &dt_size) < 0)
@@ -317,6 +425,12 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
buf_ptr += space_size;
break;
case H5O_TYPE_NAMED_DATATYPE:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5Pencode(cpl_id, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &dt_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5Tencode(id1, buf_ptr, &dt_size) < 0)
@@ -324,6 +438,12 @@ H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_
buf_ptr += dt_size;
break;
case H5O_TYPE_MAP:
+ HDmemcpy(buf_ptr, &plist_size, sizeof(size_t));
+ buf_ptr += sizeof(size_t);
+ if(H5Pencode(cpl_id, buf_ptr, &plist_size) < 0)
+ HGOTO_ERROR2(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode plist");
+ buf_ptr += plist_size;
+
HDmemcpy(buf_ptr, &keytype_size, sizeof(size_t));
buf_ptr += sizeof(size_t);
if(H5Tencode(id1, buf_ptr, &keytype_size) < 0)