public final class MappedFileVol extends ByteBufferVol
Modifier and Type | Class and Description |
---|---|
static class |
MappedFileVol.MappedFileFactory |
Modifier and Type | Field and Description |
---|---|
static VolumeFactory |
FACTORY |
protected java.io.File |
file |
protected java.nio.channels.FileChannel |
fileChannel |
protected java.nio.channels.FileLock |
fileLock |
protected java.nio.channels.FileChannel.MapMode |
mapMode |
protected boolean |
preclearDisabled |
protected java.io.RandomAccessFile |
raf |
cleanerHackEnabled, growLock, readOnly, slices, sliceShift, sliceSize, sliceSizeModMask
closed, LOG, UNSAFE_VOL_FACTORY
Constructor and Description |
---|
MappedFileVol(java.io.File file,
boolean readOnly,
long fileLockWait,
int sliceShift,
boolean cleanerHackEnabled,
long initSize,
boolean preclearDisabled) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
ensureAvailable(long offset)
Check space allocated by Volume is bigger or equal to given offset.
|
boolean |
fileLoad()
If underlying storage is memory-mapped-file, this method will try to
load and precache all file data into disk cache.
|
java.io.File |
getFile()
returns underlying file if it exists
|
boolean |
getFileLocked()
return true if this Volume holds exclusive lock over its file
|
boolean |
isReadOnly() |
long |
length() |
void |
sync() |
void |
truncate(long size) |
clear, copyTo, getByte, getData, getDataInput, getDataInputOverlap, getInt, getLong, getPackedLong, getSixLong, getSlice, getUnsignedByte, getUnsignedShort, isSliced, putByte, putData, putData, putDataOverlap, putInt, putLong, putPackedLong, putSixLong, putUnsignedByte, putUnsignedShort, sliceSize, toByte, toByte, unmap
assertZeroes, clearOverlap, copyFrom, copyTo, copyTo, deleteFile, finalize, hash, isClosed
public static final VolumeFactory FACTORY
protected final java.io.File file
protected final java.nio.channels.FileChannel fileChannel
protected final java.nio.channels.FileChannel.MapMode mapMode
protected final java.io.RandomAccessFile raf
protected final java.nio.channels.FileLock fileLock
protected final boolean preclearDisabled
public MappedFileVol(java.io.File file, boolean readOnly, long fileLockWait, int sliceShift, boolean cleanerHackEnabled, long initSize, boolean preclearDisabled)
public final void ensureAvailable(long offset)
Volume
ensureAvailable
in class Volume
public void close()
public boolean isReadOnly()
isReadOnly
in class Volume
public java.io.File getFile()
Volume
public boolean getFileLocked()
Volume
getFileLocked
in class Volume
public boolean fileLoad()
Volume
If underlying storage is memory-mapped-file, this method will try to
load and precache all file data into disk cache.
Most likely it will call MappedByteBuffer.load()
,
but could also read content of entire file etc
This method will not pin data into memory, they might be removed at any time.
Copyright © 2018. All Rights Reserved.