public final class MappedSequentialFileFactory extends Object implements SequentialFileFactory
Constructor and Description |
---|
MappedSequentialFileFactory(File directory) |
MappedSequentialFileFactory(File directory,
IOCriticalErrorListener criticalErrorListener) |
Modifier and Type | Method and Description |
---|---|
void |
activateBuffer(SequentialFile file) |
ByteBuffer |
allocateDirectBuffer(int size)
used for cases where you need direct buffer outside of the journal context.
|
int |
calculateBlockSize(int bytes) |
long |
chunkBytes() |
MappedSequentialFileFactory |
chunkBytes(long chunkBytes) |
void |
clearBuffer(ByteBuffer buffer) |
void |
createDirs()
Creates the directory if it does not exist yet.
|
SequentialFile |
createSequentialFile(String fileName) |
void |
deactivateBuffer() |
void |
flush() |
int |
getAlignment() |
File |
getDirectory() |
int |
getMaxIO() |
boolean |
isSupportsCallbacks() |
List<String> |
listFiles(String extension)
Lists files that end with the given extension.
|
ByteBuffer |
newBuffer(int size)
Note: You need to release the buffer if is used for reading operations.
|
void |
onIOError(Exception exception,
String message,
SequentialFile file)
The SequentialFile will call this method when a disk IO Error happens during the live phase.
|
long |
overlapBytes() |
MappedSequentialFileFactory |
overlapBytes(long overlapBytes) |
void |
releaseBuffer(ByteBuffer buffer) |
void |
releaseDirectBuffer(ByteBuffer buffer)
used for cases where you need direct buffer outside of the journal context.
|
void |
start() |
void |
stop() |
ByteBuffer |
wrapBuffer(byte[] bytes) |
public MappedSequentialFileFactory(File directory, IOCriticalErrorListener criticalErrorListener)
public MappedSequentialFileFactory(File directory)
public long chunkBytes()
public MappedSequentialFileFactory chunkBytes(long chunkBytes)
public long overlapBytes()
public MappedSequentialFileFactory overlapBytes(long overlapBytes)
public SequentialFile createSequentialFile(String fileName)
createSequentialFile
in interface SequentialFileFactory
public int getMaxIO()
getMaxIO
in interface SequentialFileFactory
public List<String> listFiles(String extension) throws Exception
SequentialFileFactory
This method inserts a ".' before the extension.
listFiles
in interface SequentialFileFactory
Exception
public boolean isSupportsCallbacks()
isSupportsCallbacks
in interface SequentialFileFactory
public void onIOError(Exception exception, String message, SequentialFile file)
SequentialFileFactory
onIOError
in interface SequentialFileFactory
public ByteBuffer allocateDirectBuffer(int size)
SequentialFileFactory
allocateDirectBuffer
in interface SequentialFileFactory
public void releaseDirectBuffer(ByteBuffer buffer)
SequentialFileFactory
releaseDirectBuffer
in interface SequentialFileFactory
public ByteBuffer newBuffer(int size)
SequentialFileFactory
newBuffer
in interface SequentialFileFactory
public void releaseBuffer(ByteBuffer buffer)
releaseBuffer
in interface SequentialFileFactory
public void activateBuffer(SequentialFile file)
activateBuffer
in interface SequentialFileFactory
public void deactivateBuffer()
deactivateBuffer
in interface SequentialFileFactory
public ByteBuffer wrapBuffer(byte[] bytes)
wrapBuffer
in interface SequentialFileFactory
public int getAlignment()
getAlignment
in interface SequentialFileFactory
public int calculateBlockSize(int bytes)
calculateBlockSize
in interface SequentialFileFactory
public File getDirectory()
getDirectory
in interface SequentialFileFactory
public void clearBuffer(ByteBuffer buffer)
clearBuffer
in interface SequentialFileFactory
public void start()
start
in interface SequentialFileFactory
public void stop()
stop
in interface SequentialFileFactory
public void createDirs() throws Exception
SequentialFileFactory
createDirs
in interface SequentialFileFactory
Exception
public void flush()
flush
in interface SequentialFileFactory
Copyright © 2016 The Apache Software Foundation. All rights reserved.