diff --git a/newbrt/Makefile b/newbrt/Makefile index 0b1c17fd44e..1fee7492d4b 100644 --- a/newbrt/Makefile +++ b/newbrt/Makefile @@ -69,7 +69,6 @@ check: bins $(DTOOL) ./brt-test $(DTOOL) ./hashtest ./benchmark-test --valsize 256 --verify 1 -# ./mdict-test check-fanout: let BRT_FANOUT=4; \ @@ -95,13 +94,11 @@ log.o: log_header.h log-internal.h log.h wbuf.h crc.h brttypes.h $(BRT_INTERNAL_ brt-test.o brt.o: brt.h ../include/db.h hashtable.h pma.h brttypes.h cachetable.h memory.h brt-serialize-test.o: $(BRT_INTERNAL_H_INCLUDES) brt.o: $(BRT_INTERNAL_H_INCLUDES) key.h log_header.h -mdict.o: pma.h hashtable.o: hashtable.h brttypes.h memory.h key.h yerror.h ../include/db.h hashfun.h memory.o: memory.h primes.o: primes.h hashtest: hashtable.o memory.o primes.o brt-serialize.o: $(BRT_INTERNAL_H_INCLUDES) key.h wbuf.h rbuf.h -mdict-test: hashtable.o pma.o memory.o brt-bigtest: memory.o ybt.o brt.o pma.o cachetable.o key.o hashtable.o brt-serialize.o brt-bigtest.o: brt.h ../include/db.h log-test: log.o memory.o diff --git a/newbrt/mdict-test.c b/newbrt/mdict-test.c deleted file mode 100644 index dfc0b82fc4d..00000000000 --- a/newbrt/mdict-test.c +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- mode: C; c-basic-offset: 4 -*- */ -#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." - -#include "mdict.h" -#include -#include -#include -#include - -void verify_mdict_instance (bytevec kv_v, ITEMLEN kl, bytevec dv_v, ITEMLEN dl, - int N, int *data, char *saw) { - char *kv = (char*)kv_v; - char *dv = (char*)dv_v; - int num, k; - assert(kv[0]=='k'); - assert(dv[0]=='d'); - assert(strcmp(kv+1, dv+1)==0); - assert(strlen(kv)+1==kl); - assert(strlen(dv)+1==dl); - num = atoi(kv+1); - for (k=0; kpma); - if (r==0) { - *mdict = result; - } - return r; -} - -void mdict_free (MDICT m) { - toku_pma_free(m->pma); - my_free(m); -} - -int mdict_n_entries (MDICT m) { - return toku_pma_n_entries(m->pma); -} - - -/* Returns an error if the key is already present. */ -/* The values returned should not be modified. */ -/* May damage the cursor. */ -int mdict_insert (MDICT m, bytevec key, ITEMLEN keylen, bytevec data, ITEMLEN datalen) { - return toku_pma_insert(m->pma, key, keylen, data, datalen); -} -/* This returns an error if the key is NOT present. */ -int mdict_replace (MDICT, bytevec key, ITEMLEN keylen, bytevec data, ITEMLEN datalen); -/* This returns an error if the key is NOT present. */ -int mdict_delete (MDICT m, bytevec key, ITEMLEN keylen) { - return toku_pma_delete(m->pma, key, keylen); -} - -/* Exposes internals of the MDICT by returning a pointer to the guts. - * Don't modify the returned data. Don't free it. */ -int mdict_lookup (MDICT m, bytevec key, ITEMLEN keylen, bytevec*data, ITEMLEN *datalen) { - return toku_pma_lookup(m->pma, key, keylen, data, datalen); -} - - -int mdict_random_pick(MDICT m, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen) { - return toku_pma_random_pick(m->pma, key, keylen, data, datalen); -} - -void mdict_iterate (MDICT m, void(*f)(bytevec,ITEMLEN,bytevec,ITEMLEN, void*), void*v) { - toku_pma_iterate(m->pma, f, v); -} - - -#else -foo -#endif diff --git a/newbrt/mdict.h b/newbrt/mdict.h deleted file mode 100644 index 3054033a8ea..00000000000 --- a/newbrt/mdict.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef MDICT_H -#define MDICT_H - -#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved." - -#include "brttypes.h" - -//#define USEPMA -#define USEHASH - -int toku_keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len); - -#ifdef USEPMA - -#include "pma.h" -#define MDICT PMA -#define MDICT_OK PMA_OK -#define MDICT_NOTFOUND PMA_NOTFOUND -#define mdict_free toku_pma_free -#define mdict_n_entries toku_pma_n_entries -#define MDICT_ITERATE PMA_ITERATE -#define mdict_insert toku_pma_insert -#define mdict_create pma_create -#define mdict_delete pma_delete -#define mdict_lookup toku_pma_lookup -#define mdict_random_pick toku_pma_random_pick -#define mdict_iterate pma_iterate - -#elif defined(USEHASH) -#include "hashtable.h" -#define MDICT HASHTABLE -#define MDICT_OK 0 -#define MDICT_NOTFOUND -1 -#define MDICT_ALREADY_THERE -2 -#define mdict_free hashtable_free -#define mdict_n_entries hashtable_n_entries -#define MDICT_ITERATE HASHTABLE_ITERATE -#define mdict_insert hash_insert -#define mdict_create hashtable_create -#define mdict_delete hash_delete -#define mdict_lookup hash_find -#define mdict_random_pick hashtable_random_pick -#define mdict_iterate hashtable_iterate -#define mdict_find_last hashtable_find_last - -#else -/* In-memory dictionary. */ - - -enum mdict_errors { MDICT_OK=0, MDICT_NOTFOUND = -1, MDICT_ALREADY_THERE = -2 }; - -typedef struct mdict *MDICT; - -int mdict_create (MDICT*); -void mdict_free (MDICT); - -int mdict_n_entries (MDICT); - -/* Returns an error if the key is already present. */ -/* The values returned should not be modified. */ -/* May damage the cursor. */ -int mdict_insert (MDICT, bytevec key, ITEMLEN keylen, bytevec data, ITEMLEN datalen); -/* This returns an error if the key is NOT present. */ -int mdict_replace (MDICT, bytevec key, ITEMLEN keylen, bytevec data, ITEMLEN datalen); -/* This returns an error if the key is NOT present. */ -int mdict_delete (MDICT, bytevec key, ITEMLEN keylen); - -/* Exposes internals of the MDICT by returning a pointer to the guts. - * Don't modify the returned data. Don't free it. */ -int mdict_lookup (MDICT, bytevec key, ITEMLEN keylen, bytevec*data, ITEMLEN *datalen); - - -int mdict_random_pick(MDICT, bytevec *key, ITEMLEN *keylen, bytevec *data, ITEMLEN *datalen); - -void mdict_iterate (MDICT, void(*)(bytevec,ITEMLEN,bytevec,ITEMLEN, void*), void*); - -#define MDICT_ITERATE(table,keyvar,keylenvar,datavar,datalenvar,body) ({ \ - void __do_iterate(bytevec keyvar, ITEMLEN keylenvar, bytevec datavar, ITEMLEN datalenvar, void *__ignore __attribute__((__unused__))) { \ - body; \ - } \ - mdict_iterate(table,__do_iterate, 0); \ -}) - -#endif -#endif