|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.kahadb.page.PageFile
public class PageFile
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.MetaData
The MetaData object hold the persistent data associated with a PageFile object. |
Field Summary | |
---|---|
static int |
DEFAULT_PAGE_SIZE
|
static int |
DEFAULT_WRITE_BATCH_SIZE
|
Constructor Summary | |
---|---|
PageFile(java.io.File directory,
java.lang.String name)
Creates a PageFile in the specified directory who's data files are named by name. |
Method Summary | |
---|---|
void |
delete()
Deletes the files used by the PageFile object. |
void |
flush()
Flush and sync all write buffers to disk. |
void |
freePage(long pageId)
|
long |
getDiskSize()
|
java.io.File |
getFile()
|
java.io.File |
getFreeFile()
|
int |
getPageCacheSize()
|
int |
getPageContentSize()
|
long |
getPageCount()
|
int |
getPageSize()
|
java.io.File |
getRecoveryFile()
|
int |
getRecoveryFileMaxPageCount()
|
int |
getRecoveryFileMinPageCount()
|
int |
getWriteBatchSize()
|
boolean |
isEnableDiskSyncs()
|
boolean |
isEnabledWriteThread()
|
boolean |
isEnablePageCaching()
|
boolean |
isEnableRecoveryFile()
Is the recovery buffer used to double buffer page writes. |
boolean |
isLoaded()
|
void |
load()
Loads the page file so that it can be accessed for read/write purposes. |
void |
setEnableDiskSyncs(boolean syncWrites)
Allows you enable syncing writes to disk. |
void |
setEnablePageCaching(boolean enablePageCaching)
|
void |
setEnableRecoveryFile(boolean doubleBuffer)
Sets if the recovery buffer uses to double buffer page writes. |
void |
setEnableWriteThread(boolean enableAsyncWrites)
|
void |
setPageCacheSize(int pageCacheSize)
|
void |
setPageSize(int pageSize)
Configures the page size used by the page file. |
void |
setRecoveryFileMaxPageCount(int recoveryFileMaxPageCount)
|
void |
setRecoveryFileMinPageCount(int recoveryFileMinPageCount)
|
void |
setWriteBatchSize(int writeBatchSize)
|
java.lang.String |
toString()
|
Transaction |
tx()
|
void |
unload()
Unloads a previously loaded PageFile. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PAGE_SIZE
public static final int DEFAULT_WRITE_BATCH_SIZE
Constructor Detail |
---|
public PageFile(java.io.File directory, java.lang.String name)
directory
- name
- Method Detail |
---|
public Transaction tx()
public void delete() throws java.io.IOException
java.io.IOException
- if the files cannot be deleted.
java.lang.IllegalStateException
- if this PageFile is loadedpublic void load() throws java.io.IOException, java.lang.IllegalStateException
java.io.IOException
- If the page file cannot be loaded. This could be cause the existing page file is corrupt is a bad version or if
there was a disk error.
java.lang.IllegalStateException
- If the page file was already loaded.public void unload() throws java.io.IOException
java.io.IOException
- if there was a disk error occurred while closing the down the page file.
java.lang.IllegalStateException
- if the PageFile is not loadedpublic boolean isLoaded()
public void flush() throws java.io.IOException
java.io.IOException
- If an disk error occurred.public java.lang.String toString()
toString
in class java.lang.Object
public java.io.File getFreeFile()
public java.io.File getRecoveryFile()
public boolean isEnableRecoveryFile()
public void setEnableRecoveryFile(boolean doubleBuffer)
public boolean isEnableDiskSyncs()
public void setEnableDiskSyncs(boolean syncWrites)
syncWrites
- public int getPageSize()
public int getPageContentSize()
public void setPageSize(int pageSize) throws java.lang.IllegalStateException
pageSize
- the pageSize to set
java.lang.IllegalStateException
- once the page file is loaded.public boolean isEnablePageCaching()
public void setEnablePageCaching(boolean enablePageCaching)
allows
- you to enable read page cachingpublic int getPageCacheSize()
public void setPageCacheSize(int pageCacheSize)
Sets
- the maximum number of pages that will get stored in the read page cache.public boolean isEnabledWriteThread()
public void setEnableWriteThread(boolean enableAsyncWrites)
public long getDiskSize() throws java.io.IOException
java.io.IOException
public long getPageCount()
public int getRecoveryFileMinPageCount()
public void setRecoveryFileMinPageCount(int recoveryFileMinPageCount)
public int getRecoveryFileMaxPageCount()
public void setRecoveryFileMaxPageCount(int recoveryFileMaxPageCount)
public int getWriteBatchSize()
public void setWriteBatchSize(int writeBatchSize)
public void freePage(long pageId)
public java.io.File getFile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |