H5B2private.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*-------------------------------------------------------------------------
00017  *
00018  * Created:             H5B2private.h
00019  *                      Jan 31 2005
00020  *                      Quincey Koziol <koziol@ncsa.uiuc.edu>
00021  *
00022  * Purpose:             Private header for library accessible B-tree routines.
00023  *
00024  *-------------------------------------------------------------------------
00025  */
00026 
00027 #ifndef _H5B2private_H
00028 #define _H5B2private_H
00029 
00030 /* Include package's public header */
00031 #include "H5B2public.h"
00032 
00033 /* Private headers needed by this file */
00034 #include "H5Fprivate.h"         /* File access                          */
00035 
00036 /**************************/
00037 /* Library Private Macros */
00038 /**************************/
00039 
00040 
00041 /****************************/
00042 /* Library Private Typedefs */
00043 /****************************/
00044 
00045 /* B-tree IDs for various internal things. */
00046 typedef enum H5B2_subid_t {
00047     H5B2_TEST_ID         = 0,   /* B-tree is for testing (do not use for actual data) */
00048     H5B2_FHEAP_HUGE_INDIR_ID,   /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects */
00049     H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
00050     H5B2_FHEAP_HUGE_DIR_ID,     /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
00051     H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
00052     H5B2_GRP_DENSE_NAME_ID,     /* B-tree is for indexing 'name' field for "dense" link storage in groups */
00053     H5B2_GRP_DENSE_CORDER_ID,   /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
00054     H5B2_SOHM_INDEX_ID,         /* B-tree is an index for shared object header messages */
00055     H5B2_ATTR_DENSE_NAME_ID,    /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */
00056     H5B2_ATTR_DENSE_CORDER_ID,  /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */
00057     H5B2_NUM_BTREE_ID           /* Number of B-tree IDs (must be last)  */
00058 } H5B2_subid_t;
00059 
00060 /* Define the operator callback function pointer for H5B2_iterate() */
00061 typedef int (*H5B2_operator_t)(const void *record, void *op_data);
00062 
00063 /* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
00064 typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
00065 
00066 /* Define the 'modify' callback function pointer for H5B2_modify() */
00067 typedef herr_t (*H5B2_modify_t)(void *record, void *op_data, hbool_t *changed);
00068 
00069 /* Define the 'remove' callback function pointer for H5B2_remove() & H5B2_delete() */
00070 typedef herr_t (*H5B2_remove_t)(const void *record, void *op_data);
00071 
00072 /* Comparisons for H5B2_neighbor() call */
00073 typedef enum H5B2_compare_t {
00074     H5B2_COMPARE_LESS,            /* Records with keys less than query value */
00075     H5B2_COMPARE_GREATER          /* Records with keys greater than query value */
00076 } H5B2_compare_t;
00077 
00078 /*
00079  * Each class of object that can be pointed to by a B-tree has a
00080  * variable of this type that contains class variables and methods.
00081  */
00082 typedef struct H5B2_class_t H5B2_class_t;
00083 struct H5B2_class_t {
00084     H5B2_subid_t id;            /* ID of B-tree class, as found in file */
00085     size_t nrec_size;           /* Size of native (memory) record */
00086 
00087     /* Store & retrieve record from application to B-tree 'native' form */
00088     herr_t (*store)(void *nrecord, const void *udata);                  /*  Store record in native record table */
00089     herr_t (*retrieve)(void *udata, const void *nrecord);               /*  Retrieve record in native record table */
00090 
00091     /* Compare records, according to a key */
00092     herr_t (*compare)(const void *rec1, const void *rec2);              /*  Compare two native records */
00093 
00094     /* Encode & decode record values */
00095     herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /*  Encode record from native form to disk storage form */
00096     herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /*  Decode record from disk storage form to native form */
00097 
00098     /* Debug record values */
00099     herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id,        /* Print a record for debugging */
00100         int indent, int fwidth, const void *record,
00101         const void *udata);
00102 };
00103 
00104 /* v2 B-tree metadata statistics info */
00105 typedef struct H5B2_stat_t {
00106     unsigned depth;             /* Depth of B-tree */
00107     hsize_t nrecords;          /* Number of records */
00108 } H5B2_stat_t;
00109 
00110 /*****************************/
00111 /* Library-private Variables */
00112 /*****************************/
00113 
00114 /***************************************/
00115 /* Library-private Function Prototypes */
00116 /***************************************/
00117 H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00118     size_t node_size, size_t rrec_size,
00119     unsigned split_percent, unsigned merge_percent,
00120     haddr_t *addr_p);
00121 H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00122     haddr_t addr, void *udata);
00123 H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00124     haddr_t addr, H5B2_operator_t op, void *op_data);
00125 H5_DLL herr_t H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00126     haddr_t addr, hsize_t *op_data);
00127 H5_DLL htri_t H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00128     haddr_t addr, void *udata, H5B2_found_t op, void *op_data);
00129 H5_DLL herr_t H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00130     haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
00131     void *op_data);
00132 H5_DLL herr_t H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00133     haddr_t addr, H5B2_compare_t comp, void *udata, H5B2_found_t op,
00134     void *op_data);
00135 H5_DLL herr_t H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00136     haddr_t addr, void *udata, H5B2_modify_t op, void *op_data);
00137 H5_DLL herr_t H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00138     haddr_t addr, void *udata, H5B2_remove_t op, void *op_data);
00139 H5_DLL herr_t H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00140     haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
00141     void *op_data);
00142 H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00143     haddr_t addr, hsize_t *nrec);
00144 H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00145     haddr_t addr, H5B2_remove_t op, void *op_data);
00146 
00147 /* Statistics routines */
00148 H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
00149     haddr_t addr, H5B2_stat_t *info);
00150 
00151 #endif /* _H5B2private_H */
00152