summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_dataset.c
diff options
context:
space:
mode:
authorGaute Hope <eg@gaute.vetsj.com>2021-05-19 22:21:52 (GMT)
committerGitHub <noreply@github.com>2021-05-19 22:21:52 (GMT)
commit509a068f628826b8d1d09b7ab267400f4cec0852 (patch)
tree3e780797310237f158ba542bf0430b27cdc829c5 /src/H5VLnative_dataset.c
parentd179f9d79ca9ed3f94715b907e3d8426a26ee766 (diff)
downloadhdf5-509a068f628826b8d1d09b7ab267400f4cec0852.zip
hdf5-509a068f628826b8d1d09b7ab267400f4cec0852.tar.gz
hdf5-509a068f628826b8d1d09b7ab267400f4cec0852.tar.bz2
Add H5Dchunk_iter method for iterating over chunks (#6)
* Add H5Dchunk_iter method for iterating over chunks This method iterates over all chunks in dataset, calling a user-supplied callback with the chunk information and optional user supplied data. The iterator is stopped when ITER_STOP is returned by the user-supplied callback or the iterator is exhausted. Existing methods to get chunk_info performs an iteration each time, so to get many or all chunks causes SUM(i) for i = 0 -> N operations for N chunks, as opposed to N operations when using this iterator for this use case. * H5Dchunk_iter: test iterating all chunks, some chunks and failing iteration. * H5D: move H5Dchunk_iter private methods to specific * trace: add H5D_chunk_iter_op_t and trace H5D.c * chunks-iter: document chunk_iter * chunk-iter: chunk add FUNC_ENTER/FUNC_LEAVE macros * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5VLnative_dataset.c')
-rw-r--r--src/H5VLnative_dataset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index d78388e..21491e7 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -353,6 +353,24 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
break;
}
+ case H5VL_DATASET_CHUNK_ITER: { /* H5Dchunk_iter */
+ H5D_chunk_iter_op_t cb = HDva_arg(arguments, H5D_chunk_iter_op_t);
+ void * op_data = HDva_arg(arguments, void *);
+
+ HDassert(dset->shared);
+
+ /* Make sure the dataset is chunked */
+ if (H5D_CHUNKED != dset->shared->layout.type) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+ }
+
+ /* Call private function */
+ if (H5D__chunk_iter(dset, cb, op_data) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't iterate over chunks")
+
+ break;
+ }
+
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
} /* end switch */