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
Nested ClassesModifier and TypeClassDescriptionprivate static interfaceprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final ReentrantLock[]static final Stringprivate final FileChannel[]private static final org.slf4j.Loggerprivate booleanprivate final RandomAccessFile[]private FileIOEngine.FileReadAccessorprivate final longprivate FileIOEngine.FileWriteAccessorFields inherited from class org.apache.hadoop.hbase.io.hfile.bucket.PersistentIOEngine
filePaths -
Constructor Summary
ConstructorsConstructorDescriptionFileIOEngine(long capacity, boolean maintainPersistence, String... filePaths) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaccessFile(FileIOEngine.FileAccessor accessor, ByteBuff buff, long globalOffset) (package private) void(package private) voidprivate longgetAbsoluteOffsetInFile(int fileNum, long globalOffset) Get the absolute offset in given file with the relative global offset.(package private) FileChannel[]private intgetFileNum(long offset) booleanFile 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) voidrefreshFileConnection(int accessFileNum, IOException ioe) voidshutdown()Close the filevoidsync()Sync the data to file after writingtoString()voidwrite(ByteBuffer srcBuffer, long offset) Transfers data from the given byte buffer to filevoidTransfers the data from the given MultiByteBuffer to IOEngineMethods inherited from class org.apache.hadoop.hbase.io.hfile.bucket.PersistentIOEngine
calculateChecksum, verifyFileIntegrityMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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- anBucketEntrywhich maintains an (offset, len, refCnt)- Returns:
- the
Cacheablewith 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:IOEngineTransfers 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
-