neustore.base
Class DBPage

java.lang.Object
  extended by neustore.base.DBPage
Direct Known Subclasses:
HeapFilePage, NaiveHeapFilePage

public abstract class DBPage
extends java.lang.Object

Abstract base class for a memory-version disk page. For example, a derived class can be BTreeIndexPage. A derived class should implement the functions to read from a byte array, and to write to a byte array. A convention is that in the byte array, the first integer should be nodeType.

Author:
Tian Xia <tianxia@ccs.neu.edu>
Donghui Zhang <donghui@ccs.neu.edu>

Field Summary
 int nodeType
          The node type.
 int pageSize
          The page size.
 
Constructor Summary
DBPage(int _nodeType, int _pageSize)
          Creates a DBPage.
 
Method Summary
protected abstract  void read(byte[] page)
          Reads the object from a byte array.
protected abstract  void write(byte[] page)
          Writes the object to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeType

public int nodeType
The node type. -1 means a byte array page. 0 means an empty page. Users can define their own node types.


pageSize

public int pageSize
The page size.

Constructor Detail

DBPage

public DBPage(int _nodeType,
              int _pageSize)
Creates a DBPage.

Parameters:
_nodeType - node type
_pageSize - page size
Method Detail

read

protected abstract void read(byte[] page)
                      throws java.io.IOException
Reads the object from a byte array.

Parameters:
page -
Throws:
java.io.IOException

write

protected abstract void write(byte[] page)
                       throws java.io.IOException
Writes the object to a byte array.

Parameters:
page -
Throws:
java.io.IOException