Multiple AVLs with bloom filters (very raw test version)
This commit is contained in:
35
src/obiavl.h
35
src/obiavl.h
@ -25,6 +25,10 @@
|
||||
#include "obidms.h"
|
||||
#include "obitypes.h"
|
||||
|
||||
#include "bloom.h"
|
||||
|
||||
#define NB_OF_AVLS (64)
|
||||
#define MASK (63)
|
||||
|
||||
#define AVL_MAX_NAME (1024) /**< The maximum length of an AVL tree name.
|
||||
*/
|
||||
@ -39,6 +43,8 @@
|
||||
#define BYTE_ARRAY_HEADER_SIZE (9) /**< The size of the header of a byte array.
|
||||
*/
|
||||
|
||||
typedef struct bloom bloom_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief AVL tree node structure.
|
||||
@ -48,7 +54,7 @@ typedef struct AVL_node {
|
||||
*/
|
||||
index_t right_child; /**< Index of right greater child node.
|
||||
*/
|
||||
int8_t balance_factor; /**< Balance factor of the node.
|
||||
int8_t balance_factor; /**< Balance factor of the node.
|
||||
*/
|
||||
index_t value; /**< Index of the value associated with the node in the data array.
|
||||
*/
|
||||
@ -103,6 +109,7 @@ typedef struct OBIDMS_avl_header {
|
||||
*/
|
||||
time_t creation_date; /**< Date of creation of the file.
|
||||
*/
|
||||
bloom_t bloom_filter;
|
||||
} OBIDMS_avl_header_t, *OBIDMS_avl_header_p;
|
||||
|
||||
|
||||
@ -132,9 +139,28 @@ typedef struct OBIDMS_avl {
|
||||
*/
|
||||
size_t counter; /**< Indicates by how many threads/programs (TODO) the AVL tree is used.
|
||||
*/
|
||||
int avl_fd;
|
||||
int data_fd;
|
||||
} OBIDMS_avl_t, *OBIDMS_avl_p;
|
||||
|
||||
|
||||
/**
|
||||
* @brief OBIDMS AVL tree group structure.
|
||||
*/
|
||||
typedef struct OBIDMS_avl_group {
|
||||
// TODO put each group in a directory later
|
||||
OBIDMS_avl_p sub_avls[64]; // TODO macro for max
|
||||
int current_avl_idx;
|
||||
char avl_name[AVL_MAX_NAME+1];
|
||||
OBIDMS_p dms;
|
||||
} OBIDMS_avl_group_t, *OBIDMS_avl_group_p;
|
||||
|
||||
|
||||
OBIDMS_avl_group_p obi_create_avl_group(OBIDMS_p dms, const char* avl_name);
|
||||
index_t insert_in_avl_group(OBIDMS_avl_group_p avl_group, byte_t* value);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Checks if an AVL tree already exists or not.
|
||||
*
|
||||
@ -340,12 +366,5 @@ byte_t* obi_seq_to_obibytes(char* seq);
|
||||
const char* obi_obibytes_to_seq(byte_t* value_b);
|
||||
|
||||
|
||||
OBIDMS_avl_p* obi_create_avl_in_64_parts(OBIDMS_p dms, const char* avl_name);
|
||||
|
||||
typedef uint8_t crc;
|
||||
|
||||
crc compute_crc(const char* s);
|
||||
|
||||
|
||||
#endif /* OBIAVL_H_ */
|
||||
|
||||
|
Reference in New Issue
Block a user