global
Class AbstractBufMgrReplacer

java.lang.Object
  extended byglobal.AbstractBufMgrReplacer
All Implemented Interfaces:
GlobalConst
Direct Known Subclasses:
Replacer

public abstract class AbstractBufMgrReplacer
extends java.lang.Object
implements GlobalConst

A super class for buffer pool replacement algorithm. It describes which frame to be picked up for replacement by a certain replace algorithm.


Field Summary
static int Available
           
static int Pinned
           
static int Referenced
           
 
Fields inherited from interface global.GlobalConst
INVALID_PAGE, MAX_NAME, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, NUMBUF, PAGE_SIZE, PAGESIZE
 
Constructor Summary
AbstractBufMgrReplacer()
           
AbstractBufMgrReplacer(AbstractBufMgr javamgr)
          Creates a replacer object.
 
Method Summary
abstract  void free(int frameNo)
          Frees and unpins a page in the buffer pool.
abstract  int getNumUnpinnedBuffers()
          Counts the unpinned frames (free frames) in the buffer pool.
abstract  java.lang.String name()
          Retruns the name of the replacer algorithm.
abstract  int pick_victim()
          Must pin the returned frame.
abstract  void pin(int frameNo)
          Pins a candidate page in the buffer pool.
 void setBufferManager(AbstractBufMgr mgrArg)
          Sets the buffer manager to be eqaul to the buffer manager in the argument, gets the total number of buffer frames, and mainstains the head of the clock.
abstract  boolean unpin(int frameNo)
          Unpins a page in the buffer pool.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Available

public static final int Available
See Also:
Constant Field Values

Referenced

public static final int Referenced
See Also:
Constant Field Values

Pinned

public static final int Pinned
See Also:
Constant Field Values
Constructor Detail

AbstractBufMgrReplacer

public AbstractBufMgrReplacer()

AbstractBufMgrReplacer

public AbstractBufMgrReplacer(AbstractBufMgr javamgr)
Creates a replacer object.

Method Detail

pin

public abstract void pin(int frameNo)
                  throws InvalidFrameNumberException
Pins a candidate page in the buffer pool.

Parameters:
frameNo - frame number of the page.
Returns:
true if successful.
Throws:
InvalidFrameNumberException - if the frame number is less than zero or bigger than number of buffers.

unpin

public abstract boolean unpin(int frameNo)
                       throws InvalidFrameNumberException,
                              PageUnpinnedException
Unpins a page in the buffer pool.

Parameters:
frameNo - frame number of the page.
Returns:
true if successful.
Throws:
InvalidFrameNumberException - if the frame number is less than zero or bigger than number of buffers.
PageUnpinnedException - if the page is originally unpinned.

free

public abstract void free(int frameNo)
                   throws PagePinnedException
Frees and unpins a page in the buffer pool.

Parameters:
frameNo - frame number of the page.
Throws:
PagePinnedException - if the page is pinned.

pick_victim

public abstract int pick_victim()
                         throws BufferPoolExceededException,
                                PagePinnedException
Must pin the returned frame.

Throws:
BufferPoolExceededException
PagePinnedException

name

public abstract java.lang.String name()
Retruns the name of the replacer algorithm.


getNumUnpinnedBuffers

public abstract int getNumUnpinnedBuffers()
Counts the unpinned frames (free frames) in the buffer pool.


setBufferManager

public void setBufferManager(AbstractBufMgr mgrArg)
Sets the buffer manager to be eqaul to the buffer manager in the argument, gets the total number of buffer frames, and mainstains the head of the clock.