com.sun.electric.database.geometry.btree
Class PageStorage

java.lang.Object
  extended by com.sun.electric.database.geometry.btree.PageStorage
Direct Known Subclasses:
CachingPageStorage, FilePageStorage, OverflowPageStorage

public abstract class PageStorage
extends java.lang.Object

Stores and retrieves fixed-size byte sequences indexed by a page number; page numbers are guaranteed to be contiguous starting at zero.


Constructor Summary
PageStorage(int pageSize)
           
 
Method Summary
abstract  void close()
          close the PageStorage; invocation of any other methods after close() has undefined results
abstract  int createPage()
          creates a new page with undefined contents; returns its pageid
abstract  void fsync()
          ensure that the all pages are written to nonvolatile storage
abstract  void fsync(int pageid)
          ensure that the designated page is written to nonvolatile storage
abstract  int getNumPages()
          returns the number of pages; all pageids strictly less than this are valid
 int getPageSize()
          returns the size, in bytes, of each page
abstract  void readPage(int pageid, byte[] buf, int ofs)
          reads a page
abstract  void writePage(int pageid, byte[] buf, int ofs)
          writes a page; throws an exception if the page did not exist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageStorage

public PageStorage(int pageSize)
Method Detail

getPageSize

public final int getPageSize()
returns the size, in bytes, of each page


createPage

public abstract int createPage()
creates a new page with undefined contents; returns its pageid


getNumPages

public abstract int getNumPages()
returns the number of pages; all pageids strictly less than this are valid


writePage

public abstract void writePage(int pageid,
                               byte[] buf,
                               int ofs)
writes a page; throws an exception if the page did not exist


readPage

public abstract void readPage(int pageid,
                              byte[] buf,
                              int ofs)
reads a page


fsync

public abstract void fsync(int pageid)
ensure that the designated page is written to nonvolatile storage


fsync

public abstract void fsync()
ensure that the all pages are written to nonvolatile storage


close

public abstract void close()
close the PageStorage; invocation of any other methods after close() has undefined results