This repository was archived by the owner on Sep 29, 2020. It is now read-only.
forked from GiannisKatsoridas/Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.h
More file actions
38 lines (24 loc) · 1.13 KB
/
Index.h
File metadata and controls
38 lines (24 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef _INDEX_H_
#define _INDEX_H_
#include "Results.h"
#define HASH2_RANGE 10
//2nd hash function
int hash2(int32_t payload);
struct hash_index
{
int *bucket_array;
int bucket_array_sz;
int *chain;
int chain_sz;
};
typedef struct hash_index hash_index;
//create and initialize index; allocate memory for buffer array
void index_create(hash_index **indx_addr, int bucket_array_sz);
//create index for bucket of relation rel; bucket contains <tuple_amount> tuples and its last element is pointed by <bucket_end> -1 in rel
void index_fill(hash_index *indx, relation *rel, int tuple_amount, int bucket_end);
//free memory allocated for index
void index_destroy(hash_index **indx);
//given a tuple <(key, payload)>, search <payload> in the bucket pointed by <indx> of <rel>, and if equal payloads found, add <(key1, key2)> to <results>
void search_val(relation *rel, int bucket_start, hash_index *indx, int32_t key, int32_t payload, int column_id, resultsWithNum* results);
//int search_all_val(relation *x, int* x_hist, int *x_psum, relation *y, int* y_hist, int* y_psum, int bucket_id, index * indx, int column_id, result* results);
#endif