H5FDmulti.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * Copyright by the Board of Trustees of the University of Illinois. *
  4. * All rights reserved. *
  5. * *
  6. * This file is part of HDF5. The full HDF5 copyright notice, including *
  7. * terms governing use, modification, and redistribution, is contained in *
  8. * the COPYING file, which can be found at the root of the source code *
  9. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  10. * If you do not have access to either file, you may request a copy from *
  11. * help@hdfgroup.org. *
  12. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  13. /*
  14. * Programmer: Robb Matzke
  15. * Monday, August 2, 1999
  16. *
  17. * Purpose: The public header file for the "multi" driver.
  18. */
  19. #ifndef H5FDmulti_H
  20. #define H5FDmulti_H
  21. #define H5FD_MULTI (H5FDperform_init(H5FD_multi_init))
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. H5_DLL hid_t H5FD_multi_init(void);
  26. /**
  27. * \ingroup FAPL
  28. *
  29. * \brief Sets up use of the multi-file driver
  30. *
  31. * \fapl_id
  32. * \param[in] memb_map Maps memory usage types to other memory usage types
  33. * \param[in] memb_fapl Property list for each memory usage type
  34. * \param[in] memb_name Name generator for names of member files
  35. * \param[in] memb_addr The offsets within the virtual address space, from 0
  36. * (zero) to #HADDR_MAX, at which each type of data storage begins
  37. * \param[in] relax Allows read-only access to incomplete file sets when \c TRUE
  38. * \returns \herr_t
  39. *
  40. * \details H5Pset_fapl_multi() sets the file access property list \p fapl_id to
  41. * use the multi-file driver.
  42. *
  43. * The multi-file driver enables different types of HDF5 data and
  44. * metadata to be written to separate files. These files are viewed by
  45. * the HDF5 library and the application as a single virtual HDF5 file
  46. * with a single HDF5 file address space. The types of data that can be
  47. * broken out into separate files include raw data, the superblock,
  48. * B-tree data, global heap data, local heap data, and object
  49. * headers. At the programmer's discretion, two or more types of data
  50. * can be written to the same file while other types of data are
  51. * written to separate files.
  52. *
  53. * The array \p memb_map maps memory usage types to other memory usage
  54. * types and is the mechanism that allows the caller to specify how
  55. * many files are created. The array contains #H5FD_MEM_NTYPES entries,
  56. * which are either the value #H5FD_MEM_DEFAULT or a memory usage
  57. * type. The number of unique values determines the number of files
  58. * that are opened.
  59. *
  60. * The array \p memb_fapl contains a property list for each memory
  61. * usage type that will be associated with a file.
  62. *
  63. * The array \p memb_name should be a name generator (a
  64. * \Code{printf}-style format with a \Code{%s} which will be replaced
  65. * with the name passed to H5FDopen(), usually from H5Fcreate() or
  66. * H5Fopen()).
  67. *
  68. * The array \p memb_addr specifies the offsets within the virtual
  69. * address space, from 0 (zero) to #HADDR_MAX, at which each type of
  70. * data storage begins.
  71. *
  72. * If \p relax is set to 1 (TRUE), then opening an existing file for
  73. * read-only access will not fail if some file members are
  74. * missing. This allows a file to be accessed in a limited sense if
  75. * just the meta data is available.
  76. *
  77. * Default values for each of the optional arguments are as follows:
  78. * <table>
  79. * <tr>
  80. * <td>\p memb_map</td>
  81. * <td>The default member map contains the value #H5FD_MEM_DEFAULT for each element.</td>
  82. * </tr>
  83. * <tr>
  84. * <td>
  85. * \p memb_fapl
  86. * </td>
  87. * <td>
  88. * The default value is #H5P_DEFAULT for each element.
  89. * </td>
  90. * </tr>
  91. * <tr>
  92. * <td>
  93. * \p memb_name
  94. * </td>
  95. * <td>
  96. * The default string is \Code{%s-X.h5} where \c X is one of the following letters:
  97. * - \c s for #H5FD_MEM_SUPER
  98. * - \c b for #H5FD_MEM_BTREE
  99. * - \c r for #H5FD_MEM_DRAW
  100. * - \c g for #H5FD_MEM_GHEAP
  101. * - \c l for #H5FD_MEM_LHEAP
  102. * - \c o for #H5FD_MEM_OHDR
  103. * </td>
  104. * </tr>
  105. * <tr>
  106. * <td>
  107. * \p memb_addr
  108. * </td>
  109. * <td>
  110. * The default setting is that the address space is equally divided
  111. * among all of the elements:
  112. * - #H5FD_MEM_SUPER \Code{-> 0 * (HADDR_MAX/6)}
  113. * - #H5FD_MEM_BTREE \Code{-> 1 * (HADDR_MAX/6)}
  114. * - #H5FD_MEM_DRAW \Code{-> 2 * (HADDR_MAX/6)}
  115. * - #H5FD_MEM_GHEAP \Code{-> 3 * (HADDR_MAX/6)}
  116. * - #H5FD_MEM_LHEAP \Code{-> 4 * (HADDR_MAX/6)}
  117. * - #H5FD_MEM_OHDR \Code{-> 5 * (HADDR_MAX/6)}
  118. * </td>
  119. * </tr>
  120. * </table>
  121. *
  122. * \par Example:
  123. * The following code sample sets up a multi-file access property list that
  124. * partitions data into meta and raw files, each being one-half of the address:\n
  125. * \code
  126. * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES];
  127. * hid_t memb_fapl[H5FD_MEM_NTYPES];
  128. * const char *memb[H5FD_MEM_NTYPES];
  129. * haddr_t memb_addr[H5FD_MEM_NTYPES];
  130. *
  131. * // The mapping...
  132. * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) {
  133. * memb_map[mt] = H5FD_MEM_SUPER;
  134. * }
  135. * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
  136. *
  137. * // Member information
  138. * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
  139. * memb_name[H5FD_MEM_SUPER] = "%s.meta";
  140. * memb_addr[H5FD_MEM_SUPER] = 0;
  141. *
  142. * memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
  143. * memb_name[H5FD_MEM_DRAW] = "%s.raw";
  144. * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2;
  145. *
  146. * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
  147. * H5Pset_fapl_multi(fapl, memb_map, memb_fapl,
  148. * memb_name, memb_addr, TRUE);
  149. * \endcode
  150. *
  151. * \version 1.6.3 \p memb_name parameter type changed to \Code{const char* const*}.
  152. * \since 1.4.0
  153. */
  154. H5_DLL herr_t H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl,
  155. const char *const *memb_name, const haddr_t *memb_addr, hbool_t relax);
  156. /**
  157. * \ingroup FAPL
  158. *
  159. * \brief Returns information about the multi-file access property list
  160. *
  161. * \fapl_id
  162. * \param[out] memb_map Maps memory usage types to other memory usage types
  163. * \param[out] memb_fapl Property list for each memory usage type
  164. * \param[out] memb_name Name generator for names of member files
  165. * \param[out] memb_addr The offsets within the virtual address space, from 0
  166. * (zero) to #HADDR_MAX, at which each type of data storage begins
  167. * \param[out] relax Allows read-only access to incomplete file sets when \c TRUE
  168. * \returns \herr_t
  169. *
  170. * \details H5Pget_fapl_multi() returns information about the multi-file access
  171. * property list.
  172. *
  173. * \since 1.4.0
  174. *
  175. */
  176. H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/,
  177. char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax /*out*/);
  178. /**
  179. * \ingroup FAPL
  180. *
  181. * \brief Emulates the old split file driver
  182. *
  183. * \fapl_id{fapl}
  184. * \param[in] meta_ext Metadata filename extension
  185. * \param[in] meta_plist_id File access property list identifier for the metadata file
  186. * \param[in] raw_ext Raw data filename extension
  187. * \param[in] raw_plist_id
  188. * \returns \herr_t
  189. *
  190. * \details H5Pset_fapl_split() is a compatibility function that enables the
  191. * multi-file driver to emulate the split driver from HDF5 Releases 1.0
  192. * and 1.2. The split file driver stored metadata and raw data in
  193. * separate files but provided no mechanism for separating types of
  194. * metadata.
  195. *
  196. * \p fapl is a file access property list identifier.
  197. *
  198. * \p meta_ext is the filename extension for the metadata file. The
  199. * extension is appended to the name passed to H5FDopen(), usually from
  200. * H5Fcreate() or H5Fopen(), to form the name of the metadata file. If
  201. * the string \Code{%s} is used in the extension, it works like the
  202. * name generator as in H5Pset_fapl_multi().
  203. *
  204. * \p meta_plist_id is the file access property list identifier for the
  205. * metadata file.
  206. *
  207. * \p raw_ext is the filename extension for the raw data file. The
  208. * extension is appended to the name passed to H5FDopen(), usually from
  209. * H5Fcreate() or H5Fopen(), to form the name of the raw data file. If
  210. * the string \Code{%s} is used in the extension, it works like the
  211. * name generator as in H5Pset_fapl_multi().
  212. *
  213. * \p raw_plist_id is the file access property list identifier for the
  214. * raw data file.
  215. *
  216. * If a user wishes to check to see whether this driver is in use, the
  217. * user must call H5Pget_driver() and compare the returned value to the
  218. * string #H5FD_MULTI. A positive match will confirm that the multi
  219. * driver is in use; HDF5 provides no mechanism to determine whether it
  220. * was called as the special case invoked by H5Pset_fapl_split().
  221. *
  222. * \par Example:
  223. * \code
  224. * // Example 1: Both metadata and rawdata files are in the same
  225. * // directory. Use Station1-m.h5 and Station1-r.h5 as
  226. * // the metadata and rawdata files.
  227. * hid_t fapl, fid;
  228. * fapl = H5Pcreate(H5P_FILE_ACCESS);
  229. * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
  230. * fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
  231. *
  232. * // Example 2: metadata and rawdata files are in different
  233. * // directories. Use PointA-m.h5 and /pfs/PointA-r.h5 as
  234. * // the metadata and rawdata files.
  235. * hid_t fapl, fid;
  236. * fapl = H5Pcreate(H5P_FILE_ACCESS);
  237. * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/pfs/%s-r.h5", H5P_DEFAULT);
  238. * fid=H5Fcreate("PointA",H5F_ACC_TRUNC,H5P_DEFAULT,fapl);
  239. * \endcode
  240. *
  241. * \since 1.4.0
  242. *
  243. */
  244. H5_DLL herr_t H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const char *raw_ext,
  245. hid_t raw_plist_id);
  246. #ifdef __cplusplus
  247. }
  248. #endif
  249. #endif