SwatDB
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends | List of all members
Frame Class Reference

#include <bm_frame.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.
 
void loadFrame (PageId page_id)
 Updates the Frame data according to the loaded Page.
 

Private Attributes

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

Friends

class BufferManager
 
class ReplacementPolicy
 
class Clock
 
class Random
 
class LRU
 
class MRU
 
class ClockRandom
 

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 Symbol Documentation

◆ BufferManager

friend class BufferManager
friend

BufferManager and Policies have access to private data members of each Frame. They need direct access to Frame data fields to support synchronizing access to frames by some higher-level operations (getters/setters alone won't do it)

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.

◆ 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: