H5VLpublic.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * All rights reserved. *
  4. * *
  5. * This file is part of HDF5. The full HDF5 copyright notice, including *
  6. * terms governing use, modification, and redistribution, is contained in *
  7. * the COPYING file, which can be found at the root of the source code *
  8. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  9. * If you do not have access to either file, you may request a copy from *
  10. * help@hdfgroup.org. *
  11. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  12. /*
  13. * This file contains public declarations for the H5VL (VOL) module.
  14. */
  15. #ifndef H5VLpublic_H
  16. #define H5VLpublic_H
  17. /* Public headers needed by this file */
  18. #include "H5public.h" /* Generic Functions */
  19. #include "H5Ipublic.h" /* IDs */
  20. /*****************/
  21. /* Public Macros */
  22. /*****************/
  23. /**
  24. * \ingroup H5VLDEF
  25. * \brief Version # of VOL class struct & callbacks
  26. *
  27. * \details Each VOL connector must set the 'version' field in the H5VL_class_t
  28. * struct to the version of the H5VL_class_t struct that the connector
  29. * implements. The HDF5 library will reject connectors with
  30. * incompatible structs.
  31. */
  32. #define H5VL_VERSION 2
  33. /* VOL connector identifier values
  34. * These are H5VL_class_value_t values, NOT hid_t values!
  35. */
  36. /**
  37. * \ingroup H5VLDEF
  38. * Invalid ID for VOL connector ID
  39. */
  40. #define H5_VOL_INVALID (-1)
  41. /**
  42. * \ingroup H5VLDEF
  43. * Native HDF5 file format VOL connector
  44. */
  45. #define H5_VOL_NATIVE 0
  46. /**
  47. * \ingroup H5VLDEF
  48. * VOL connector IDs below this value are reserved for library use
  49. */
  50. #define H5_VOL_RESERVED 256
  51. /**
  52. * \ingroup H5VLDEF
  53. * Maximum VOL connector ID
  54. */
  55. #define H5_VOL_MAX 65535
  56. /* Flags to return from H5VLquery_optional API and 'opt_query' callbacks */
  57. /* Note: Operations which access multiple objects' data or metadata in a
  58. * container should be registered as file-level optional operations.
  59. * (e.g. "H5Dwrite_multi" takes a list of datasets to write data to, so
  60. * a VOL connector that implemented it should register it as an optional
  61. * file operation, and pass-through VOL connectors that are stacked above
  62. * the connector that registered it should assume that dataset elements
  63. * for _any_ dataset in the file could be written to)
  64. */
  65. #define H5VL_OPT_QUERY_SUPPORTED 0x0001 /* VOL connector supports this operation */
  66. #define H5VL_OPT_QUERY_READ_DATA 0x0002 /* Operation reads data for object */
  67. #define H5VL_OPT_QUERY_WRITE_DATA 0x0004 /* Operation writes data for object */
  68. #define H5VL_OPT_QUERY_QUERY_METADATA 0x0008 /* Operation reads metadata for object */
  69. #define H5VL_OPT_QUERY_MODIFY_METADATA 0x0010 /* Operation modifies metadata for object */
  70. #define H5VL_OPT_QUERY_COLLECTIVE \
  71. 0x0020 /* Operation is collective (operations without this flag are assumed to be independent) */
  72. #define H5VL_OPT_QUERY_NO_ASYNC 0x0040 /* Operation may NOT be executed asynchronously */
  73. #define H5VL_OPT_QUERY_MULTI_OBJ 0x0080 /* Operation involves multiple objects */
  74. /*******************/
  75. /* Public Typedefs */
  76. /*******************/
  77. /**
  78. * \ingroup H5VLDEF
  79. *
  80. * \brief VOL connector identifiers.
  81. *
  82. * \details Values 0 through 255 are for connectors defined by the HDF5
  83. * library. Values 256 through 511 are available for testing new
  84. * connectors. Subsequent values should be obtained from the HDF5
  85. * development team at mailto:help@hdfgroup.org.
  86. */
  87. //! <!-- [H5VL_class_value_t_snip] -->
  88. typedef int H5VL_class_value_t;
  89. //! <!-- [H5VL_class_value_t_snip] -->
  90. /**
  91. * \ingroup H5VLDEF
  92. * \details Enum type for each VOL subclass
  93. * (Used for various queries, etc)
  94. */
  95. typedef enum H5VL_subclass_t {
  96. H5VL_SUBCLS_NONE, /**< Operations outside of a subclass */
  97. H5VL_SUBCLS_INFO, /**< 'Info' subclass */
  98. H5VL_SUBCLS_WRAP, /**< 'Wrap' subclass */
  99. H5VL_SUBCLS_ATTR, /**< 'Attribute' subclass */
  100. H5VL_SUBCLS_DATASET, /**< 'Dataset' subclass */
  101. H5VL_SUBCLS_DATATYPE, /**< 'Named datatype' subclass */
  102. H5VL_SUBCLS_FILE, /**< 'File' subclass */
  103. H5VL_SUBCLS_GROUP, /**< 'Group' subclass */
  104. H5VL_SUBCLS_LINK, /**< 'Link' subclass */
  105. H5VL_SUBCLS_OBJECT, /**< 'Object' subclass */
  106. H5VL_SUBCLS_REQUEST, /**< 'Request' subclass */
  107. H5VL_SUBCLS_BLOB, /**< 'Blob' subclass */
  108. H5VL_SUBCLS_TOKEN /**< 'Token' subclass */
  109. /* NOTE: if more operations are added, the
  110. * H5VL_opt_vals_g[] array size should be updated.
  111. */
  112. } H5VL_subclass_t;
  113. /********************/
  114. /* Public Variables */
  115. /********************/
  116. /*********************/
  117. /* Public Prototypes */
  118. /*********************/
  119. #ifdef __cplusplus
  120. extern "C" {
  121. #endif
  122. /**
  123. * \ingroup H5VL
  124. * \brief Registers a new VOL connector by name
  125. *
  126. * \param[in] connector_name Connector name
  127. * \vipl_id
  128. * \return \hid_t{VOL connector}
  129. *
  130. * \details H5VLregister_connector_by_name() registers a new VOL connector with
  131. * the name \p connector_name as a member of the virtual object layer
  132. * class. This VOL connector identifier is good until the library is
  133. * closed or the connector is unregistered.
  134. *
  135. * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
  136. * initialization property list of class #H5P_VOL_INITIALIZE created
  137. * with H5Pcreate(). When created, this property list contains no
  138. * library properties. If a VOL connector author decides that
  139. * initialization-specific data are needed, they can be added to the
  140. * empty list and retrieved by the connector in the VOL connector's
  141. * initialize callback. Use of the VOL initialization property list is
  142. * uncommon, as most VOL-specific properties are added to the file
  143. * access property list via the connector's API calls which set the
  144. * VOL connector for the file open/create. For more information, see
  145. * \ref_vol_doc.
  146. *
  147. * \since 1.12.0
  148. *
  149. */
  150. H5_DLL hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id);
  151. /**
  152. * \ingroup H5VL
  153. * \brief Registers a new VOL connector by value
  154. *
  155. * \param[in] connector_value Connector value
  156. * \vipl_id
  157. * \return \hid_t{VOL connector}
  158. *
  159. * \details H5VLregister_connector_by_value() registers a new VOL connector
  160. * with value connector_value as a member of the virtual object layer
  161. * class. This VOL connector identifier is good until the library is
  162. * closed or the connector is unregistered.
  163. *
  164. * \p connector_value has a type of H5VL_class_value_t, which is
  165. * defined in H5VLpublic.h as follows:
  166. * \snippet this H5VL_class_value_t_snip
  167. *
  168. * Valid VOL connector identifiers can have values from 0 through 255
  169. * for connectors defined by the HDF5 library. Values 256 through 511
  170. * are available for testing new connectors. Subsequent values should
  171. * be obtained by contacting the The HDF Help Desk.
  172. *
  173. * \p vipl_id is either #H5P_DEFAULT or the identifier of a VOL
  174. * initialization property list of class #H5P_VOL_INITIALIZE created
  175. * with H5Pcreate(). When created, this property list contains no
  176. * library properties. If a VOL connector author decides that
  177. * initialization-specific data are needed, they can be added to the
  178. * empty list and retrieved by the connector in the VOL connector's
  179. * initialize callback. Use of the VOL initialization property list is
  180. * uncommon, as most VOL-specific properties are added to the file
  181. * access property list via the connector's API calls which set the
  182. * VOL connector for the file open/create. For more information, see
  183. * the \ref_vol_doc.
  184. *
  185. * \since 1.12.0
  186. *
  187. */
  188. H5_DLL hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id);
  189. /**
  190. * \ingroup H5VL
  191. * \brief Tests whether a VOL class has been registered under a certain name
  192. *
  193. * \param[in] name Alleged name of connector
  194. * \return \htri_t
  195. *
  196. * \details H5VLis_connector_registered_by_name() tests whether a VOL class has
  197. * been registered or not, according to the supplied connector name
  198. * \p name.
  199. *
  200. * \since 1.12.0
  201. */
  202. H5_DLL htri_t H5VLis_connector_registered_by_name(const char *name);
  203. /**
  204. * \ingroup H5VL
  205. * \brief Tests whether a VOL class has been registered for a given value
  206. *
  207. * \param[in] connector_value Connector value
  208. * \return \htri_t
  209. *
  210. * \details H5VLis_connector_registered_by_value() tests whether a VOL class
  211. * has been registered, according to the supplied connector value \p
  212. * connector_value.
  213. *
  214. * \p connector_value has a type of H5VL_class_value_t, which is
  215. * defined in H5VLpublic.h as follows:
  216. * \snippet this H5VL_class_value_t_snip
  217. *
  218. * Valid VOL connector identifiers can have values from 0 through 255
  219. * for connectors defined by the HDF5 library. Values 256 through 511
  220. * are available for testing new connectors. Subsequent values should
  221. * be obtained by contacting the The HDF Help Desk.
  222. *
  223. * \since 1.12.0
  224. */
  225. H5_DLL htri_t H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value);
  226. /**
  227. * \ingroup H5VL
  228. * \brief Retrieves the VOL connector identifier for a given object identifier
  229. *
  230. * \obj_id
  231. * \return \hid_t{VOL connector}
  232. *
  233. * \details H5VLget_connector_id() retrieves the registered VOL connector
  234. * identifier for the specified object identifier \p obj_id. The VOL
  235. * connector identifier must be closed with H5VLclose() when no longer
  236. * in use.
  237. *
  238. * \since 1.12.0
  239. */
  240. H5_DLL hid_t H5VLget_connector_id(hid_t obj_id);
  241. /**
  242. * \ingroup H5VL
  243. * \brief Retrieves the identifier for a registered VOL connector name
  244. *
  245. * \param[in] name Connector name
  246. * \return \hid_t{VOL connector}
  247. *
  248. * \details H5VLget_connector_id_by_name() retrieves the identifier for a
  249. * registered VOL connector with the name \p name. The identifier must
  250. * be closed with H5VLclose() when no longer in use.
  251. *
  252. * \since 1.12.0
  253. */
  254. H5_DLL hid_t H5VLget_connector_id_by_name(const char *name);
  255. /**
  256. * \ingroup H5VL
  257. * \brief Retrieves the identifier for a registered VOL connector value
  258. *
  259. * \param[in] connector_value Connector value
  260. * \return \hid_t{VOL connector}
  261. *
  262. * \details H5VLget_connector_id_by_value() retrieves the identifier for a
  263. * registered VOL connector with the value \p connector_value. The
  264. * identifier will need to be closed by H5VLclose().
  265. *
  266. * \p connector_value has a type of H5VL_class_value_t, which is
  267. * defined in H5VLpublic.h as follows:
  268. * \snippet this H5VL_class_value_t_snip
  269. *
  270. * Valid VOL connector identifiers can have values from 0 through 255
  271. * for connectors defined by the HDF5 library. Values 256 through 511
  272. * are available for testing new connectors. Subsequent values should
  273. * be obtained by contacting the The HDF Help Desk.
  274. *
  275. * \since 1.12.0
  276. */
  277. H5_DLL hid_t H5VLget_connector_id_by_value(H5VL_class_value_t connector_value);
  278. /**
  279. * \ingroup H5VL
  280. * \brief Retrieves a connector name for a VOL
  281. *
  282. * \obj_id{id} or file identifier
  283. * \param[out] name Connector name
  284. * \param[in] size Maximum length of the name to retrieve
  285. * \return Returns the length of the connector name on success, and a negative value on failure.
  286. *
  287. * \details H5VLget_connector_name() retrieves up to \p size elements of the
  288. * VOL name \p name associated with the object or file identifier \p
  289. * id.
  290. *
  291. * Passing in a NULL pointer for size will return the size of the
  292. * connector name. This can be used to determine the size of the
  293. * buffer to allocate for the name.
  294. *
  295. * \since 1.12.0
  296. */
  297. H5_DLL ssize_t H5VLget_connector_name(hid_t id, char *name /*out*/, size_t size);
  298. /**
  299. * \ingroup H5VL
  300. * \brief Closes a VOL connector identifier
  301. *
  302. * \param[in] connector_id Connector identifier
  303. * \return \herr_t
  304. *
  305. * \details H5VLclose() closes a VOL connector identifier. This does not affect
  306. * the file access property lists which have been defined to use this
  307. * VOL connector or files which are already opened under this
  308. * connector.
  309. *
  310. * \since 1.12.0
  311. */
  312. H5_DLL herr_t H5VLclose(hid_t connector_id);
  313. /**
  314. * \ingroup H5VL
  315. * \brief Removes a VOL connector identifier from the library
  316. *
  317. * \param[in] connector_id Connector identifier
  318. * \return \herr_t
  319. *
  320. * \details H5VLunregister_connector() removes a VOL connector identifier from
  321. * the library. This does not affect the file access property lists
  322. * which have been defined to use the VOL connector or any files which
  323. * are already opened with this connector.
  324. *
  325. * \attention H5VLunregister_connector() will fail if attempting to unregister
  326. * the native VOL connector.
  327. *
  328. * \since 1.12.0
  329. */
  330. H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
  331. /**
  332. * \ingroup H5VL
  333. * \brief Determine if a VOL connector supports a particular
  334. * optional callback operation.
  335. *
  336. * \obj_id
  337. * \param[in] subcls VOL subclass
  338. * \param[in] opt_type Option type
  339. * \param[out] flags Operation flags
  340. * \return \herr_t
  341. *
  342. * \since 1.12.0
  343. */
  344. H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags);
  345. /**
  346. * \ingroup H5VL
  347. * \brief Determines whether an object ID represents a native
  348. * VOL connector object.
  349. *
  350. * \param[in] obj_id Object identifier
  351. * \param[in] is_native Boolean determining whether object is a native
  352. * VOL connector object
  353. * \return \herr_t
  354. *
  355. * \since 1.13.0
  356. */
  357. H5_DLL herr_t H5VLobject_is_native(hid_t obj_id, hbool_t *is_native);
  358. #ifdef __cplusplus
  359. }
  360. #endif
  361. #endif /* H5VLpublic_H */