#ifndef _DB_HASH_H_
#define _DB_HASH_H_
#if defined(__cplusplus)
extern "C" {
#endif
typedef struct hash_t {
db_pgno_t meta_pgno;
u_int32_t revision;
u_int32_t h_ffactor;
u_int32_t h_nelem;
u_int32_t (*h_hash) __P((DB *, const void *, u_int32_t));
int (*h_compare) __P((DB *, const DBT *, const DBT *));
} HASH;
typedef struct cursor_t {
__DBC_INTERNAL
DB_LOCK hlock;
HMETA *hdr;
PAGE *split_buf;
db_pgno_t bucket;
db_pgno_t lbucket;
db_indx_t dup_off;
db_indx_t dup_len;
db_indx_t dup_tlen;
u_int32_t seek_size;
db_pgno_t seek_found_page;
db_indx_t seek_found_indx;
u_int32_t order;
#define H_CONTINUE 0x0001
#define H_CONTRACT 0x0002
#define H_DELETED 0x0004
#define H_DUPONLY 0x0008
#define H_EXPAND 0x0010
#define H_ISDUP 0x0020
#define H_NEXT_NODUP 0x0040
#define H_NOMORE 0x0080
#define H_OK 0x0100
u_int32_t flags;
} HASH_CURSOR;
#define CHARKEY "%$sniglet^&"
#define BS_TO_PAGE(bucket, spares) \
((bucket) + (spares)[__db_log2((bucket) + 1)])
#define BUCKET_TO_PAGE(I, B) (BS_TO_PAGE((B), (I)->hdr->spares))
#define MINFILL 4
#define ISBIG(I, N) (((N) > ((I)->hdr->dbmeta.pagesize / MINFILL)) ? 1 : 0)
#define NDX_INVALID 0xFFFF
#define BUCKET_INVALID 0xFFFFFFFF
#define DUP_SIZE(len) ((len) + 2 * sizeof(db_indx_t))
#define PAIR_KEYMASK 0x1
#define PAIR_DATAMASK 0x2
#define PAIR_DUPMASK 0x4
#define PAIR_MASK 0xf
#define PAIR_ISKEYBIG(N) (N & PAIR_KEYMASK)
#define PAIR_ISDATABIG(N) (N & PAIR_DATAMASK)
#define PAIR_ISDATADUP(N) (N & PAIR_DUPMASK)
#define OPCODE_OF(N) (N & ~PAIR_MASK)
#define PUTPAIR 0x20
#define DELPAIR 0x30
#define PUTOVFL 0x40
#define DELOVFL 0x50
#define HASH_UNUSED1 0x60
#define HASH_UNUSED2 0x70
#define SPLITOLD 0x80
#define SPLITNEW 0x90
#define SORTPAGE 0x100
#define HAM_DEL_NO_CURSOR 0x01
#define HAM_DEL_NO_RECLAIM 0x02
#define HAM_DEL_IGNORE_OFFPAGE 0x04
typedef enum {
DB_HAM_CURADJ_DEL = 1,
DB_HAM_CURADJ_ADD = 2,
DB_HAM_CURADJ_ADDMOD = 3,
DB_HAM_CURADJ_DELMOD = 4
} db_ham_curadj;
typedef enum {
DB_HAM_CHGPG = 1,
DB_HAM_DELFIRSTPG = 2,
DB_HAM_DELMIDPG = 3,
DB_HAM_DELLASTPG = 4,
DB_HAM_DUP = 5,
DB_HAM_SPLIT = 6
} db_ham_mode;
#if defined(__cplusplus)
}
#endif
#include "dbinc_auto/hash_auto.h"
#include "dbinc_auto/hash_ext.h"
#include "dbinc/db_am.h"
#endif