Package io.camunda.zeebe.snapshots.impl
Class FileBasedSnapshotChunkReader
java.lang.Object
io.camunda.zeebe.snapshots.impl.FileBasedSnapshotChunkReader
- All Implemented Interfaces:
SnapshotChunkReader,CloseableSilently,AutoCloseable,Iterator<SnapshotChunk>
Implements a chunk reader where each chunk is a single file in a root directory. Chunks are then
ordered lexicographically, and the files are assumed to be immutable, i.e. no more are added to
the directory once this is created.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanhasNext()next()nextId()Returns the next chunk ID; ifIterator.hasNext()should return false, then this will return null.voidreset()voidseek(ByteBuffer id) Skips all chunks up to the one with the given ID, inclusively, such that the next chunk would be the chunk right after it (if any).voidsetMaximumChunkSize(int maximumChunkSize) Sets the maximum chunk size for the reader when sending files.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
FileBasedSnapshotChunkReader
- Throws:
IOException
-
-
Method Details
-
reset
public void reset()- Specified by:
resetin interfaceSnapshotChunkReader
-
seek
Description copied from interface:SnapshotChunkReaderSkips all chunks up to the one with the given ID, inclusively, such that the next chunk would be the chunk right after it (if any). If no ID is given then should not do anything.- Specified by:
seekin interfaceSnapshotChunkReader- Parameters:
id- the chunk ID to seek to; maybe null
-
nextId
Description copied from interface:SnapshotChunkReaderReturns the next chunk ID; ifIterator.hasNext()should return false, then this will return null.- Specified by:
nextIdin interfaceSnapshotChunkReader- Returns:
- the next chunk ID
-
setMaximumChunkSize
public void setMaximumChunkSize(int maximumChunkSize) Description copied from interface:SnapshotChunkReaderSets the maximum chunk size for the reader when sending files.- Specified by:
setMaximumChunkSizein interfaceSnapshotChunkReader- Parameters:
maximumChunkSize-
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableSilently
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<SnapshotChunk>
-
next
- Specified by:
nextin interfaceIterator<SnapshotChunk>
-