all naive linear hash methods now start with TnaiveHash; removed references to ThashAlloc from documentation

This commit is contained in:
Sears Russell 2008-11-03 21:42:42 +00:00
parent 3c4c4f0916
commit 2c2c603dd2
8 changed files with 23 additions and 22 deletions

View file

@ -20,7 +20,7 @@ int main(int argc, char** argv) {
int xid = Tbegin();
recordid hash = ThashAlloc(xid, sizeof(int), sizeof(int));
recordid hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int));
Tcommit(xid);

View file

@ -43,7 +43,7 @@ int main(int argc, char** argv) {
Tinit();
int xid = Tbegin();
hash = ThashAlloc(xid, sizeof(int), sizeof(int));
hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int));
Tcommit(xid);

View file

@ -12,7 +12,7 @@ int main (int argc, char ** argv) {
if(TrecordType(xid, ROOT_RECORD) == INVALID_SLOT) {
// ThashAlloc() will work here as well.
// ThashCreate() will work here as well.
rootEntry = Talloc(xid, sizeof(int));
assert(ROOT_RECORD.page == rootEntry.page);

View file

@ -355,7 +355,7 @@ int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * buck
return found;
}
recordid ThashAlloc(int xid, int keySize, int valSize) {
recordid TnaiveHashCreate(int xid, int keySize, int valSize) {
/* Want 16 buckets, doubling on overflow. */
recordid rid = TarrayListAlloc(xid, 4096, 2, sizeof(hashEntry) + keySize + valSize);
assert(rid.size == sizeof(hashEntry) + keySize + valSize);
@ -405,11 +405,11 @@ recordid ThashAlloc(int xid, int keySize, int valSize) {
return rid;
}
void ThashInit() {
void TnaiveHashInit() {
openHashes = pblHtCreate();
}
void ThashDeinit() {
void TnaiveHashDeinit() {
pblHtDelete(openHashes);
}
@ -461,7 +461,7 @@ int TnaiveHashDelete(int xid, recordid hashRid,
return ret;
}
int ThashOpen(int xid, recordid hashRid, int keySize, int valSize) {
int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize) {
recordid * headerRidB = malloc(sizeof(recordid) + keySize + valSize);
hashRid.slot = 1;
Tread(xid, hashRid, headerRidB);
@ -478,7 +478,7 @@ void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void *
}
int ThashClose(int xid, recordid hashRid) {
int TnaiveHashClose(int xid, recordid hashRid) {
recordid * freeMe = pblHtLookup(openHashes, &(hashRid.page), sizeof(hashRid.page));
pblHtRemove(openHashes, &(hashRid.page), sizeof(hashRid.page));
free(freeMe);

View file

@ -211,7 +211,7 @@ int Tinit() {
pageOperationsInit();
initNestedTopActions();
TallocInit();
ThashInit();
TnaiveHashInit();
LinearHashNTAInit();
LinkedListNTAInit();
iterator_init();
@ -420,7 +420,7 @@ int Tdeinit() {
}
assert( numActiveXactions == 0 );
truncationDeinit();
ThashDeinit();
TnaiveHashDeinit();
TallocDeinit();
deinitNestedTopActions();
bufDeinit();
@ -445,7 +445,7 @@ int TuncleanShutdown() {
// and active transactions get rolled back.
stasis_suppress_unclean_shutdown_warnings = 1;
truncationDeinit();
ThashDeinit();
TnaiveHashDeinit();
simulateBufferManagerCrash();
if(slow_pfile) {
slow_close(slow_pfile);

View file

@ -57,9 +57,9 @@ compensated_function int ThashLookup(int xid, recordid hash, const byte* key, in
overloaded, and is subject to change. If the iterator is run to completion,
it is automatically freed. Otherwise, it should be manually freed with free().
@param xid transaction id
@param hash the recordid returned by ThashAlloc
@param keySize the same as the value passed into ThashAlloc.
@param valueSize the same as the value passed into ThashAlloc
@param hash the recordid returned by ThashCreate()
@param keySize the same as the value passed into ThashCreate()
@param valueSize the same as the value passed into ThashCreate()
@deprecated @see interator.h. Use the linearHash implementation of that interface instead.
*/
lladd_hash_iterator * ThashIterator(int xid, recordid hash, int keySize, int valueSize);

View file

@ -15,7 +15,7 @@
recordid ThashAlloc(int xid, int keySize, int valSize) ;
recordid TnaiveHashCreate(int xid, int keySize, int valSize) ;
void TnaiveHashInsert(int xid, recordid hashRid,
void * key, int keySize,
@ -24,8 +24,8 @@ int TnaiveHashDelete(int xid, recordid hashRid,
void * key, int keySize, int valSize);
void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void * val, int valSize);
int TnaiveHashLookup(int xid, recordid hashRid, void * key, int keySize, void * buf, int valSize);
void ThashInit();
void ThashDeinit();
int ThashOpen(int xid, recordid hashRid, int keySize, int valSize);
int ThashClose(int xid, recordid hashRid) ;
void TnaiveHashInit();
void TnaiveHashDeinit();
int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize);
int TnaiveHashClose(int xid, recordid hashRid) ;
#endif

View file

@ -71,7 +71,7 @@ START_TEST(simpleLinearHashTest)
int xid = Tbegin();
recordid hashRoot = ThashAlloc(xid, sizeof(int), sizeof(recordid));
recordid hashRoot = TnaiveHashCreate(xid, sizeof(int), sizeof(recordid));
for(int i = 0; i < NUM_ENTRIES; i++) {
recordid rid;
@ -192,7 +192,7 @@ START_TEST(transactionalLinearHashTest)
// printf("%d %d %ld\n", foo.page, foo.slot, foo.size);
recordid hashRoot = ThashAlloc(xid, sizeof(int), sizeof(recordid));
recordid hashRoot = TnaiveHashCreate(xid, sizeof(int), sizeof(recordid));
// printf("%d %d %ld", hashRoot.page, hashRoot.slot, hashRoot.size);
@ -241,7 +241,7 @@ START_TEST(transactionalLinearHashTest)
if(TdurabilityLevel() == VOLATILE) return;
Tinit();
xid = Tbegin();
ThashOpen(xid, hashRoot, sizeof(int), sizeof(recordid));
TnaiveHashOpen(xid, hashRoot, sizeof(int), sizeof(recordid));
for(i = 0; i < NUM_ENTRIES_XACT; i++) {
if(!(i%10)) {
recordid theVal;
@ -254,6 +254,7 @@ START_TEST(transactionalLinearHashTest)
assert(!TnaiveHashLookup(xid, hashRoot, &i, sizeof(int), &theVal, sizeof(recordid)));
}
}
TnaiveHashClose(xid, hsahRoot);
Tabort(xid);
Tdeinit();