Home » activemq-parent-5.3.1-source-release » org.apache.kahadb.page » [javadoc | source]
public class: PageFile [javadoc | source]
A PageFile provides you random access to fixed sized disk pages. This object is not thread safe and therefore access to it should be externally synchronized. The file has 3 parts: Metadata Space: 4k : Reserved metadata area. Used to store persistent config about the file. Recovery Buffer Space: Page Size * 1000 : This is a redo log used to prevent partial page writes from making the file inconsistent Page Space: The pages in the page file.
Nested Class Summary:
static class  PageFile.PageWrite  Use to keep track of updated pages which have not yet been committed. 
public static class  PageFile.MetaData  The MetaData object hold the persistent data associated with a PageFile object. 
Field Summary
public static final  int DEFAULT_PAGE_SIZE     
public static final  int DEFAULT_WRITE_BATCH_SIZE     
 int writeBatchSize     
 public PageFile(File directory,
    String name) 
    Creates a PageFile in the specified directory who's data files are named by name.
    directory -
    name -
Method from org.apache.kahadb.page.PageFile Summary:
addToCache,   allocate,   assertLoaded,   assertNotLoaded,   delete,   flush,   freePage,   getDiskSize,   getFile,   getFreeFile,   getFromCache,   getNextWriteTransactionId,   getPageCacheSize,   getPageContentSize,   getPageCount,   getPageSize,   getRecoveryFile,   getRecoveryFileMaxPageCount,   getRecoveryFileMinPageCount,   getWriteBatchSize,   isEnableDiskSyncs,   isEnablePageCaching,   isEnableRecoveryFile,   isEnabledWriteThread,   isLoaded,   load,   readPage,   removeFromCache,   setEnableDiskSyncs,   setEnablePageCaching,   setEnableRecoveryFile,   setEnableWriteThread,   setPageCacheSize,   setPageSize,   setRecoveryFileMaxPageCount,   setRecoveryFileMinPageCount,   setWriteBatchSize,   toString,   tx,   unload,   write
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.kahadb.page.PageFile Detail:
  void addToCache(Page page) 
 Page<T> allocate(int count) throws IOException 
    Allocates a block of free pages that you can write data to.
  void assertLoaded() throws IllegalStateException 
  void assertNotLoaded() throws IllegalStateException 
 public  void delete() throws IOException 
    Deletes the files used by the PageFile object. This method can only be used when this object is not loaded.
 public  void flush() throws IOException 
    Flush and sync all write buffers to disk.
 public  void freePage(long pageId) 
 public long getDiskSize() throws IOException 
 public File getFile() 
 public File getFreeFile() 
 Page<T> getFromCache(long pageId) 
 long getNextWriteTransactionId() 
 public int getPageCacheSize() 
 public int getPageContentSize() 
 public long getPageCount() 
 public int getPageSize() 
 public File getRecoveryFile() 
 public int getRecoveryFileMaxPageCount() 
 public int getRecoveryFileMinPageCount() 
 public int getWriteBatchSize() 
 public boolean isEnableDiskSyncs() 
 public boolean isEnablePageCaching() 
 public boolean isEnableRecoveryFile() 
    Is the recovery buffer used to double buffer page writes. Enabled by default.
 public boolean isEnabledWriteThread() 
 public boolean isLoaded() 
 public  void load() throws IOException, IllegalStateException 
    Loads the page file so that it can be accessed for read/write purposes. This allocates OS resources. If this is the first time the page file is loaded, then this creates the page file in the file system.
  void readPage(long pageId,
    byte[] data) throws IOException 
  void removeFromCache(Page page) 
 public  void setEnableDiskSyncs(boolean syncWrites) 
    Allows you enable syncing writes to disk.
 public  void setEnablePageCaching(boolean enablePageCaching) 
 public  void setEnableRecoveryFile(boolean doubleBuffer) 
    Sets if the recovery buffer uses to double buffer page writes. Enabled by default. Disabling this may potentially cause partial page writes which can lead to page file corruption.
 public  void setEnableWriteThread(boolean enableAsyncWrites) 
 public  void setPageCacheSize(int pageCacheSize) 
 public  void setPageSize(int pageSize) throws IllegalStateException 
    Configures the page size used by the page file. By default it is 4k. Once a page file is created on disk, subsequent loads of that file will use the original pageSize. Once the PageFile is loaded, this setting can no longer be changed.
 public  void setRecoveryFileMaxPageCount(int recoveryFileMaxPageCount) 
 public  void setRecoveryFileMinPageCount(int recoveryFileMinPageCount) 
 public  void setWriteBatchSize(int writeBatchSize) 
 public String toString() 
 public Transaction tx() 
 public  void unload() throws IOException 
    Unloads a previously loaded PageFile. This deallocates OS related resources like file handles. once unloaded, you can no longer use the page file to read or write Pages.
  void write(Collection<Long, PageWrite> updates) throws IOException