@InterfaceAudience.Private public abstract class FileMmapIOEngine extends PersistentIOEngine
| Modifier and Type | Field and Description |
|---|---|
protected ByteBufferArray |
bufferArray |
private FileChannel |
fileChannel |
(package private) static org.slf4j.Logger |
LOG |
protected String |
path |
private RandomAccessFile |
raf |
protected long |
size |
filePaths| Constructor and Description |
|---|
FileMmapIOEngine(String filePath,
long capacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isPersistent()
File IO engine is always able to support persistent storage for the cache n
|
abstract Cacheable |
read(BucketEntry be)
Transfers data from IOEngine to a Cacheable object.
|
private long |
roundUp(long n,
long to) |
void |
shutdown()
Close the file
|
void |
sync()
Sync the data to file after writing n
|
String |
toString() |
void |
write(ByteBuffer srcBuffer,
long offset)
Transfers data from the given byte buffer to file
|
void |
write(ByteBuff srcBuffer,
long offset)
Transfers the data from the given MultiByteBuffer to IOEngine
|
calculateChecksum, verifyFileIntegrityclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitusesSharedMemorystatic final org.slf4j.Logger LOG
protected long size
protected ByteBufferArray bufferArray
private final FileChannel fileChannel
private RandomAccessFile raf
public FileMmapIOEngine(String filePath, long capacity) throws IOException
IOExceptionprivate long roundUp(long n, long to)
public boolean isPersistent()
public abstract Cacheable read(BucketEntry be) throws IOException
IOEnginebe - maintains an (offset,len,refCnt) inside.IOException - when any IO error happenpublic void write(ByteBuffer srcBuffer, long offset) throws IOException
srcBuffer - the given byte buffer from which bytes are to be readoffset - The offset in the file where the first byte to be written nIOExceptionpublic void write(ByteBuff srcBuffer, long offset) throws IOException
IOEnginesrcBuffer - the given MultiBytebufffers from which bytes are to be readoffset - the offset in the IO engine where the first byte to be written nIOExceptionpublic void sync() throws IOException
IOExceptionpublic void shutdown()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.