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

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

public class FilePageStorage
extends PageStorage

PageStorage implemented via a RandomAccessFile. No PageStorage(RandomAccessFile) constructor is provided because the on-disk format is not yet stable.


Method Summary
 void close()
          close the PageStorage; invocation of any other methods after close() has undefined results
static FilePageStorage create()
          Create a new FilePageStorage; no PageStorage(RandomAccessFile) constructor is provided because the on-disk format is not yet stable.
 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
 

Method Detail

create

public static FilePageStorage create()
Create a new FilePageStorage; no PageStorage(RandomAccessFile) constructor is provided because the on-disk format is not yet stable.


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

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

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

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