Class FileIOEngine
java.lang.Object
org.apache.hadoop.hbase.io.hfile.bucket.PersistentIOEngine
org.apache.hadoop.hbase.io.hfile.bucket.FileIOEngine
- All Implemented Interfaces:
IOEngine
IO engine that stores data to a file on the local file system.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static interface
private static class
private static class
-
Field Summary
Modifier and TypeFieldDescriptionprivate final long
private final ReentrantLock[]
static final String
private final FileChannel[]
private static final org.slf4j.Logger
private boolean
private final RandomAccessFile[]
private FileIOEngine.FileReadAccessor
private final long
private FileIOEngine.FileWriteAccessor
Fields inherited from class org.apache.hadoop.hbase.io.hfile.bucket.PersistentIOEngine
filePaths
-
Constructor Summary
ConstructorDescriptionFileIOEngine
(long capacity, boolean maintainPersistence, String... filePaths) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
accessFile
(FileIOEngine.FileAccessor accessor, ByteBuff buff, long globalOffset) (package private) void
(package private) void
private long
getAbsoluteOffsetInFile
(int fileNum, long globalOffset) Get the absolute offset in given file with the relative global offset.(package private) FileChannel[]
private int
getFileNum
(long offset) boolean
File IO engine is always able to support persistent storage for the cacheread
(BucketEntry be) Transfers data from file to the given byte buffer(package private) void
refreshFileConnection
(int accessFileNum, IOException ioe) void
shutdown()
Close the filevoid
sync()
Sync the data to file after writingtoString()
void
write
(ByteBuffer srcBuffer, long offset) Transfers data from the given byte buffer to filevoid
Transfers the data from the given MultiByteBuffer to IOEngineMethods inherited from class org.apache.hadoop.hbase.io.hfile.bucket.PersistentIOEngine
calculateChecksum, verifyFileIntegrity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.io.hfile.bucket.IOEngine
usesSharedMemory
-
Field Details
-
LOG
-
FILE_DELIMITER
- See Also:
-
fileChannels
-
rafs
-
channelLocks
-
sizePerFile
-
capacity
-
maintainPersistence
-
readAccessor
-
writeAccessor
-
-
Constructor Details
-
FileIOEngine
public FileIOEngine(long capacity, boolean maintainPersistence, String... filePaths) throws IOException - Throws:
IOException
-
-
Method Details
-
toString
-
isPersistent
File IO engine is always able to support persistent storage for the cache -
read
Transfers data from file to the given byte buffer- Parameters:
be
- anBucketEntry
which maintains an (offset, len, refCnt)- Returns:
- the
Cacheable
with block data inside. - Throws:
IOException
- if any IO error happen.
-
checkCacheTime
- Throws:
IOException
-
closeFileChannels
void closeFileChannels() -
write
Transfers data from the given byte buffer to file- Parameters:
srcBuffer
- the given byte buffer from which bytes are to be readoffset
- The offset in the file where the first byte to be written- Throws:
IOException
-
sync
Sync the data to file after writing- Throws:
IOException
-
shutdown
Close the file -
write
Description copied from interface:IOEngine
Transfers the data from the given MultiByteBuffer to IOEngine- Parameters:
srcBuff
- the given MultiBytebufffers from which bytes are to be readoffset
- the offset in the IO engine where the first byte to be written- Throws:
IOException
-
accessFile
private void accessFile(FileIOEngine.FileAccessor accessor, ByteBuff buff, long globalOffset) throws IOException - Throws:
IOException
-
getAbsoluteOffsetInFile
Get the absolute offset in given file with the relative global offset.- Returns:
- the absolute offset
-
getFileNum
-
getFileChannels
-
refreshFileConnection
- Throws:
IOException
-