|
||||||||
| 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.
| Nested Class Summary | |
|---|---|
static class |
MVStore.Builder
A builder for an MVStore. |
| Field Summary | |
|---|---|
static boolean |
ASSERT
Whether assertions are enabled. |
| Method Summary | ||
|---|---|---|
void |
close()
Close the file and the store. |
|
long |
commit()
Commit the changes. |
|
boolean |
compact(int fillRate)
Try to reduce the file size. |
|
long |
getCommittedVersion()
Get the last committed version. |
|
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. |
|
long |
getRetainVersion()
|
|
int |
getRetentionTime()
|
|
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, without committing the changes. |
|
boolean |
isReadOnly()
|
|
static MVStore |
open(java.lang.String fileName)
Open a store in exclusive mode. |
|
|
openMap(java.lang.String name)
Open a map with the default settings. |
|
|
openMap(java.lang.String name,
MVMap.MapBuilder<M,K,V> builder)
Open a map with the given builder. |
|
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 |
setRetainVersion(long retainVersion)
Which version to retain in memory. |
|
void |
setRetentionTime(int ms)
How long to retain old, persisted chunks, in milliseconds. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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 <M extends MVMap<K,V>,K,V> M openMap(java.lang.String name,
MVMap.MapBuilder<M,K,V> builder)
K - the key typeV - the value typename - the name of the mapbuilder - the map builder
public MVMap<java.lang.String,java.lang.String> getMetaMap()
It contains the following entries:
name.{name} = {mapId}
map.{mapId} = {map metadata}
root.{mapId} = {root position}
chunk.{chunkId} = {chunk metadata}
public void close()
public long incrementVersion()
public long commit()
Unless the write delay is disabled, this method does not write to the file. Instead, data is written after the delay, manually by calling the store method, when the write buffer is full, or when closing the store.
public long store()
One store operation may run at any time.
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 getRetentionTime()
public void setRetentionTime(int ms)
MVStore.getFile().force(true), however please note that
according to various tests this does not always work as expected.
This setting is not persisted.
ms - how many milliseconds to retain old chunks (0 to overwrite them
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 long getCommittedVersion()
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 boolean isReadOnly()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||