summaryrefslogtreecommitdiffstats
path: root/examples/h5dsm_dset_read.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2017-01-31 23:32:00 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2017-01-31 23:32:00 (GMT)
commitea8ab9f41f3d42e40979ec3bbd356dafd5e6fe8e (patch)
treeea3ea1b296c8b8cc5589dad1de2e08cfcda243ca /examples/h5dsm_dset_read.c
parent59b0c7a9505da5a90eddd510d0dcbab7cab2cdc8 (diff)
downloadhdf5-ea8ab9f41f3d42e40979ec3bbd356dafd5e6fe8e.zip
hdf5-ea8ab9f41f3d42e40979ec3bbd356dafd5e6fe8e.tar.gz
hdf5-ea8ab9f41f3d42e40979ec3bbd356dafd5e6fe8e.tar.bz2
Implement new transaction model, transactions are now hidden from the
API, H5TR functions have no effect. Added support for H5Fflush. Added H5VLdaosm_snap_create and H5Pset_daosm_snap_open to save and load snapshots. Added enforcement of file access flags. Updated examples. Other minor fixes/cleanup.
Diffstat (limited to 'examples/h5dsm_dset_read.c')
-rw-r--r--examples/h5dsm_dset_read.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/examples/h5dsm_dset_read.c b/examples/h5dsm_dset_read.c
index 0fbc56f..18d41d8 100644
--- a/examples/h5dsm_dset_read.c
+++ b/examples/h5dsm_dset_read.c
@@ -3,11 +3,11 @@
int main(int argc, char *argv[]) {
uuid_t pool_uuid;
- char *pool_grp = "daos_tier0";
- hid_t file = -1, dset = -1, trans = -1, fapl = -1;
+ char *pool_grp = NULL;
+ hid_t file = -1, dset = -1, fapl = -1;
int buf[4][6];
int i, j;
- uint64_t trans_num;
+ H5VL_daosm_snap_id_t snap_id;
(void)MPI_Init(&argc, &argv);
(void)daos_init();
@@ -28,25 +28,23 @@ int main(int argc, char *argv[]) {
if(H5Pset_fapl_daosm(fapl, MPI_COMM_WORLD, MPI_INFO_NULL, pool_uuid, pool_grp) < 0)
ERROR;
- /* Open file */
- if((file = H5Fopen_ff(argv[2], H5F_ACC_RDONLY, fapl, argc == 4 ? &trans : NULL)) < 0)
- ERROR;
-
- /* Create transaction if specified */
+ /* Open snapshot if specified */
if(argc == 5) {
- trans_num = (uint64_t)atoi(argv[4]);
- if((trans = H5TRcreate(file, trans_num)) < 0)
- ERROR;
- }
- else
- if(H5TRget_trans_num(trans, &trans_num) < 0)
+ snap_id = (H5VL_daosm_snap_id_t)atoi(argv[4]);
+ printf("Opening snapshot %llu\n", (long long unsigned)snap_id);
+ if(H5Pset_daosm_snap_open(fapl, snap_id) < 0)
ERROR;
+ } /* end if */
+
+ /* Open file */
+ if((file = H5Fopen(argv[2], H5F_ACC_RDONLY, fapl)) < 0)
+ ERROR;
/* Open dataset */
- if((dset = H5Dopen_ff(file, argv[3], H5P_DEFAULT, trans)) < 0)
+ if((dset = H5Dopen2(file, argv[3], H5P_DEFAULT)) < 0)
ERROR;
- printf("Reading dataset - transaction number = %llu\n", (long long unsigned)trans_num);
+ printf("Reading dataset");
/* Initialize buffer */
for(i = 0; i < 4; i++)
@@ -54,7 +52,7 @@ int main(int argc, char *argv[]) {
buf[i][j] = -1;
/* Read data */
- if(H5Dread_ff(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf, trans) < 0)
+ if(H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
ERROR;
/* Print buffer */
@@ -66,11 +64,9 @@ int main(int argc, char *argv[]) {
}
/* Close */
- if(H5Dclose_ff(dset, -1) < 0)
- ERROR;
- if(H5TRclose(trans) < 0)
+ if(H5Dclose(dset) < 0)
ERROR;
- if(H5Fclose_ff(file, -1) < 0)
+ if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
@@ -83,9 +79,8 @@ int main(int argc, char *argv[]) {
error:
H5E_BEGIN_TRY {
- H5Dclose_ff(dset, -1);
- H5TRclose(trans);
- H5Fclose_ff(file, -1);
+ H5Dclose(dset);
+ H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;