|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.mvstore.MVStore
public class MVStore
A persistent storage for maps.
| Field Summary | |
|---|---|
static boolean |
ASSERT
Whether assertions are enabled. |
| Method Summary | ||
|---|---|---|
void |
close()
Close the file. |
|
boolean |
compact(int fillRate)
Try to reduce the file size. |
|
long |
getCurrentVersion()
Get the current version of the data. |
|
java.nio.channels.FileChannel |
getFile()
Get the file instance in use, if a file is used. |
|
java.util.Map<java.lang.String,java.lang.String> |
getFileHeader()
Get the file header. |
|
java.lang.String |
getFileName()
Get the file name, or null for in-memory stores. |
|
int |
getFileReadCount()
Get the number of file read operations since this store was opened. |
|
int |
getFileWriteCount()
Get the number of file write operations since this store was opened. |
|
MVMap<java.lang.String,java.lang.String> |
getMetaMap()
Get the metadata map. |
|
int |
getPageSize()
Get the page size, in bytes. |
|
int |
getRetainChunk()
|
|
long |
getRetainVersion()
|
|
boolean |
getReuseSpace()
|
|
int |
getStoreVersion()
Get the store version. |
|
int |
getUnsavedPageCount()
Get the estimated number of unsaved pages. |
|
boolean |
hasUnsavedChanges()
Check whether there are any unsaved changes. |
|
long |
incrementVersion()
Increment the current version. |
|
static MVStore |
open(java.lang.String fileName)
Open a store in exclusive mode. |
|
|
openMap(java.lang.String name)
Open a map with the previous key and value type (if the map already exists), or Object if not. |
|
|
openMap(java.lang.String name,
java.lang.Class<K> keyClass,
java.lang.Class<V> valueClass)
Open a map. |
|
|
openMap(java.lang.String name,
T template)
Open a map using the given template. |
|
void |
rollbackTo(long version)
Revert to the beginning of the given version. |
|
void |
setPageSize(int pageSize)
Set the amount of memory a page should contain at most, in bytes. |
|
void |
setRetainChunk(int retainChunk)
Which chunk to retain. |
|
void |
setRetainVersion(long retainVersion)
Which version to retain. |
|
void |
setReuseSpace(boolean reuseSpace)
Whether empty space in the file should be re-used. |
|
void |
setStoreVersion(int version)
Update the store version. |
|
long |
store()
Commit all changes and persist them to disk. |
|
java.lang.String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final boolean ASSERT
| Method Detail |
|---|
public static MVStore open(java.lang.String fileName)
fileName - the file name (null for in-memory)
public <K,V> MVMap<K,V> openMap(java.lang.String name)
K - the key typeV - the value typename - the name of the map
public <K,V> MVMap<K,V> openMap(java.lang.String name,
java.lang.Class<K> keyClass,
java.lang.Class<V> valueClass)
K - the key typeV - the value typename - the name of the mapkeyClass - the key classvalueClass - the value class
public <T extends MVMap<K,V>,K,V> T openMap(java.lang.String name,
T template)
T - the map typename - the name of the maptemplate - the template map
public MVMap<java.lang.String,java.lang.String> getMetaMap()
It contains the following entries:
map.{name} = {map metadata}
root.{mapId} = {root position}
chunk.{chunkId} = {chunk metadata}
public void close()
public long incrementVersion()
public long store()
public boolean hasUnsavedChanges()
public boolean compact(int fillRate)
fillRate - the minimum percentage of live entries
public void setPageSize(int pageSize)
pageSize - the page sizepublic int getPageSize()
public boolean getReuseSpace()
public void setReuseSpace(boolean reuseSpace)
This setting is specially useful for online backup. To create an online backup, disable this setting, then copy the file (starting at the beginning of the file). In this case, concurrent backup and write operations are possible (obviously the backup process needs to be faster than the write operations).
reuseSpace - the new valuepublic int getRetainChunk()
public void setRetainChunk(int retainChunk)
This setting is not persisted.
retainChunk - the earliest chunk to retain (0 to retain all chunks,
-1 to re-use space as early as possible)public void setRetainVersion(long retainVersion)
retainVersion - the oldest version to retainpublic long getRetainVersion()
public int getUnsavedPageCount()
public int getStoreVersion()
public void setStoreVersion(int version)
version - the new store versionpublic void rollbackTo(long version)
version - the version to revert topublic long getCurrentVersion()
public int getFileWriteCount()
public int getFileReadCount()
public java.lang.String getFileName()
public java.util.Map<java.lang.String,java.lang.String> getFileHeader()
public java.nio.channels.FileChannel getFile()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||