Quadcap Embeddable Database

com.quadcap.sql.file.SubPage Class Reference

Inheritance diagram for com.quadcap.sql.file.SubPage:

com.quadcap.sql.file.Page List of all members.

Detailed Description

This class implements a page allocated by a sub-page allocator.

Author:
Stan Bailes

Definition at line 51 of file SubPage.java.

Public Member Functions

 SubPage (SubPageManager pm, long pageNum) throws IOException
 Construct a new SubPage.

long getPageNum ()
 Return this page's number.

int read (int pos, byte[] pbuf, int offset, int len)
 Read a range of bytes from the page.

int write (int pos, byte[] pbuf, int offset, int len)
 Write a range of bytes to the page.

int readInt (int pos)
 Read an integer (4-byte) value from the page.

void writeInt (int pos, int val)
 Write an integer (4-byte) value to the page.

long readLong (int pos)
 Read a long (8-byte) value from the page.

void writeLong (int pos, long val)
 Write a long (8-byte) value to the page.

void takeData (Page p)
 Move the contents of the other page to this page, and zero out the other page.

void clear ()
 Zero this page.

void decrRefCount ()
 An artifact of the Cacheable interface implemented by the Block class, we need to keep track of which objects are actually being used so unused objects can be flushed from the cache to make room for new objects.

String toString ()

Package Attributes

SubPageManager pm
BlockFile file
long pageNum
int pageOffset
Block block = null


Constructor & Destructor Documentation

com.quadcap.sql.file.SubPage.SubPage SubPageManager  pm,
long  pageNum
throws IOException
 

Construct a new SubPage.

Definition at line 61 of file SubPage.java.

References com.quadcap.sql.file.SubPage.file, com.quadcap.sql.file.SubPageManager.file, com.quadcap.sql.file.BlockFile.getBlock(), com.quadcap.sql.file.SubPage.pageNum, com.quadcap.sql.file.SubPageManager.pageOffset(), and com.quadcap.sql.file.SubPage.pm.


Member Function Documentation

void com.quadcap.sql.file.SubPage.clear  ) 
 

Zero this page.

Implements com.quadcap.sql.file.Page.

Definition at line 162 of file SubPage.java.

References com.quadcap.sql.file.SubPageManager.pageSize, and com.quadcap.sql.file.SubPage.pm.

void com.quadcap.sql.file.SubPage.decrRefCount  ) 
 

An artifact of the Cacheable interface implemented by the Block class, we need to keep track of which objects are actually being used so unused objects can be flushed from the cache to make room for new objects.

At some point, we can get rid of this in favor of weak references.

Implements com.quadcap.sql.file.Page.

Definition at line 168 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, and com.quadcap.sql.file.Cacheable.decrRefCount().

long com.quadcap.sql.file.SubPage.getPageNum  ) 
 

Return this page's number.

Implements com.quadcap.sql.file.Page.

Definition at line 72 of file SubPage.java.

References com.quadcap.sql.file.SubPage.pageNum.

int com.quadcap.sql.file.SubPage.read int  pos,
byte[]  pbuf,
int  offset,
int  len
 

Read a range of bytes from the page.

Parameters:
pos the offset in the page of the first byte to read
pbuf the buffer into which the bytes are placed.
offset the offset in pbuf where the first byte is placed.
len the number of bytes to read

Implements com.quadcap.sql.file.Page.

Definition at line 85 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.read(), and com.quadcap.sql.file.SubPage.read().

Referenced by com.quadcap.sql.file.SubPage.read().

int com.quadcap.sql.file.SubPage.readInt int  pos  ) 
 

Read an integer (4-byte) value from the page.

Parameters:
pos the offset in the page of the integer.

Implements com.quadcap.sql.file.Page.

Definition at line 117 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.readInt(), and com.quadcap.sql.file.SubPage.readInt().

Referenced by com.quadcap.sql.file.SubPage.readInt().

long com.quadcap.sql.file.SubPage.readLong int  pos  ) 
 

Read a long (8-byte) value from the page.

Parameters:
pos the offset in the page of the long.

Implements com.quadcap.sql.file.Page.

Definition at line 136 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.readLong(), and com.quadcap.sql.file.SubPage.readLong().

Referenced by com.quadcap.sql.file.SubPage.readLong().

void com.quadcap.sql.file.SubPage.takeData Page  p  ) 
 

Move the contents of the other page to this page, and zero out the other page.

Implements com.quadcap.sql.file.Page.

Definition at line 154 of file SubPage.java.

References com.quadcap.sql.file.SubPageManager.pageSize, com.quadcap.sql.file.SubPage.pm, com.quadcap.sql.file.Page.read(), com.quadcap.sql.file.SubPage.takeData(), and com.quadcap.sql.file.Page.write().

Referenced by com.quadcap.sql.file.SubPage.takeData().

String com.quadcap.sql.file.SubPage.toString  ) 
 

Definition at line 176 of file SubPage.java.

References com.quadcap.sql.file.SubPage.pageNum.

int com.quadcap.sql.file.SubPage.write int  pos,
byte[]  pbuf,
int  offset,
int  len
 

Write a range of bytes to the page.

Parameters:
pos the offset in the page of the first byte to write
pbuf the buffer from which the bytes are obtained
offset the offset in pbuf of the first byte to write
len the number of bytes to write

Implements com.quadcap.sql.file.Page.

Definition at line 103 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.write(), and com.quadcap.sql.file.SubPage.write().

Referenced by com.quadcap.sql.file.SubPage.write().

void com.quadcap.sql.file.SubPage.writeInt int  pos,
int  val
 

Write an integer (4-byte) value to the page.

Parameters:
pos the offset in the page of the integer.
val the integer value to write.

Implements com.quadcap.sql.file.Page.

Definition at line 127 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.writeInt(), and com.quadcap.sql.file.SubPage.writeInt().

Referenced by com.quadcap.sql.file.SubPage.writeInt().

void com.quadcap.sql.file.SubPage.writeLong int  pos,
long  val
 

Write a long (8-byte) value to the page.

Parameters:
pos the offset in the page of the long.
val the long value to write.

Implements com.quadcap.sql.file.Page.

Definition at line 146 of file SubPage.java.

References com.quadcap.sql.file.SubPage.block, com.quadcap.sql.file.SubPage.pageOffset, com.quadcap.sql.file.Block.writeLong(), and com.quadcap.sql.file.SubPage.writeLong().

Referenced by com.quadcap.sql.file.SubPage.writeLong().


Member Data Documentation

Block com.quadcap.sql.file.SubPage.block = null [package]
 

Definition at line 56 of file SubPage.java.

Referenced by com.quadcap.sql.file.SubPage.decrRefCount(), com.quadcap.sql.file.SubPage.read(), com.quadcap.sql.file.SubPage.readInt(), com.quadcap.sql.file.SubPage.readLong(), com.quadcap.sql.file.SubPage.write(), com.quadcap.sql.file.SubPage.writeInt(), and com.quadcap.sql.file.SubPage.writeLong().

BlockFile com.quadcap.sql.file.SubPage.file [package]
 

Definition at line 53 of file SubPage.java.

Referenced by com.quadcap.sql.file.SubPage.SubPage().

long com.quadcap.sql.file.SubPage.pageNum [package]
 

Definition at line 54 of file SubPage.java.

Referenced by com.quadcap.sql.file.SubPage.getPageNum(), com.quadcap.sql.file.SubPage.SubPage(), and com.quadcap.sql.file.SubPage.toString().

int com.quadcap.sql.file.SubPage.pageOffset [package]
 

Definition at line 55 of file SubPage.java.

Referenced by com.quadcap.sql.file.SubPage.read(), com.quadcap.sql.file.SubPage.readInt(), com.quadcap.sql.file.SubPage.readLong(), com.quadcap.sql.file.SubPage.write(), com.quadcap.sql.file.SubPage.writeInt(), and com.quadcap.sql.file.SubPage.writeLong().

SubPageManager com.quadcap.sql.file.SubPage.pm [package]
 

Definition at line 52 of file SubPage.java.

Referenced by com.quadcap.sql.file.SubPage.clear(), com.quadcap.sql.file.SubPage.SubPage(), and com.quadcap.sql.file.SubPage.takeData().