2004-06-24 21:10:31 +00:00
|
|
|
/**
|
|
|
|
* A durable, recoverable hashtable
|
|
|
|
* Based on Peter Graf's pblhash, <http://mission.base.com/peter/source/>
|
|
|
|
* (actually based on jbhash.c, which was based on pblhash)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
@file
|
|
|
|
|
|
|
|
A persistant hash, based on logical operations.
|
|
|
|
|
|
|
|
lladdhash: /yad-hash/ n. LLADD's hash table, based on logical operations.
|
|
|
|
|
|
|
|
@todo CORRECTNESS PROBLEM. It allows logical operations to span
|
|
|
|
more than one record, which is incompatible with our logical
|
|
|
|
operations. Also, Blob handling + LLADD hash's implementation
|
|
|
|
result in poor performance when the bucket size is large, and
|
|
|
|
transactions are short.
|
|
|
|
|
2004-07-06 20:59:36 +00:00
|
|
|
@ingroup OPERATIONS
|
|
|
|
|
2004-06-24 21:10:31 +00:00
|
|
|
$Id$
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2004-08-03 02:04:56 +00:00
|
|
|
#include <lladd/operations.h>
|
|
|
|
|
2004-06-24 21:10:31 +00:00
|
|
|
#ifndef __LLADDHASH_H__
|
|
|
|
#define __LLADDHASH_H__
|
|
|
|
|
2004-08-03 02:04:56 +00:00
|
|
|
int isNullRecord(recordid x);
|
2004-06-24 21:10:31 +00:00
|
|
|
|
2004-08-03 02:04:56 +00:00
|
|
|
typedef struct lladdHash_t lladdHash_t;
|
2004-06-24 21:10:31 +00:00
|
|
|
|
|
|
|
/** Allocate a new hash */
|
|
|
|
|
2004-08-03 02:04:56 +00:00
|
|
|
recordid lHtCreate(int xid, int size);
|
|
|
|
int lHtDelete(int xid, lladdHash_t *ht);
|
|
|
|
|
|
|
|
lladdHash_t * lHtOpen(int xid, recordid rid) ;
|
|
|
|
void lHtClose(int xid, lladdHash_t * lht);
|
|
|
|
int lHtValid(int xid, lladdHash_t *ht);
|
|
|
|
|
|
|
|
recordid lHtLookup( int xid, lladdHash_t *ht, const void *key, int keylen);
|
|
|
|
/**
|
|
|
|
|
|
|
|
@return ZERO_RECORDID if the entry did not already exist, the
|
|
|
|
recordid of the old value of key otherwise.
|
|
|
|
|
|
|
|
*/
|
|
|
|
recordid lHtInsert(int xid, lladdHash_t *ht, const void *key, int keylen, recordid dat);
|
|
|
|
/**
|
|
|
|
The recommended code sequence for deletion of a value is this:
|
|
|
|
|
|
|
|
recordid old = lHtRemove(xid, ht, key, keylen);
|
|
|
|
if(old != ZERO_RECORDID) { Tdealloc(xid, old); }
|
|
|
|
|
|
|
|
If you are certain that the value exists in the hashtable, then it
|
|
|
|
is safe to skip the (old != ZERO_RECORDID) check.
|
|
|
|
|
|
|
|
@return the recordid of the entry if it existed, ZERO_RECORDID otherwise.
|
|
|
|
*/
|
|
|
|
recordid lHtRemove( int xid, lladdHash_t *ht, const void *key, int keylen);
|
|
|
|
|
|
|
|
/*
|
2004-06-24 21:10:31 +00:00
|
|
|
int lHtFirst( int xid, lladdHash_t *ht, void *buf );
|
|
|
|
int lHtNext( int xid, lladdHash_t *ht, void *buf );
|
|
|
|
int lHtCurrent( int xid, lladdHash_t *ht, void *buf);
|
|
|
|
int lHtCurrentKey(int xid, lladdHash_t *ht, void *buf);
|
2004-07-06 01:22:18 +00:00
|
|
|
int lHtPosition( int xid, lladdHash_t *ht, const void *key, int key_length );
|
2004-06-24 21:10:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|