#include <bufmgr.h>
BufferMap is a wrapper class for std::unordered_map<PageId, FrameId> that maps PageIds to a Frame index in the buffer pool. Has different method names from std::unordered_map. Have get(), contains(), insert(), and remove() methods. 
◆ contains()
      
        
          | bool BufferMap::contains | ( | PageId | page_id | ) |  | 
      
 
Returns true if the map contains the given PageId, else false. 
- Precondition
- A lock is held on the map. A PageId is provided. 
- Postcondition
- Returns true if the map contains the PageId, else false. Lock is still held on the map.
- Parameters
- 
  
    | page_id | A PageId to be searched in the map. |  
 
- Returns
- bool indicating whether the given PageId exists in the BufferMap. 
 
 
◆ get()
Returns FrameId corresponding to the given PageId. 
- Precondition
- A lock is held on the map. This map contains the given PageId. 
- Postcondition
- Returns the corresponding FrameId. Lock is still held on the map.
- Parameters
- 
  
    | page_id | A PageId for which the corresponding FrameId will be returned. |  
 
- Returns
- FrameId which correspond to the given PageId.
- Exceptions
- 
  
  
 
 
◆ insert()
Inserts the pair <page_id, frame_id> into the map. 
- Precondition
- A lock is held on the map. A PageId and FrameId are provided as input. 
- Postcondition
- Adds a new <PageId, FrameId> pair to the map. If the map contains page_id, then it throws an exception. Lock is still held on the map.
- Parameters
- 
  
    | page_id | A PageId key. |  | frame_id | A FrameId value. |  
 
- Exceptions
- 
  
  
 
 
◆ remove()
      
        
          | void BufferMap::remove | ( | PageId | page_id | ) |  | 
      
 
Removes the key-value pair corresponding to the given PageId from the map. 
- Precondition
- A lock is held on the map. The given PageId is in the map. 
- Postcondition
- The key-value pair searched by page_id is removed from the map.
- Parameters
- 
  
    | page_id | The PageId key for the key-value pair to be removed. |  
 
- Exceptions
- 
  
    | PageIdNotFoundBufMgr | If page_id is not in the map. |  
 
 
 
◆ buf_map
The underlying std::unordered_map for storing the map information 
 
 
The documentation for this class was generated from the following file: