4 /* Need the definition of HASH. */
9 /* This is the number of bytes of the md5 to actually store in
10 * the .pag file. This number directly effects the collision
11 * rate and memory usage. You can probably set this number as
12 * low as 5 w/o problems and some sites may want to set it as
13 * high as 8. Anything higher than that is probably not useful.
14 * Note at the internal hash size isn't the only factor that
15 * effects collision rate. The table index is used as an implicit
16 * part of the hash value stored also.
20 #define DBZ_INTERNAL_HASH_SIZE 4
22 #define DBZ_INTERNAL_HASH_SIZE 6
25 typedef enum {DBZSTORE_OK, DBZSTORE_EXISTS, DBZSTORE_ERROR} DBZSTORE_RESULT;
26 typedef enum {INCORE_NO, INCORE_MEM, INCORE_MMAP} dbz_incore_val;
29 /* Whether to write to the filesystem in addition to updating the incore
30 copy. This will replace a single large write to disk when dbzsync is
33 /* Whether to do hash lookups from disk, memory or a mmap'ed file */
34 dbz_incore_val pag_incore;
35 dbz_incore_val exists_incore;
36 /* Whether dbzstore should update the database async or sync. This
37 is only applicable if you're not mmaping the database */
42 #define PACKED __attribute__ ((packed))
49 #if !defined(lint) && (defined(__SUNPRO_C) || defined(_nec_ews))
51 #endif /* nor lint, nor __SUNPRO_C, nor sgi, nor _nec_ews */
53 char hash[DBZ_INTERNAL_HASH_SIZE];
55 #if !defined(lint) && (defined(__SUNPRO_C) || defined(_nec_ews))
57 #endif /* nor lint, nor__SUNPRO_C, nor _nec_ews */
59 /* standard dbm functions */
60 extern bool dbzinit(const char *name);
61 extern bool dbzclose(void);
63 /* new stuff for dbz */
64 extern bool dbzfresh(const char *name, off_t size);
65 extern bool dbzagain(const char *name, const char *oldname);
66 extern bool dbzexists(const HASH key);
67 extern bool dbzfetch(const HASH key, off_t *value);
68 extern DBZSTORE_RESULT dbzstore(const HASH key, off_t data);
69 extern bool dbzsync(void);
70 extern long dbzsize(off_t contents);
71 extern void dbzsetoptions(const dbzoptions options);
72 extern void dbzgetoptions(dbzoptions *options);
76 #endif /* __DBZ_H__ */