diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/H5X.c | 8 | ||||
-rw-r--r-- | src/H5Xfastbit.c | 312 | ||||
-rw-r--r-- | src/H5Xpkg.h | 9 | ||||
-rw-r--r-- | src/Makefile.am | 2 |
5 files changed, 332 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 776df04..4abcb3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -662,6 +662,12 @@ IF (HDF5_ENABLE_EFF) ${HDF5_SRC_DIR}/H5Xalacrity.c ) ENDIF (ALACRITY_FOUND) + IF (FASTBIT_FOUND) + set (H5FF_SRCS + ${H5FF_SRCS} + ${HDF5_SRC_DIR}/H5Xfastbit.c + ) + ENDIF (FASTBIT_FOUND) ENDIF (HDF5_ENABLE_INDEXING) set (H5FF_HDRS ${HDF5_SRC_DIR}/H5ASpublic.h @@ -129,13 +129,15 @@ H5X_init_interface(void) FUNC_ENTER_NOAPI_NOINIT -//#ifdef H5_HAVE_INDEX_PLUGIN_DUMMY if (H5X_register(H5X_DUMMY) < 0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register dummy index plugin"); -//#endif /* H5_HAVE_INDEX_PLUGIN_DUMMY */ #ifdef H5_HAVE_ALACRITY if (H5X_register(H5X_ALACRITY) < 0) - HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register alacrity index plugin"); + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register ALACRITY index plugin"); +#endif +#ifdef H5_HAVE_FASTBIT + if (H5X_register(H5X_FASTBIT) < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register FastBit index plugin"); #endif done: diff --git a/src/H5Xfastbit.c b/src/H5Xfastbit.c new file mode 100644 index 0000000..8fdbad9 --- /dev/null +++ b/src/H5Xfastbit.c @@ -0,0 +1,312 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Alacrity index routines. + */ + +/****************/ +/* Module Setup */ +/****************/ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Xprivate.h" /* Index */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" +#include "H5FFprivate.h" +#include "H5RCprivate.h" +#include "H5TRprivate.h" +#include "H5Qprivate.h" +#include "H5VMprivate.h" +#include "H5Sprivate.h" +/* TODO using private headers but could use public ones */ + +#ifdef H5_HAVE_FASTBIT +/** + * Header file that defines an in-memory C API for accessing the querying + * functionality of FastBit IBIS implementation. It is primarily for + * in memory data. + */ +#include <iapi.h> + +/****************/ +/* Local Macros */ +/****************/ +#define H5X_FASTBIT_DEBUG + +#ifdef H5X_FASTBIT_DEBUG +#define H5X_FASTBIT_LOG_DEBUG(...) do { \ + fprintf(stdout, " # %s(): ", __func__); \ + fprintf(stdout, __VA_ARGS__); \ + fprintf(stdout, "\n"); \ + fflush(stdout); \ + } while (0) +#else +#define H5X_FASTBIT_LOG_DEBUG +#endif + +/******************/ +/* Local Typedefs */ +/******************/ +typedef struct H5X_fastbit_t { + void *private_metadata; /* Internal metadata */ + + hid_t opaque_type_id; /* Datatype used for index datasets */ + hid_t metadata_id; /* Array for metadata */ + hid_t index_id; /* Array for index data */ +} H5X_fastbit_t; + +/********************/ +/* Local Prototypes */ +/********************/ + +static void * +H5X_fastbit_create(hid_t file_id, hid_t dataset_id, hid_t xcpl_id, + hid_t xapl_id, size_t *metadata_size, void **metadata); + +static herr_t +H5X_fastbit_remove(hid_t file_id, hid_t dataset_id, size_t metadata_size, + void *metadata); + +static void * +H5X_fastbit_open(hid_t file_id, hid_t dataset_id, hid_t xapl_id, + size_t metadata_size, void *metadata); + +static herr_t +H5X_fastbit_close(void *idx_handle); + +static herr_t +H5X_fastbit_pre_update(void *idx_handle, hid_t dataspace_id, hid_t xxpl_id); + +static herr_t +H5X_fastbit_post_update(void *idx_handle, const void *buf, hid_t dataspace_id, + hid_t xxpl_id); + +static herr_t +H5X_fastbit_query(void *idx_handle, hid_t query_id, hid_t xxpl_id, + hid_t *dataspace_id); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Alacrity index class */ +const H5X_class_t H5X_FASTBIT[1] = {{ + H5X_CLASS_T_VERS, /* (From the H5Xpublic.h header file) */ + H5X_PLUGIN_FASTBIT, /* (Or whatever number is assigned) */ + "FASTBIT index plugin", /* Whatever name desired */ + H5X_TYPE_DATA_ELEM, /* This plugin operates on dataset elements */ + H5X_fastbit_create, /* create */ + H5X_fastbit_remove, /* remove */ + H5X_fastbit_open, /* open */ + H5X_fastbit_close, /* close */ + H5X_fastbit_pre_update, /* pre_update */ + H5X_fastbit_post_update, /* post_update */ + H5X_fastbit_query /* query */ +}}; + + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_create + * + * Purpose: This function creates a new instance of a FASTBIT plugin index. + * + * Return: Success: Pointer to the new index + * Failure: NULL + * + *------------------------------------------------------------------------ + */ +static void * +H5X_fastbit_create(hid_t file_id, hid_t dataset_id, hid_t UNUSED xcpl_id, + hid_t xapl_id, size_t *metadata_size, void **metadata) +{ + H5X_fastbit_t *fastbit = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + H5X_FASTBIT_LOG_DEBUG("Enter"); + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_create() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_remove + * + * Purpose: This function removes the FASTBIT plugin index from the file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5X_fastbit_remove(hid_t UNUSED file_id, hid_t UNUSED dataset_id, + size_t UNUSED metadata_size, void UNUSED *metadata) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + H5X_FASTBIT_LOG_DEBUG("Enter"); + + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_remove() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_open + * + * Purpose: This function opens an already existing FASTBIT index from a file. + * + * Return: Success: Pointer to the index + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +static void * +H5X_fastbit_open(hid_t file_id, hid_t dataset_id, hid_t xapl_id, + size_t metadata_size, void *metadata) +{ + H5X_fastbit_t *fastbit = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + H5X_FASTBIT_LOG_DEBUG("Enter"); + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_open() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_close + * + * Purpose: This function closes an FASTBIT index. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5X_fastbit_close(void *idx_handle) +{ + H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + H5X_FASTBIT_LOG_DEBUG("Enter"); + + if (NULL == fastbit) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle"); + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_close() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_pre_update + * + * Purpose: This function does a pre_update of indexing information. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5X_fastbit_pre_update(void *idx_handle, hid_t UNUSED dataspace_id, hid_t UNUSED xxpl_id) +{ + H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + H5X_FASTBIT_LOG_DEBUG("Enter"); + + if (NULL == fastbit) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle"); + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_pre_update() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_post_update + * + * Purpose: This function does a post_update of indexing information. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5X_fastbit_post_update(void *idx_handle, const void UNUSED *buf, + hid_t UNUSED dataspace_id, hid_t UNUSED xxpl_id) +{ + H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + H5X_FASTBIT_LOG_DEBUG("Calling H5X_fastbit_post_update"); + + if (NULL == fastbit) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle"); + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_post_update() */ + +/*------------------------------------------------------------------------- + * Function: H5X_fastbit_query + * + * Purpose: This function retrieves indexing information that matches + * the query and returns results under the form of a dataspace ID. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5X_fastbit_query(void *idx_handle, hid_t query_id, hid_t xxpl_id, + hid_t *dataspace_id) +{ + H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + H5X_FASTBIT_LOG_DEBUG("Enter"); + + +done: + H5X_FASTBIT_LOG_DEBUG("Leave"); + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5X_fastbit_query() */ + +#endif /* H5_HAVE_FASTBIT */ diff --git a/src/H5Xpkg.h b/src/H5Xpkg.h index fc3cfc8..04f7385 100644 --- a/src/H5Xpkg.h +++ b/src/H5Xpkg.h @@ -28,10 +28,17 @@ H5_DLLVAR const H5X_class_t H5X_DUMMY[1]; /* - * Alacrity plugin + * ALACRITY plugin */ #ifdef H5_HAVE_ALACRITY H5_DLLVAR const H5X_class_t H5X_ALACRITY[1]; #endif +/* + * FastBit plugin + */ +#ifdef H5_HAVE_FASTBIT +H5_DLLVAR const H5X_class_t H5X_FASTBIT[1]; +#endif + #endif /* _H5Xpkg_H */ diff --git a/src/Makefile.am b/src/Makefile.am index feb9518..051ba37 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,7 +90,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Osdspace.c H5Oshared.c H5Ostab.c \ H5Oshmesg.c H5Otest.c H5Ounknown.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ - H5Pxapl.c H5Pxcpl.c H5Pxxpl.c H5X.c H5Xdummy.c H5Xalacrity.c \ + H5Pxapl.c H5Pxcpl.c H5Pxxpl.c H5X.c H5Xdummy.c H5Xalacrity.c H5Xfastbit.c \ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ H5Pgcpl.c H5Pvcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \ |