1 //-< HASHTAB.CPP >---------------------------------------------------*--------*
2 // GigaBASE                  Version 1.0         (c) 1999  GARRET    *     ?  *
3 // (Post Relational Database Management System)                      *   /\|  *
4 //                                                                   *  /  \  *
5 //                          Created:     20-Nov-98    K.A. Knizhnik  * / [] \ *
6 //                          Last update: 10-Dec-98    K.A. Knizhnik  * GARRET *
7 //-------------------------------------------------------------------*--------*
8 // Extensible hash table interface
9 //-------------------------------------------------------------------*--------*
10 
11 #ifndef __HASHTAB_H__
12 #define __HASHTAB_H__
13 
14 BEGIN_GIGABASE_NAMESPACE
15 
16 class dbHashTableItem {
17   public:
18     oid_t next;
19     oid_t record;
20     nat4  hash;
21 };
22 
23 const size_t dbInitHashTableSize = 16*1024-1;
24 
25 
26 class GIGABASE_DLL_ENTRY dbHashTable {
27     nat4  size;
28     nat4  used;
29     oid_t page;
30 
31     static unsigned hashCode(byte* key, int keylen);
32     static int const keySize[];
33 
34   public:
35     static oid_t allocate(dbDatabase* db, size_t nRows = 0);
36 
37     static void  insert(dbDatabase* db, oid_t hashId,
38                         oid_t rowId, int type, int offs, size_t nRows);
39 
40     static void  remove(dbDatabase* db, oid_t hashId,
41                         oid_t rowId, int type, int offs);
42 
43     static void  find(dbDatabase* db, oid_t hashId, dbSearchContext& sc);
44 
45     static void  drop(dbDatabase* db, oid_t hashId);
46 
47     static void  purge(dbDatabase* db, oid_t hashId);
48 };
49 
50 END_GIGABASE_NAMESPACE
51 
52 #endif
53