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

java.lang.Object
  extended by com.sun.electric.database.geometry.btree.PageStorage
      extended by com.sun.electric.database.geometry.btree.OverflowPageStorage

public class OverflowPageStorage
extends PageStorage

Combines two PageStorage objects, using the first until the "high water mark" is exceeded, then moving to the other. Generally the first PageStorage is "small but fast" and the second is "large but slow". Might not be thread-safe.


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

Constructor Detail

OverflowPageStorage

public OverflowPageStorage(PageStorage ps1,
                           PageStorage ps2,
                           long highWaterMark)
Note that highWaterMark is in BYTES, not pages

Method Detail

getNumPages

public int getNumPages()
Description copied from class: PageStorage
returns the number of pages; all pageids strictly less than this are valid

Specified by:
getNumPages in class PageStorage

createPage

public int createPage()
Description copied from class: PageStorage
creates a new page with undefined contents; returns its pageid

Specified by:
createPage in class PageStorage

fsync

public void fsync(int pageid)
Description copied from class: PageStorage
ensure that the designated page is written to nonvolatile storage

Specified by:
fsync in class PageStorage

fsync

public void fsync()
Description copied from class: PageStorage
ensure that the all pages are written to nonvolatile storage

Specified by:
fsync in class PageStorage

writePage

public void writePage(int pageid,
                      byte[] buf,
                      int ofs)
Description copied from class: PageStorage
writes a page; throws an exception if the page did not exist

Specified by:
writePage in class PageStorage

readPage

public void readPage(int pageid,
                     byte[] buf,
                     int ofs)
Description copied from class: PageStorage
reads a page

Specified by:
readPage in class PageStorage

close

public void close()
Description copied from class: PageStorage
close the PageStorage; invocation of any other methods after close() has undefined results

Specified by:
close in class PageStorage