Interface SequentialFileFactory
-
- All Known Implementing Classes:
AbstractSequentialFileFactory,AIOSequentialFileFactory,MappedSequentialFileFactory,NIOSequentialFileFactory
public interface SequentialFileFactoryA SequentialFileFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidactivateBuffer(SequentialFile file)ByteBufferallocateDirectBuffer(int size)used for cases where you need direct buffer outside of the journal context.intcalculateBlockSize(int bytes)voidclearBuffer(ByteBuffer buffer)voidcreateDirs()Creates the directory if it does not exist yet.SequentialFilecreateSequentialFile(String fileName)default SequentialFilecreateSequentialFile(String fileName, int capacity)voiddeactivateBuffer()voidflush()intgetAlignment()longgetBufferSize()default CriticalAnalyzergetCriticalAnalyzer()default IOCriticalErrorListenergetCriticalErrorListener()FilegetDirectory()intgetMaxIO()booleanisDatasync()booleanisSupportsCallbacks()List<String>listFiles(String extension)Lists files that end with the given extension.ByteBuffernewBuffer(int size)Note: You need to release the buffer if is used for reading operations.default ByteBuffernewBuffer(int size, boolean zeroed)Note: You need to release the buffer if is used for reading operations.default voidonIOError(Throwable exception, String message)voidonIOError(Throwable exception, String message, String file)The SequentialFile will call this method when a disk IO Error happens during the live phase.default voidonIOError(Throwable exception, String message, SequentialFile file)voidreleaseBuffer(ByteBuffer buffer)voidreleaseDirectBuffer(ByteBuffer buffer)used for cases where you need direct buffer outside of the journal context.SequentialFileFactorysetAlignment(int alignment)default voidsetCriticalErrorListener(IOCriticalErrorListener listener)SequentialFileFactorysetDatasync(boolean enabled)voidstart()voidstop()ByteBufferwrapBuffer(byte[] bytes)
-
-
-
Method Detail
-
getCriticalErrorListener
default IOCriticalErrorListener getCriticalErrorListener()
-
setCriticalErrorListener
default void setCriticalErrorListener(IOCriticalErrorListener listener)
-
getCriticalAnalyzer
default CriticalAnalyzer getCriticalAnalyzer()
-
createSequentialFile
SequentialFile createSequentialFile(String fileName)
-
createSequentialFile
default SequentialFile createSequentialFile(String fileName, int capacity)
-
getMaxIO
int getMaxIO()
-
listFiles
List<String> listFiles(String extension) throws Exception
Lists files that end with the given extension.This method inserts a ".' before the extension.
- Parameters:
extension-- Returns:
- Throws:
Exception
-
isSupportsCallbacks
boolean isSupportsCallbacks()
-
onIOError
void onIOError(Throwable exception, String message, String file)
The SequentialFile will call this method when a disk IO Error happens during the live phase.
-
onIOError
default void onIOError(Throwable exception, String message, SequentialFile file)
-
allocateDirectBuffer
ByteBuffer allocateDirectBuffer(int size)
used for cases where you need direct buffer outside of the journal context. This is because the native layer has a method that can be reused in certain cases like paging
-
releaseDirectBuffer
void releaseDirectBuffer(ByteBuffer buffer)
used for cases where you need direct buffer outside of the journal context. This is because the native layer has a method that can be reused in certain cases like paging
-
newBuffer
ByteBuffer newBuffer(int size)
Note: You need to release the buffer if is used for reading operations. You don't need to do it if using writing operations (AIO Buffer Lister will take of writing operations)- Parameters:
size-- Returns:
- the allocated ByteBuffer
-
newBuffer
default ByteBuffer newBuffer(int size, boolean zeroed)
Note: You need to release the buffer if is used for reading operations. You don't need to do it if using writing operations (AIO Buffer Lister will take of writing operations)- Parameters:
size-zeroed- iftruethe returnedByteBuffermust be zeroed, otherwise it tries to save zeroing it.- Returns:
- the allocated ByteBuffer
-
releaseBuffer
void releaseBuffer(ByteBuffer buffer)
-
activateBuffer
void activateBuffer(SequentialFile file)
-
deactivateBuffer
void deactivateBuffer()
-
wrapBuffer
ByteBuffer wrapBuffer(byte[] bytes)
-
getAlignment
int getAlignment()
-
setAlignment
SequentialFileFactory setAlignment(int alignment)
-
calculateBlockSize
int calculateBlockSize(int bytes)
-
getDirectory
File getDirectory()
-
clearBuffer
void clearBuffer(ByteBuffer buffer)
-
start
void start()
-
stop
void stop()
-
createDirs
void createDirs() throws ExceptionCreates the directory if it does not exist yet.- Throws:
Exception
-
flush
void flush()
-
setDatasync
SequentialFileFactory setDatasync(boolean enabled)
-
isDatasync
boolean isDatasync()
-
getBufferSize
long getBufferSize()
-
-