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$
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LLADDHASH_H__
|
|
|
|
#define __LLADDHASH_H__
|
|
|
|
|
|
|
|
#include <lladd/operations.h>
|
|
|
|
|
|
|
|
#define MAX_LLADDHASHES 1000
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
recordid store;
|
2004-07-06 01:22:18 +00:00
|
|
|
int keylen;
|
|
|
|
long datlen;
|
2004-06-24 21:10:31 +00:00
|
|
|
recordid next;
|
|
|
|
} lladdHashItem_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int size;
|
|
|
|
recordid hashmap_record;
|
|
|
|
/* recordid store; */
|
|
|
|
int store;
|
|
|
|
lladdHashItem_t *iterItem;
|
|
|
|
unsigned int iterIndex;
|
|
|
|
void *iterData;
|
|
|
|
recordid* hashmap;
|
|
|
|
} lladdHash_t;
|
|
|
|
|
|
|
|
/** Allocate a new hash */
|
|
|
|
|
|
|
|
lladdHash_t * lHtCreate(int xid, int size);
|
|
|
|
int lHtValid(int xid, lladdHash_t *ht);
|
2004-07-06 01:22:18 +00:00
|
|
|
int lHtLookup( int xid, lladdHash_t *ht, const void *key, int keylen, void *buf );
|
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);
|
|
|
|
int lHtDelete(int xid, lladdHash_t *ht);
|
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
|
|
|
/* These two are the only ones that result in a log entry... */
|
|
|
|
/*
|
2004-07-06 01:22:18 +00:00
|
|
|
int _lHtInsert(int xid, lladdHash_t *ht, const void *key, int keylen, void * dat, long datlen);
|
|
|
|
int _lHtRemove( int xid, lladdHash_t *ht, const void *key, int keylen, void *buf );
|
2004-06-24 21:10:31 +00:00
|
|
|
*/
|
|
|
|
|
2004-07-06 01:22:18 +00:00
|
|
|
int lHtInsert(int xid, lladdHash_t *ht, const void *key, int keylen, void * dat, long datlen);
|
|
|
|
int lHtRemove( int xid, lladdHash_t *ht, const void *key, int keylen, void *buf, long buflen);
|
2004-06-24 21:10:31 +00:00
|
|
|
|
|
|
|
Operation getLHInsert();
|
|
|
|
Operation getLHRemove();
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|