Package org.h2.mvstore
Class SingleFileStore
- java.lang.Object
-
- org.h2.mvstore.FileStore<SFChunk>
-
- org.h2.mvstore.RandomAccessStore
-
- org.h2.mvstore.SingleFileStore
-
public class SingleFileStore extends RandomAccessStore
The default storage mechanism of the MVStore. This implementation persists data to a file. The file store is responsible to persist data and for free space management.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.h2.mvstore.FileStore
FileStore.PageSerializationManager
-
-
Field Summary
-
Fields inherited from class org.h2.mvstore.RandomAccessStore
freeSpace
-
Fields inherited from class org.h2.mvstore.FileStore
lastChunk, META_ID_KEY, PIPE_LENGTH, readBytes, readCount, recoveryMode, saveChunkLock, storeHeader, writeBytes, writeCount
-
-
Constructor Summary
Constructors Constructor Description SingleFileStore(java.util.Map<java.lang.String,java.lang.Object> config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackup(java.util.zip.ZipOutputStream out)voidclose()Close this store.static java.lang.StringcorrectFileName(java.lang.String f)Fix the file name, replacing backslash with slash.SingleFileStoreopen(java.lang.String fileName, boolean readOnly)voidopen(java.lang.String fileName, boolean readOnly, char[] encryptionKey)Try to open the file.java.nio.ByteBufferreadFully(SFChunk chunk, long pos, int len)Read data from the store.voidsync()Flush all changes.java.lang.StringtoString()voidtruncate(long size)Truncate the file.protected voidwriteFully(SFChunk chunk, long pos, java.nio.ByteBuffer src)Write to the file.-
Methods inherited from class org.h2.mvstore.RandomAccessStore
adjustStoreToLastChunk, allocateChunkSpace, clear, compactMoveChunks, compactStore, createChunk, createChunk, createChunk, doHousekeeping, free, freeChunkSpace, getFillRate, getMovePriority, getRewriteCandidates, initializeStoreHeader, isSpaceReused, markUsed, readStoreHeader, setReuseSpace, shouldSaveNow, shrinkStoreIfPossible, validateFileLength, writeChunk, writeCleanShutdownMark
-
Methods inherited from class org.h2.mvstore.FileStore
accountForRemovedPage, bind, compact, compactStore, deregisterMapRoot, discoverChunk, dropUnusedChunks, executeFileStoreOperation, findLastChunkWithCompleteValidChunkSet, getAutoCommitDelay, getAutoCompactFillRate, getCacheHitRatio, getCacheSize, getCacheSizeUsed, getChunks, getChunksFillRate, getChunksFromLayoutMap, getCreationTime, getDefaultRetentionTime, getFileName, getLayoutMap, getMaxPageSize, getMetaMapId, getMvStore, getReadBytes, getReadCount, getRetentionTime, getRootPos, getStoreHeader, getTocCacheHitRatio, getWriteBuffer, getWriteCount, hasChangesSince, hasPersistentData, init, initializeCommonHeaderAttributes, isIdle, isKnownVersion, isReadOnly, isRegularMap, lastChunkVersion, populateInfo, processCommonHeaderAttributes, readChunkFooter, readChunkHeaderAndFooter, readChunkHeaderOptionally, readChunkHeaderOptionally, readFully, registerDeadChunk, releaseWriteBuffer, rewriteChunks, rollbackTo, saveChunkMetadataChanges, setAutoCommitDelay, setCacheSize, setLastChunk, setRetentionTime, setSize, size, start, stop, store, submitOrRun, writeCleanShutdown
-
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readFully
public java.nio.ByteBuffer readFully(SFChunk chunk, long pos, int len)
Description copied from class:FileStoreRead data from the store.
-
writeFully
protected void writeFully(SFChunk chunk, long pos, java.nio.ByteBuffer src)
Description copied from class:FileStoreWrite to the file.- Specified by:
writeFullyin classFileStore<SFChunk>- Parameters:
chunk- to writepos- the write positionsrc- the source buffer
-
open
public void open(java.lang.String fileName, boolean readOnly, char[] encryptionKey)Try to open the file.
-
open
public SingleFileStore open(java.lang.String fileName, boolean readOnly)
-
truncate
public void truncate(long size)
Truncate the file.- Specified by:
truncatein classRandomAccessStore- Parameters:
size- the new file size
-
backup
public void backup(java.util.zip.ZipOutputStream out) throws java.io.IOException
-
correctFileName
public static java.lang.String correctFileName(java.lang.String f)
Fix the file name, replacing backslash with slash.- Parameters:
f- the file name- Returns:
- the corrected file name
-
-