SwatDB
Public Member Functions | Private Attributes | Friends | List of all members
Frame Class Reference

#include <bufmgr.h>

Collaboration diagram for Frame:
Collaboration graph
[legend]

Public Member Functions

 Frame ()
 Constructor. Calls resetFrame to reset the Frame.
 
 ~Frame ()
 Destructor.
 
void resetFrame ()
 Resets the metadata of the Frame. More...
 
void loadFrame (PageId page_id)
 Updates the Frame data according to the loaded Page. More...
 

Private Attributes

PageId page_id
 
int pin_count
 
bool valid
 
bool dirty
 
bool ref_bit
 
std::mutex frame_mtx
 

Friends

class BufferManager
 

Detailed Description

Frame Class which holds metadata about corresponding Page in the buffer pool.

Member Function Documentation

◆ loadFrame()

void Frame::loadFrame ( PageId  page_id)

Updates the Frame data according to the loaded Page.

Precondition
None.
Postcondition
Frame data is updated. pin_count is set to 1, page_id is set to page_id parameter, and valid is set to true.
Parameters
page_idPageId of the Page that is loaded to the Frame

◆ resetFrame()

void Frame::resetFrame ( )

Resets the metadata of the Frame.

Precondition
None.
Postcondition
page_id is set to INVALID_PAGE_ID. pin_count is set to 0. valid, dirty, and ref_bit are all set to false.

Friends And Related Function Documentation

◆ BufferManager

friend class BufferManager
friend

BufferManager has access to private data members of each Frame.

Member Data Documentation

◆ dirty

bool Frame::dirty
private

true if the Frame is dirty. Else false.

◆ frame_mtx

std::mutex Frame::frame_mtx
private

std::mutex for synchronized access to the Page.

◆ page_id

PageId Frame::page_id
private

PageId of the Page in the Frame. Recall PageId is made up of {FileId, PageNum}.

◆ pin_count

int Frame::pin_count
private

The number of pins on the Page.

◆ ref_bit

bool Frame::ref_bit
private

Reference bit used by the clock replacement policy. Set false by default. Set to true when Page is released. Set to false during the clock algorithm before the Frame gets replaced.

◆ valid

bool Frame::valid
private

true if the Frame data is valid. Else false.


The documentation for this class was generated from the following file: