public final class MappedSequentialFileFactory extends Object implements SequentialFileFactory
| 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.
|
static MappedSequentialFileFactory |
buffered(File directory,
int capacity,
int bufferSize,
int bufferTimeout,
IOCriticalErrorListener criticalErrorListener) |
int |
calculateBlockSize(int bytes) |
int |
capacity() |
MappedSequentialFileFactory |
capacity(int capacity) |
void |
clearBuffer(ByteBuffer buffer) |
void |
createDirs()
Creates the directory if it does not exist yet.
|
SequentialFile |
createSequentialFile(String fileName) |
void |
deactivateBuffer() |
MappedSequentialFileFactory |
disableBufferReuse() |
MappedSequentialFileFactory |
enableBufferReuse() |
void |
flush() |
int |
getAlignment() |
File |
getDirectory() |
int |
getMaxIO() |
boolean |
isDatasync() |
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.
|
void |
releaseBuffer(ByteBuffer buffer) |
void |
releaseDirectBuffer(ByteBuffer buffer)
used for cases where you need direct buffer outside of the journal context.
|
MappedSequentialFileFactory |
setAlignment(int alignment)
Deprecated.
|
MappedSequentialFileFactory |
setDatasync(boolean enabled) |
void |
start() |
void |
stop() |
static MappedSequentialFileFactory |
unbuffered(File directory,
int capacity,
IOCriticalErrorListener criticalErrorListener) |
ByteBuffer |
wrapBuffer(byte[] bytes) |
public MappedSequentialFileFactory capacity(int capacity)
public int capacity()
public static MappedSequentialFileFactory buffered(File directory, int capacity, int bufferSize, int bufferTimeout, IOCriticalErrorListener criticalErrorListener)
public static MappedSequentialFileFactory unbuffered(File directory, int capacity, IOCriticalErrorListener criticalErrorListener)
public SequentialFile createSequentialFile(String fileName)
createSequentialFile in interface SequentialFileFactorypublic MappedSequentialFileFactory setDatasync(boolean enabled)
setDatasync in interface SequentialFileFactorypublic boolean isDatasync()
isDatasync in interface SequentialFileFactorypublic int getMaxIO()
getMaxIO in interface SequentialFileFactorypublic List<String> listFiles(String extension) throws Exception
SequentialFileFactoryThis method inserts a ".' before the extension.
listFiles in interface SequentialFileFactoryExceptionpublic boolean isSupportsCallbacks()
isSupportsCallbacks in interface SequentialFileFactorypublic void onIOError(Exception exception, String message, SequentialFile file)
SequentialFileFactoryonIOError in interface SequentialFileFactorypublic ByteBuffer allocateDirectBuffer(int size)
SequentialFileFactoryallocateDirectBuffer in interface SequentialFileFactorypublic void releaseDirectBuffer(ByteBuffer buffer)
SequentialFileFactoryreleaseDirectBuffer in interface SequentialFileFactorypublic MappedSequentialFileFactory enableBufferReuse()
public MappedSequentialFileFactory disableBufferReuse()
public ByteBuffer newBuffer(int size)
SequentialFileFactorynewBuffer in interface SequentialFileFactorypublic void releaseBuffer(ByteBuffer buffer)
releaseBuffer in interface SequentialFileFactorypublic void activateBuffer(SequentialFile file)
activateBuffer in interface SequentialFileFactorypublic void deactivateBuffer()
deactivateBuffer in interface SequentialFileFactorypublic ByteBuffer wrapBuffer(byte[] bytes)
wrapBuffer in interface SequentialFileFactorypublic int getAlignment()
getAlignment in interface SequentialFileFactory@Deprecated public MappedSequentialFileFactory setAlignment(int alignment)
setAlignment in interface SequentialFileFactorypublic int calculateBlockSize(int bytes)
calculateBlockSize in interface SequentialFileFactorypublic File getDirectory()
getDirectory in interface SequentialFileFactorypublic void clearBuffer(ByteBuffer buffer)
clearBuffer in interface SequentialFileFactorypublic void start()
start in interface SequentialFileFactorypublic void stop()
stop in interface SequentialFileFactorypublic void createDirs()
throws Exception
SequentialFileFactorycreateDirs in interface SequentialFileFactoryExceptionpublic void flush()
flush in interface SequentialFileFactoryCopyright © 2017 The Apache Software Foundation. All Rights Reserved.