Skip to content

Commit

Permalink
Expose H5Pset_obj_track_times object creation property (#517)
Browse files Browse the repository at this point in the history
* Expose H5Pset_obj_track_times

Allow to disable/enable access time tracking for datasets,
so that the file with identical data is always the same, byte-to-byte.
  • Loading branch information
ddemidov authored and musm committed Sep 17, 2018
1 parent ad5f958 commit 343b1ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2107,6 +2107,7 @@ for (jlname, h5name, outtype, argtypes, argsyms, msg) in
(:h5p_set_local_heap_size_hint, :H5Pset_local_heap_size_hint, Herr, (Hid, Cuint), (:fapl_id, :size_hint), "Error setting local heap size hint"),
(:h5p_set_shuffle, :H5Pset_shuffle, Herr, (Hid,), (:plist_id,), "Error enabling shuffle filter"),
(:h5p_set_userblock, :H5Pset_userblock, Herr, (Hid, Hsize), (:plist_id, :len), "Error setting userblock"),
(:h5p_set_obj_track_times, :H5Pset_obj_track_times, Herr, (Hid, UInt8), (:plist_id, :track_times), "Error setting object time tracking"),
(:h5s_close, :H5Sclose, Herr, (Hid,), (:space_id,), "Error closing dataspace"),
(:h5s_select_hyperslab, :H5Sselect_hyperslab, Herr, (Hid, Cint, Ptr{Hsize}, Ptr{Hsize}, Ptr{Hsize}, Ptr{Hsize}), (:dspace_id, :seloper, :start, :stride, :count, :block), "Error selecting hyperslab"),
(:h5t_commit, :H5Tcommit2, Herr, (Hid, Ptr{UInt8}, Hid, Hid, Hid, Hid), (:loc_id, :name, :dtype_id, :lcpl_id, :tcpl_id, :tapl_id), "Error committing type"),
Expand Down Expand Up @@ -2443,6 +2444,7 @@ const hdf5_prop_get_set = Dict(
"userblock" => (get_userblock, h5p_set_userblock, H5P_FILE_CREATE),
"fapl_mpio" => (h5p_get_fapl_mpio, h5p_set_fapl_mpio, H5P_FILE_ACCESS),
"dxpl_mpio" => (h5p_get_dxpl_mpio, h5p_set_dxpl_mpio, H5P_DATASET_XFER),
"track_times" => (nothing, h5p_set_obj_track_times, H5P_OBJECT_CREATE),
)

# properties that require chunks in order to work (e.g. any filter)
Expand Down
11 changes: 11 additions & 0 deletions test/plain.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using HDF5
using CRC32c
using Test

@testset "plain" begin
Expand Down Expand Up @@ -381,6 +382,16 @@ if !isempty(HDF5.libhdf5_hl)
rm(fn)
end

# Test that switching time tracking off results in identical files
h5open("tt1.h5", "w") do f
f["x", "track_times", false] = [1, 2, 3]
end
h5open("tt2.h5", "w") do f
f["x", "track_times", false] = [1, 2, 3]
end

@test open(crc32c, "tt1.h5") == open(crc32c, "tt2.h5")

end # testset plain

# test strings with null and undefined references
Expand Down

0 comments on commit 343b1ab

Please sign in to comment.