Modifier and Type | Field and Description |
---|---|
static String |
FILE_DELIMITER |
Constructor and Description |
---|
FileIOEngine(long capacity,
boolean maintainPersistence,
String... filePaths) |
Modifier and Type | Method and Description |
---|---|
boolean |
isPersistent()
File IO engine is always able to support persistent storage for the cache
|
Cacheable |
read(long offset,
int length,
CacheableDeserializer<Cacheable> deserializer)
Transfers data from file to the given byte buffer
|
void |
shutdown()
Close the file
|
void |
sync()
Sync the data to file after writing
|
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
|
public static final String FILE_DELIMITER
public FileIOEngine(long capacity, boolean maintainPersistence, String... filePaths) throws IOException
IOException
public boolean isPersistent()
isPersistent
in interface IOEngine
public Cacheable read(long offset, int length, CacheableDeserializer<Cacheable> deserializer) throws IOException
read
in interface IOEngine
offset
- The offset in the file where the first byte to be readlength
- The length of buffer that should be allocated for reading
from the file channeldeserializer
- The deserializer to be used to make a Cacheable from the data.IOException
public void write(ByteBuffer srcBuffer, long offset) throws IOException
write
in interface IOEngine
srcBuffer
- the given byte buffer from which bytes are to be readoffset
- The offset in the file where the first byte to be writtenIOException
public void sync() throws IOException
sync
in interface IOEngine
IOException
public void write(ByteBuff srcBuffer, long offset) throws IOException
IOEngine
write
in interface IOEngine
srcBuffer
- the given MultiBytebufffers from which bytes are to be readoffset
- the offset in the IO engine where the first byte to be writtenIOException
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.