2005-02-04 03:59:05 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Created: H5B2private.h
|
|
|
|
* Jan 31 2005
|
|
|
|
* Quincey Koziol <koziol@ncsa.uiuc.edu>
|
|
|
|
*
|
|
|
|
* Purpose: Private header for library accessible B-tree routines.
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _H5B2private_H
|
|
|
|
#define _H5B2private_H
|
|
|
|
|
|
|
|
/* Include package's public header */
|
|
|
|
#include "H5B2public.h"
|
|
|
|
|
|
|
|
/* Private headers needed by this file */
|
|
|
|
#include "H5Fprivate.h" /* File access */
|
|
|
|
|
|
|
|
/**************************/
|
|
|
|
/* Library Private Macros */
|
|
|
|
/**************************/
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2005-02-04 03:59:05 +08:00
|
|
|
/****************************/
|
|
|
|
/* Library Private Typedefs */
|
|
|
|
/****************************/
|
|
|
|
|
|
|
|
/* B-tree IDs for various internal things. */
|
|
|
|
typedef enum H5B2_subid_t {
|
2005-02-08 09:03:48 +08:00
|
|
|
H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
|
2006-08-17 23:49:06 +08:00
|
|
|
H5B2_FHEAP_HUGE_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, non-filtered 'huge' objects */
|
|
|
|
H5B2_FHEAP_HUGE_FILT_INDIR_ID, /* B-tree is for fractal heap indirectly accessed, filtered 'huge' objects */
|
|
|
|
H5B2_FHEAP_HUGE_DIR_ID, /* B-tree is for fractal heap directly accessed, non-filtered 'huge' objects */
|
|
|
|
H5B2_FHEAP_HUGE_FILT_DIR_ID, /* B-tree is for fractal heap directly accessed, filtered 'huge' objects */
|
2006-10-02 18:24:03 +08:00
|
|
|
H5B2_GRP_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" link storage in groups */
|
|
|
|
H5B2_GRP_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" link storage in groups */
|
2006-11-14 04:41:36 +08:00
|
|
|
H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */
|
2006-08-10 11:42:51 +08:00
|
|
|
H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */
|
2005-02-04 03:59:05 +08:00
|
|
|
} H5B2_subid_t;
|
|
|
|
|
2005-03-11 00:41:28 +08:00
|
|
|
/* Define the operator callback function pointer for H5B2_iterate() */
|
|
|
|
typedef int (*H5B2_operator_t)(const void *record, void *op_data);
|
|
|
|
|
2006-10-02 18:24:03 +08:00
|
|
|
/* Define the 'found' callback function pointer for H5B2_find(), H5B2_neighbor() & H5B2_index() */
|
2005-03-11 00:41:28 +08:00
|
|
|
typedef herr_t (*H5B2_found_t)(const void *record, void *op_data);
|
|
|
|
|
2005-03-11 22:05:32 +08:00
|
|
|
/* Define the 'modify' callback function pointer for H5B2_modify() */
|
|
|
|
typedef herr_t (*H5B2_modify_t)(void *record, void *op_data, hbool_t *changed);
|
|
|
|
|
2006-08-10 11:42:51 +08:00
|
|
|
/* Define the 'remove' callback function pointer for H5B2_remove() & H5B2_delete() */
|
|
|
|
typedef herr_t (*H5B2_remove_t)(const void *record, void *op_data);
|
|
|
|
|
2005-03-10 03:39:20 +08:00
|
|
|
/* Comparisons for H5B2_neighbor() call */
|
|
|
|
typedef enum H5B2_compare_t {
|
|
|
|
H5B2_COMPARE_LESS, /* Records with keys less than query value */
|
|
|
|
H5B2_COMPARE_GREATER /* Records with keys greater than query value */
|
|
|
|
} H5B2_compare_t;
|
|
|
|
|
2005-02-04 03:59:05 +08:00
|
|
|
/*
|
2006-08-10 11:42:51 +08:00
|
|
|
* Each class of object that can be pointed to by a B-tree has a
|
2005-02-04 03:59:05 +08:00
|
|
|
* variable of this type that contains class variables and methods.
|
|
|
|
*/
|
2006-08-10 11:42:51 +08:00
|
|
|
typedef struct H5B2_class_t H5B2_class_t;
|
|
|
|
struct H5B2_class_t {
|
|
|
|
H5B2_subid_t id; /* ID of B-tree class, as found in file */
|
|
|
|
size_t nrec_size; /* Size of native (memory) record */
|
2005-02-04 03:59:05 +08:00
|
|
|
|
2005-02-26 21:05:41 +08:00
|
|
|
/* Store & retrieve record from application to B-tree 'native' form */
|
2006-08-17 23:49:06 +08:00
|
|
|
herr_t (*store)(void *nrecord, const void *udata); /* Store record in native record table */
|
|
|
|
herr_t (*retrieve)(void *udata, const void *nrecord); /* Retrieve record in native record table */
|
2005-02-04 03:59:05 +08:00
|
|
|
|
|
|
|
/* Compare records, according to a key */
|
2006-08-17 23:49:06 +08:00
|
|
|
herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
|
2005-02-04 03:59:05 +08:00
|
|
|
|
2005-02-05 05:14:42 +08:00
|
|
|
/* Encode & decode record values */
|
2006-08-17 23:49:06 +08:00
|
|
|
herr_t (*encode)(const H5F_t *f, uint8_t *raw, const void *record); /* Encode record from native form to disk storage form */
|
|
|
|
herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */
|
2005-02-05 05:14:42 +08:00
|
|
|
|
|
|
|
/* Debug record values */
|
2006-08-10 11:42:51 +08:00
|
|
|
herr_t (*debug)(FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
|
2006-08-17 23:49:06 +08:00
|
|
|
int indent, int fwidth, const void *record,
|
2006-08-10 11:42:51 +08:00
|
|
|
const void *udata);
|
|
|
|
};
|
2005-02-04 03:59:05 +08:00
|
|
|
|
2006-07-16 03:49:04 +08:00
|
|
|
/* v2 B-tree metadata statistics info */
|
|
|
|
typedef struct H5B2_stat_t {
|
2006-09-05 00:37:41 +08:00
|
|
|
unsigned depth; /* Depth of B-tree */
|
2006-10-02 18:24:03 +08:00
|
|
|
hsize_t nrecords; /* Number of records */
|
2006-07-16 03:49:04 +08:00
|
|
|
} H5B2_stat_t;
|
|
|
|
|
2005-11-07 11:13:53 +08:00
|
|
|
/*****************************/
|
|
|
|
/* Library-private Variables */
|
|
|
|
/*****************************/
|
2006-06-27 22:45:06 +08:00
|
|
|
|
2005-02-04 03:59:05 +08:00
|
|
|
/***************************************/
|
|
|
|
/* Library-private Function Prototypes */
|
|
|
|
/***************************************/
|
|
|
|
H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
2005-02-11 14:50:20 +08:00
|
|
|
size_t node_size, size_t rrec_size,
|
2005-02-04 03:59:05 +08:00
|
|
|
unsigned split_percent, unsigned merge_percent,
|
|
|
|
haddr_t *addr_p);
|
|
|
|
H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, void *udata);
|
2005-02-17 08:37:04 +08:00
|
|
|
H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, H5B2_operator_t op, void *op_data);
|
2005-02-25 01:23:26 +08:00
|
|
|
H5_DLL herr_t H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, void *udata, H5B2_found_t op, void *op_data);
|
2005-02-25 05:44:30 +08:00
|
|
|
H5_DLL herr_t H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
2006-11-07 23:25:06 +08:00
|
|
|
haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
|
|
|
|
void *op_data);
|
2005-03-10 03:39:20 +08:00
|
|
|
H5_DLL herr_t H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, H5B2_compare_t comp, void *udata, H5B2_found_t op,
|
|
|
|
void *op_data);
|
2005-03-11 22:05:32 +08:00
|
|
|
H5_DLL herr_t H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, void *udata, H5B2_modify_t op, void *op_data);
|
2005-02-26 21:05:41 +08:00
|
|
|
H5_DLL herr_t H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
2006-08-10 11:42:51 +08:00
|
|
|
haddr_t addr, void *udata, H5B2_remove_t op, void *op_data);
|
2006-11-15 04:33:50 +08:00
|
|
|
H5_DLL herr_t H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
|
|
|
|
void *op_data);
|
2005-02-26 21:05:41 +08:00
|
|
|
H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, hsize_t *nrec);
|
2005-03-11 00:13:58 +08:00
|
|
|
H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
2006-08-10 11:42:51 +08:00
|
|
|
haddr_t addr, H5B2_remove_t op, void *op_data);
|
2005-02-04 03:59:05 +08:00
|
|
|
|
2006-07-16 03:49:04 +08:00
|
|
|
/* Statistics routines */
|
|
|
|
H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
|
|
|
|
haddr_t addr, H5B2_stat_t *info);
|
|
|
|
|
2005-02-04 03:59:05 +08:00
|
|
|
#endif /* _H5B2private_H */
|
|
|
|
|