Package org.h2.mvstore
Class OffHeapStore
- java.lang.Object
-
- org.h2.mvstore.FileStore
-
- org.h2.mvstore.OffHeapStore
-
public class OffHeapStore extends FileStore
A storage mechanism that "persists" data in the off-heap area of the main memory.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.TreeMap<java.lang.Long,java.nio.ByteBuffer>
memory
-
Fields inherited from class org.h2.mvstore.FileStore
fileSize, freeSpace, readBytes, readCount, writeBytes, writeCount
-
-
Constructor Summary
Constructors Constructor Description OffHeapStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this store.void
free(long pos, int length)
Mark the space as free.int
getDefaultRetentionTime()
Get the default retention time for this store in milliseconds.void
open(java.lang.String fileName, boolean readOnly, char[] encryptionKey)
Try to open the file.java.nio.ByteBuffer
readFully(long pos, int len)
Read from the file.void
sync()
Flush all changes.java.lang.String
toString()
void
truncate(long size)
Truncate the file.void
writeFully(long pos, java.nio.ByteBuffer src)
Write to the file.private void
writeNewEntry(long pos, java.nio.ByteBuffer src)
-
Methods inherited from class org.h2.mvstore.FileStore
allocate, clear, getAfterLastBlock, getEncryptedFile, getFile, getFileLengthInUse, getFileName, getFillRate, getFirstFree, getMovePriority, getProjectedFillRate, getReadBytes, getReadCount, getWriteBytes, getWriteCount, isFragmented, isReadOnly, markUsed, predictAllocation, size
-
-
-
-
Method Detail
-
open
public void open(java.lang.String fileName, boolean readOnly, char[] encryptionKey)
Description copied from class:FileStore
Try to open the file.
-
readFully
public java.nio.ByteBuffer readFully(long pos, int len)
Description copied from class:FileStore
Read from the file.
-
free
public void free(long pos, int length)
Description copied from class:FileStore
Mark the space as free.
-
writeFully
public void writeFully(long pos, java.nio.ByteBuffer src)
Description copied from class:FileStore
Write to the file.- Overrides:
writeFully
in classFileStore
- Parameters:
pos
- the write positionsrc
- the source buffer
-
writeNewEntry
private void writeNewEntry(long pos, java.nio.ByteBuffer src)
-
truncate
public void truncate(long size)
Description copied from class:FileStore
Truncate the file.
-
close
public void close()
Description copied from class:FileStore
Close this store.
-
sync
public void sync()
Description copied from class:FileStore
Flush all changes.
-
getDefaultRetentionTime
public int getDefaultRetentionTime()
Description copied from class:FileStore
Get the default retention time for this store in milliseconds.- Overrides:
getDefaultRetentionTime
in classFileStore
- Returns:
- the retention time
-
-