8 #define LOADFACTOR 0.75
11 enum status {CLEAN, DIRTY};
13 typedef struct obj_header {
16 unsigned short version;
17 unsigned short rcount;
21 typedef struct obj_store {
25 char *top; //next available location
26 struct obj_store *next;
29 //use for hash tables, transaction records.
30 //to check oid, do object->oid
31 typedef struct obj_lnode{
34 struct obj_lnode *next;
38 typedef struct obj_addr_table {
39 unsigned int size; //number of elements, not bytes
40 obj_listnode_t *table; //this should point to an array of object lists, of the specified size
44 typedef struct hash_table {
45 obj_listnode_t **hash; // points to beginning of hash table
47 unsigned int numelements;
51 typedef struct trans_record {
52 obj_listnode_t *obj_list;
54 obj_addr_table_t *lookupTable;
57 typedef struct obj_location_lnode {
60 struct obj_location_lnode *next;
61 } obj_location_listnode_t;
64 unsigned int size; //number of elements, not bytes
65 obj_location_listnode_t *table; //this should point to an array of object lists, of the specified size
68 /* Prototypes for object store */
70 void create_objstr(unsigned int);
71 void delete_objstr(int);
72 obj_store_t *get_objstr_begin(void);
73 /* end object store */
76 /* Prototypes for object header */
78 int insertObject(obj_header_t h);
79 int getObjSize(obj_header_t h);
80 void createObject(unsigned short type);
81 /* end object header */
83 /* Prototypes for hash*/
84 void createHash(obj_addr_table_t *, int , float);
85 void resize(obj_addr_table_t * table);
86 int hashkey(unsigned int, obj_addr_table_t *);
87 void addKey(unsigned int, obj_header_t *, obj_addr_table_t *);
88 obj_header_t *findKey(unsigned int,obj_addr_table_t *);
89 int removeKey(unsigned int, obj_addr_table_t *);
94 void * allocate_size(unsigned int);
95 void initializeobj(unsigned int);
96 unsigned int getobjSize(obj_header *);
97 int insertAddr(obj_addr_table *, obj_header *);
98 int removeAddr(obj_addr_table *, unsigned int);
99 obj_header *getAddr(obj_addr_table *, unsigned int);
100 trans_record *transStart();
101 obj_header *transRead(trans_record *, unsigned int);
102 int transCommit(trans_record *);
103 int insertLocation(obj_location_table *, unsigned int, unsigned int);
104 int removeLocation(obj_location_table *, unsigned int);
105 unsigned int getLocation(obj_location_table *, unsigned int);