public class FileSystemBackend extends Object implements Iterable<WalContent>, AutoCloseable
| Constructor and Description |
|---|
FileSystemBackend(@NonNull String queueName,
@NonNull WalFilesConfig walConfig,
@NonNull CompressedFilesConfig compressedConfig,
Boolean restoreFromDisk,
Function<CorruptedDataException,Boolean> corruptionHandler)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
compress()
Merges all WAL files into one big compressed file.
|
long |
diskSize()
Returns the size, which is occupied by files related to this backend (WAL and compressed fiels).
|
Iterator<WalContent> |
iterator() |
int |
peakTo(@NonNull io.appulse.utils.Bytes buffer)
Retrieves, but does not remove the next WAL content into the
buffer. |
int |
pollTo(@NonNull io.appulse.utils.Bytes buffer)
Retrieves and removes the head of the next WAL content into the
buffer. |
void |
write(@NonNull io.appulse.utils.Bytes buffer)
Writes the
buffer content to the next WAL file. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic FileSystemBackend(@NonNull
@NonNull String queueName,
@NonNull
@NonNull WalFilesConfig walConfig,
@NonNull
@NonNull CompressedFilesConfig compressedConfig,
Boolean restoreFromDisk,
Function<CorruptedDataException,Boolean> corruptionHandler)
queueName - the queue name for file names patternwalConfig - the configuration for WAL filescompressedConfig - the configuration for compressed filesrestoreFromDisk - the flag which tells should it restores from disk or notpublic void write(@NonNull
@NonNull io.appulse.utils.Bytes buffer)
buffer content to the next WAL file.
If the wal files limit exceeded - merge them into a new compress file and remove.buffer - byte array source to writepublic void compress()
public int pollTo(@NonNull
@NonNull io.appulse.utils.Bytes buffer)
buffer.buffer - the destination bytes buffer, where content writesbufferpublic int peakTo(@NonNull
@NonNull io.appulse.utils.Bytes buffer)
buffer.buffer - the destination bytes bufferbufferpublic long diskSize()
public Iterator<WalContent> iterator()
iterator in interface Iterable<WalContent>public void close()
close in interface AutoCloseableCopyright © 2019 Infobip Ltd.. All rights reserved.