00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef __HASH_OPS_H
00010 #define __HASH_OPS_H
00011 
00012 #include "global.h"
00013 #include <db.h>
00014 
00025 typedef struct hash_s *hash_t;
00027 struct hash_s
00028 {
00031     GDBM_FILE db;
00036     
00037 
00038     GDBM_FILE to_delete;
00040     char *filename;
00041 };
00042 
00043 
00044 
00047 int hsh__new(char *wcfile, char *name, int gdbm_mode, 
00048         hash_t *hash);
00052 #define HASH_TEMPORARY ((GDBM_NEWDB | GDBM_READER | \
00053             GDBM_WRCREAT | GDBM_WRITER) +1)
00054 
00056 #define HASH_REMEMBER_FILENAME (0x40000000)
00057 
00061 #define HASH__LIST_MAX (32)
00062 
00065 int hsh__insert_pointer(hash_t hash, datum key, void* value);
00066 
00067 
00070 int hsh__list_get(hash_t hash, 
00071         datum current_key, datum *next_key, 
00072         struct estat **arr[], int *found);
00082 int hsh__store_charp(hash_t db, char *key, char *value);
00084 int hsh__store(hash_t db, datum key, datum value);
00087 int hsh__fetch(hash_t db, datum key, datum *value);
00088 
00090 int hsh__first(hash_t db, datum *key);
00092 int hsh__next(hash_t db, datum *key, const datum *oldkey);
00093 
00095 int hsh__register_delete(hash_t db, datum key);
00096 
00098 int hsh__close(hash_t db, int has_failed);
00100 int hsh__collect_garbage(hash_t db, int *did_remove);
00104 #endif
00105