|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.mvstore.FileStore
public class FileStore
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.
Field Summary | |
---|---|
protected java.nio.channels.FileChannel |
encryptedFile
The encrypted file (if encryption is used). |
protected java.nio.channels.FileChannel |
file
The file. |
protected java.nio.channels.FileLock |
fileLock
The file lock. |
protected java.lang.String |
fileName
The file name. |
protected long |
fileSize
The file size (cached). |
protected FreeSpaceBitSet |
freeSpace
The free spaces between the chunks. |
protected long |
readBytes
The number of read bytes. |
protected long |
readCount
The number of read operations. |
protected boolean |
readOnly
Whether this store is read-only. |
protected long |
writeBytes
The number of written bytes. |
protected long |
writeCount
The number of write operations. |
Constructor Summary | |
---|---|
FileStore()
|
Method Summary | |
---|---|
long |
allocate(int length)
Allocate a number of blocks and mark them as used. |
void |
clear()
Mark the file as empty. |
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. |
java.nio.channels.FileChannel |
getEncryptedFile()
Get the encrypted file instance, if encryption is used. |
java.nio.channels.FileChannel |
getFile()
Get the file instance in use. |
int |
getFillRate()
|
long |
getReadBytes()
Get the number of read bytes since this store was opened. |
long |
getReadCount()
Get the number of read operations since this store was opened. |
long |
getWriteBytes()
Get the number of written bytes since this store was opened. |
long |
getWriteCount()
Get the number of write operations since this store was opened. |
boolean |
isReadOnly()
|
void |
markUsed(long pos,
int length)
Mark the space as in use. |
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. |
long |
size()
Get the file size. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected long readCount
protected long readBytes
protected long writeCount
protected long writeBytes
protected final FreeSpaceBitSet freeSpace
protected java.lang.String fileName
protected boolean readOnly
protected long fileSize
protected java.nio.channels.FileChannel file
protected java.nio.channels.FileChannel encryptedFile
protected java.nio.channels.FileLock fileLock
Constructor Detail |
---|
public FileStore()
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public java.nio.ByteBuffer readFully(long pos, int len)
pos
- the write positionlen
- the number of bytes to read
public void writeFully(long pos, java.nio.ByteBuffer src)
pos
- the write positionsrc
- the source bufferpublic void open(java.lang.String fileName, boolean readOnly, char[] encryptionKey)
fileName
- the file namereadOnly
- whether the file should only be opened in read-only mode,
even if the file is writableencryptionKey
- the encryption key, or null if encryption is not
usedpublic void close()
public void sync()
public long size()
public void truncate(long size)
size
- the new file sizepublic java.nio.channels.FileChannel getFile()
The application may read from the file (for example for online backup), but not write to it or truncate it.
public java.nio.channels.FileChannel getEncryptedFile()
The application may read from the file (for example for online backup), but not write to it or truncate it.
public long getWriteCount()
public long getWriteBytes()
public long getReadCount()
public long getReadBytes()
public boolean isReadOnly()
public int getDefaultRetentionTime()
public void markUsed(long pos, int length)
pos
- the position in byteslength
- the number of bytespublic long allocate(int length)
length
- the number of bytes to allocate
public void free(long pos, int length)
pos
- the position in byteslength
- the number of bytespublic int getFillRate()
public void clear()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |