HDF5  1.12.0
H5B2private.h
Go to the documentation of this file.
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://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*-------------------------------------------------------------------------
15  *
16  * Created: H5B2private.h
17  * Jan 31 2005
18  * Quincey Koziol <koziol@ncsa.uiuc.edu>
19  *
20  * Purpose: Private header for library accessible B-tree routines.
21  *
22  *-------------------------------------------------------------------------
23  */
24 
25 #ifndef _H5B2private_H
26 #define _H5B2private_H
27 
28 /* Private headers needed by this file */
29 #include "H5ACprivate.h" /* Metadata cache */
30 #include "H5Fprivate.h" /* File access */
31 
32 /**************************/
33 /* Library Private Macros */
34 /**************************/
35 
36 
37 /****************************/
38 /* Library Private Typedefs */
39 /****************************/
40 
41 /* B-tree IDs for various internal things. */
42 typedef enum H5B2_subid_t {
43  H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
44  H5B2_FHEAP_HUGE_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects */
45  H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
46  H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
47  H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
48  H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
49  H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
50  H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */
51  H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */
52  H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */
53  H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */
54  H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */
55  H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */
56  H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
58 
59 /* Define the operator callback function pointer for H5B2_iterate() */
60 typedef int (*H5B2_operator_t)(const void *record, void *op_data);
61 
62 /* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
63 typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
64 
65 /* Define the 'modify' callback function pointer for H5B2_modify() */
66 typedef herr_t (*H5B2_modify_t)(void *record, void *op_data, hbool_t *changed);
67 
68 /* Define the 'remove' callback function pointer for H5B2_remove() & H5B2_delete() */
69 typedef herr_t (*H5B2_remove_t)(const void *record, void *op_data);
70 
71 /* Comparisons for H5B2_neighbor() call */
72 typedef enum H5B2_compare_t {
73  H5B2_COMPARE_LESS, /* Records with keys less than query value */
74  H5B2_COMPARE_GREATER /* Records with keys greater than query value */
76 
77 /*
78  * Each class of object that can be pointed to by a B-tree has a
79  * variable of this type that contains class variables and methods.
80  */
81 typedef struct H5B2_class_t H5B2_class_t;
82 struct H5B2_class_t {
83  H5B2_subid_t id; /* ID of B-tree class, as found in file */
84  const char *name; /* Name of B-tree class, for debugging */
85  size_t nrec_size; /* Size of native (memory) record */
86 
87  /* Extensible array client callback methods */
88  void *(*crt_context)(void *udata); /* Create context for other client callbacks */
89  herr_t (*dst_context)(void *ctx); /* Destroy client callback context */
90  herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */
91  herr_t (*compare)(const void *rec1, const void *rec2, int *result); /* Compare two native records */
92  herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
93  herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
94  herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
95  const void *record, const void *ctx);
96 };
97 
98 /* v2 B-tree creation parameters */
99 typedef struct H5B2_create_t {
100  const H5B2_class_t *cls; /* v2 B-tree client class */
101  uint32_t node_size; /* Size of each node (in bytes) */
102  uint32_t rrec_size; /* Size of raw record (in bytes) */
103  uint8_t split_percent; /* % full to split nodes */
104  uint8_t merge_percent; /* % full to merge nodes */
106 
107 /* v2 B-tree metadata statistics info */
108 typedef struct H5B2_stat_t {
109  unsigned depth; /* Depth of B-tree */
110  hsize_t nrecords; /* Number of records */
112 
113 /* v2 B-tree info (forward decl - defined in H5B2pkg.h) */
114 typedef struct H5B2_t H5B2_t;
115 
116 
117 /*****************************/
118 /* Library-private Variables */
119 /*****************************/
120 
121 
122 /***************************************/
123 /* Library-private Function Prototypes */
124 /***************************************/
125 H5_DLL H5B2_t *H5B2_create(H5F_t *f, const H5B2_create_t *cparam,
126  void *ctx_udata);
127 H5_DLL H5B2_t *H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata);
128 H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/);
129 H5_DLL herr_t H5B2_insert(H5B2_t *bt2, void *udata);
130 H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data);
131 H5_DLL htri_t H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data);
133  H5B2_found_t op, void *op_data);
134 H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata,
135  H5B2_found_t op, void *op_data);
136 H5_DLL herr_t H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op,
137  void *op_data);
138 H5_DLL herr_t H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op,
139  void *op_data);
140 H5_DLL herr_t H5B2_remove(H5B2_t *b2, void *udata, H5B2_remove_t op,
141  void *op_data);
143  hsize_t idx, H5B2_remove_t op, void *op_data);
144 H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec);
145 H5_DLL herr_t H5B2_size(H5B2_t *bt2, hsize_t *btree_size);
147 H5_DLL herr_t H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata,
148  H5B2_remove_t op, void *op_data);
151 
152 /* Statistics routines */
154 
155 #endif /* _H5B2private_H */
156 
H5B2_create_t
Definition: H5B2private.h:99
H5B2_create_t::cls
const H5B2_class_t * cls
Definition: H5B2private.h:100
H5B2_stat_t
struct H5B2_stat_t H5B2_stat_t
H5B2_class_t::encode
herr_t(* encode)(uint8_t *raw, const void *record, void *ctx)
Definition: H5B2private.h:92
H5B2_create
H5_DLL H5B2_t * H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata)
Definition: H5B2.c:138
f
hdr f
Definition: H5EA.c:755
H5B2_class_t::name
const char * name
Definition: H5B2private.h:84
H5B2_remove_t
herr_t(* H5B2_remove_t)(const void *record, void *op_data)
Definition: H5B2private.h:69
H5B2_class_t::debug
herr_t(* debug)(FILE *stream, int indent, int fwidth, const void *record, const void *ctx)
Definition: H5B2private.h:94
H5B2_TEST_ID
@ H5B2_TEST_ID
Definition: H5B2private.h:43
H5B2_t
Definition: H5B2pkg.h:249
H5B2_index
H5_DLL herr_t H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, void *op_data)
Definition: H5B2.c:714
uint32_t
uint32_t
Definition: H5overflow.txt:38
H5B2_stat_t::depth
unsigned depth
Definition: H5B2private.h:109
H5B2_GRP_DENSE_NAME_ID
@ H5B2_GRP_DENSE_NAME_ID
Definition: H5B2private.h:48
H5B2_subid_t
H5B2_subid_t
Definition: H5B2private.h:42
haddr_t
CATCH haddr_t
Definition: H5EAdblock.c:162
indent
*s *s indent
Definition: H5HLdbg.c:111
H5B2_class_t::id
H5B2_subid_t id
Definition: H5B2private.h:83
result
Definition: H5Ztrans.c:67
H5B2_FHEAP_HUGE_FILT_INDIR_ID
@ H5B2_FHEAP_HUGE_FILT_INDIR_ID
Definition: H5B2private.h:45
H5B2_find
H5_DLL htri_t H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data)
Definition: H5B2.c:474
H5B2_class_t::dst_context
herr_t(* dst_context)(void *ctx)
Definition: H5B2private.h:89
H5B2_create_t
struct H5B2_create_t H5B2_create_t
H5B2_delete
H5_DLL herr_t H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_data)
Definition: H5B2.c:1502
uint8_t
unsigned char uint8_t
Definition: H5private.h:429
H5B2_COMPARE_GREATER
@ H5B2_COMPARE_GREATER
Definition: H5B2private.h:74
H5B2_stat_info
H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info)
Definition: H5B2stat.c:84
H5AC_proxy_entry_t
Definition: H5ACprivate.h:203
H5B2_FHEAP_HUGE_INDIR_ID
@ H5B2_FHEAP_HUGE_INDIR_ID
Definition: H5B2private.h:44
H5B2_SOHM_INDEX_ID
@ H5B2_SOHM_INDEX_ID
Definition: H5B2private.h:50
htri_t
int htri_t
Definition: H5public.h:160
H5B2_remove
H5_DLL herr_t H5B2_remove(H5B2_t *b2, void *udata, H5B2_remove_t op, void *op_data)
Definition: H5B2.c:903
H5_iter_order_t
H5_iter_order_t
Definition: H5public.h:295
H5B2_patch_file
H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f)
Definition: H5B2.c:1613
H5B2_stat_t::nrecords
hsize_t nrecords
Definition: H5B2private.h:110
H5B2_stat_t
Definition: H5B2private.h:108
H5B2_ATTR_DENSE_CORDER_ID
@ H5B2_ATTR_DENSE_CORDER_ID
Definition: H5B2private.h:52
FILE
Invalid arguments to routine Resource unavailable Internal File accessibility Low level I O Function entry exit Object atom Object cache Links B Tree node Symbol table Heap Object header Datatype Dataspace Dataset Data storage Property lists Attribute Data filters External file list References Virtual File Layer Virtual Object Layer Ternary Search Trees Reference Counted Strings Error API Skip Lists Free Space Manager Shared Object Header Messages Extensible Array Fixed Array Plugin for dynamically loaded library Page Buffering API Context Map No error Argument errors Resource errors File accessibility errors FILE
Definition: H5err.txt:88
H5ACprivate.h
H5B2_class_t::decode
herr_t(* decode)(const uint8_t *raw, void *record, void *ctx)
Definition: H5B2private.h:93
H5B2_create_t::split_percent
uint8_t split_percent
Definition: H5B2private.h:103
H5B2_class_t::compare
herr_t(* compare)(const void *rec1, const void *rec2, int *result)
Definition: H5B2private.h:91
int
CATCH int
Definition: H5EA.c:1002
H5B2_found_t
herr_t(* H5B2_found_t)(const void *record, void *op_data)
Definition: H5B2private.h:63
H5Fprivate.h
H5B2_GRP_DENSE_CORDER_ID
@ H5B2_GRP_DENSE_CORDER_ID
Definition: H5B2private.h:49
H5B2_create_t::node_size
uint32_t node_size
Definition: H5B2private.h:101
H5B2_COMPARE_LESS
@ H5B2_COMPARE_LESS
Definition: H5B2private.h:73
H5B2_open
H5_DLL H5B2_t * H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata)
Definition: H5B2.c:209
H5B2_update
H5_DLL herr_t H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
Definition: H5B2.c:316
fwidth
*s *s fwidth
Definition: H5HLdbg.c:111
H5B2_TEST2_ID
@ H5B2_TEST2_ID
Definition: H5B2private.h:55
H5B2_CDSET_FILT_ID
@ H5B2_CDSET_FILT_ID
Definition: H5B2private.h:54
H5B2_NUM_BTREE_ID
@ H5B2_NUM_BTREE_ID
Definition: H5B2private.h:56
H5B2_CDSET_ID
@ H5B2_CDSET_ID
Definition: H5B2private.h:53
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5B2_create_t::merge_percent
uint8_t merge_percent
Definition: H5B2private.h:104
H5B2_compare_t
H5B2_compare_t
Definition: H5B2private.h:72
H5B2_modify
H5_DLL herr_t H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data)
Definition: H5B2.c:1159
H5B2_neighbor
H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
Definition: H5B2.c:1101
H5B2_iterate
H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data)
Definition: H5B2.c:423
H5B2_get_nrec
H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec)
Definition: H5B2.c:1060
H5B2_class_t::store
herr_t(* store)(void *nrecord, const void *udata)
Definition: H5B2private.h:90
H5B2_depend
H5_DLL herr_t H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent)
Definition: H5B2.c:1561
H5B2_FHEAP_HUGE_FILT_DIR_ID
@ H5B2_FHEAP_HUGE_FILT_DIR_ID
Definition: H5B2private.h:47
H5F_t
Definition: H5Fpkg.h:374
H5B2_operator_t
int(* H5B2_operator_t)(const void *record, void *op_data)
Definition: H5B2private.h:60
herr_t
int herr_t
Definition: H5public.h:128
H5B2_get_addr
H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr)
Definition: H5B2.c:388
hbool_t
bool hbool_t
Definition: H5public.h:159
H5B2_ATTR_DENSE_NAME_ID
@ H5B2_ATTR_DENSE_NAME_ID
Definition: H5B2private.h:51
hsize_t
hsize_t
Definition: H5overflow.txt:44
H5B2_class_t
Definition: H5B2private.h:82
H5B2_FHEAP_HUGE_DIR_ID
@ H5B2_FHEAP_HUGE_DIR_ID
Definition: H5B2private.h:46
H5B2_insert
H5_DLL herr_t H5B2_insert(H5B2_t *bt2, void *udata)
Definition: H5B2.c:273
H5B2_close
H5_DLL herr_t H5B2_close(H5B2_t *bt2)
Definition: H5B2.c:1393
H5B2_size
H5_DLL herr_t H5B2_size(H5B2_t *bt2, hsize_t *btree_size)
Definition: H5B2stat.c:113
H5B2_class_t::nrec_size
size_t nrec_size
Definition: H5B2private.h:85
H5B2_remove_by_idx
H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op, void *op_data)
Definition: H5B2.c:977
H5B2_create_t::rrec_size
uint32_t rrec_size
Definition: H5B2private.h:102
H5B2_modify_t
herr_t(* H5B2_modify_t)(void *record, void *op_data, hbool_t *changed)
Definition: H5B2private.h:66