BadgerDB
/afs/cs.wisc.edu/p/course/cs564-jignesh/public/html/projects/BadgerDB/bufmgr/src/bufHashTbl.h
00001 
00008 #pragma once
00009 
00010 #include "file.h"
00011 
00012 namespace badgerdb {
00013 
00017 struct hashBucket {
00021   File *file;
00022 
00026   PageId pageNo;
00027 
00031   FrameId frameNo;
00032 
00036   hashBucket*   next;
00037 };
00038 
00039 
00045 class BufHashTbl
00046 {
00047  private:
00051   int HTSIZE;
00055   hashBucket**  ht;
00056 
00064   int  hash(const File* file, const PageId pageNo);
00065 
00066  public:
00070   BufHashTbl(const int htSize);  // constructor
00071 
00075   ~BufHashTbl(); // destructor
00076   
00086   void insert(const File* file, const PageId pageNo, const FrameId frameNo);
00087 
00097   void lookup(const File* file, const PageId pageNo, FrameId &frameNo);
00098 
00106   void remove(const File* file, const PageId pageNo);  
00107 };
00108 
00109 }
 All Classes Namespaces Functions Variables Typedefs Friends