Quadcap Embeddable Database

com.quadcap.sql.file.Page Interface Reference

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

com.quadcap.sql.file.Block com.quadcap.sql.file.SubPage List of all members.

Detailed Description

This interface models a page of data in a block file, either a main page (aka a Block) or a sub-page.

Author:
Stan Bailes

Definition at line 47 of file Page.java.

Public Member Functions

long getPageNum ()
 Return this page's block number.

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.

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 an long (8-byte) value from the page.

void writeLong (int pos, long val)
 Write an 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.


Member Function Documentation

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

Zero this page.

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.SubPageManager.newPage(), and com.quadcap.sql.file.BlockAccess.resize().

void com.quadcap.sql.file.Page.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.

Implemented in com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.SubPageManager.allocateNewBlock(), com.quadcap.sql.file.SubPageManager.freePage(), com.quadcap.sql.file.BlockPath.getRefs(), com.quadcap.sql.file.BlockAccess.init(), com.quadcap.sql.file.SubPageManager.newPage(), com.quadcap.sql.file.BlockAccess.read(), com.quadcap.sql.file.BlockAccess.resize(), com.quadcap.sql.file.BlockPath.updatePath(), and com.quadcap.sql.file.BlockAccess.write().

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

Return this page's block number.

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

int com.quadcap.sql.file.Page.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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.SubPageManager.newPage(), com.quadcap.sql.file.BlockAccess.read(), com.quadcap.sql.file.BlockAccess.resize(), and com.quadcap.sql.file.SubPage.takeData().

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

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

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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

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

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

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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.SubPageManager.freePage(), com.quadcap.sql.file.BlockAccess.init(), com.quadcap.sql.file.SubPageManager.newPage(), and com.quadcap.sql.file.BlockAccess.resize().

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

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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

int com.quadcap.sql.file.Page.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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.BlockAccess.resize(), com.quadcap.sql.file.SubPage.takeData(), and com.quadcap.sql.file.BlockAccess.write().

void com.quadcap.sql.file.Page.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.

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

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

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

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

Implemented in com.quadcap.sql.file.Block, and com.quadcap.sql.file.SubPage.

Referenced by com.quadcap.sql.file.SubPageManager.allocateNewBlock(), com.quadcap.sql.file.SubPageManager.freePage(), com.quadcap.sql.file.BlockAccess.resize(), and com.quadcap.sql.file.BlockAccess.setBlockRef().