diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2017-01-31 23:32:00 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2017-01-31 23:32:00 (GMT) |
commit | ea8ab9f41f3d42e40979ec3bbd356dafd5e6fe8e (patch) | |
tree | ea3ea1b296c8b8cc5589dad1de2e08cfcda243ca /examples/h5dsm_dset_write.c | |
parent | 59b0c7a9505da5a90eddd510d0dcbab7cab2cdc8 (diff) | |
download | hdf5-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_write.c')
-rw-r--r-- | examples/h5dsm_dset_write.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/examples/h5dsm_dset_write.c b/examples/h5dsm_dset_write.c index d52e5a3..1ca34b8 100644 --- a/examples/h5dsm_dset_write.c +++ b/examples/h5dsm_dset_write.c @@ -3,9 +3,9 @@ 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; - uint64_t trans_num; + char *pool_grp = NULL; + hid_t file = -1, dset = -1, fapl = -1; + H5VL_daosm_snap_id_t snap_id; int buf[4][6]; int i, j; @@ -15,8 +15,8 @@ int main(int argc, char *argv[]) { /* Seed random number generator */ srand(time(NULL)); - if(argc != 4) - PRINTF_ERROR("argc != 4\n"); + if(argc < 4 || argc > 5) + PRINTF_ERROR("argc must be 4 or 5\n"); /* Parse UUID */ if(0 != uuid_parse(argv[1], pool_uuid)) @@ -29,19 +29,11 @@ int main(int argc, char *argv[]) { ERROR; /* Open file */ - if((file = H5Fopen_ff(argv[2], H5F_ACC_RDWR, fapl, &trans)) < 0) + if((file = H5Fopen(argv[2], H5F_ACC_RDWR, fapl)) < 0) ERROR; /* Open dataset */ - if((dset = H5Dopen_ff(file, argv[3], H5P_DEFAULT, trans)) < 0) - ERROR; - - /* Get next transaction */ - if(H5TRget_trans_num(trans, &trans_num) < 0) - ERROR; - if(H5TRclose(trans) < 0) - ERROR; - if((trans = H5TRcreate(file, trans_num + 1)) < 0) + if((dset = H5Dopen2(file, argv[3], H5P_DEFAULT)) < 0) ERROR; /* Fill and print buffer */ @@ -54,22 +46,21 @@ int main(int argc, char *argv[]) { printf("\n"); } - printf("Transaction number = %llu\n", (long long unsigned)(trans_num + 1)); - /* Write data */ - if(H5Dwrite_ff(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf, trans) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) ERROR; - /* Commit transaction */ - if(H5TRcommit(trans) < 0) - ERROR; + /* Save snapshot if requested */ + if(argc == 5) { + if(H5VLdaosm_snap_create(file, &snap_id) < 0) + ERROR; + printf("Saved snapshot: snap_id = %llu\n", (long long unsigned)snap_id); + } /* end if */ /* 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; @@ -82,9 +73,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; |