public abstract class AbstractWalRecordsIterator extends GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>> implements WALIterator
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractWalRecordsIterator.AbstractFileDescriptor |
protected static interface |
AbstractWalRecordsIterator.AbstractReadFileHandle |
| Modifier and Type | Field and Description |
|---|---|
protected IgniteBiTuple<WALPointer,WALRecord> |
curRec
Current record preloaded, to be returned on next()
Normally this should be not null because advance() method should already prepare some value |
protected long |
curWalSegmIdx
Current WAL segment absolute index.
|
protected FileIOFactory |
ioFactory
Factory to provide I/O interfaces for read/write operations with files
|
protected IgniteLogger |
log
Logger
|
protected GridCacheSharedContext |
sharedCtx
Shared context for creating serializer of required version and grid name access.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractWalRecordsIterator(IgniteLogger log,
GridCacheSharedContext sharedCtx,
RecordSerializerFactory serializerFactory,
FileIOFactory ioFactory,
int bufSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
advance()
Switches records iterator to the next record.
|
protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle |
advanceSegment(AbstractWalRecordsIterator.AbstractReadFileHandle curWalSegment)
Switches records iterator to the next WAL segment
as result of this method, new reference to segment should be returned.
|
protected AbstractWalRecordsIterator.AbstractReadFileHandle |
closeCurrentWalSegment()
Closes and returns WAL segment (if any)
|
protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle |
createReadFileHandle(FileIO fileIO,
long idx,
RecordSerializer ser,
FileInput in) |
protected void |
handleRecordException(Exception e,
FileWALPointer ptr)
Handler for record deserialization exception
|
protected AbstractWalRecordsIterator.AbstractReadFileHandle |
initReadHandle(AbstractWalRecordsIterator.AbstractFileDescriptor desc,
FileWALPointer start) |
protected void |
onClose()
Invoked on iterator close.
|
protected boolean |
onHasNext() |
protected IgniteBiTuple<WALPointer,WALRecord> |
onNext() |
protected WALRecord |
postProcessRecord(WALRecord rec)
Performs final conversions with record loaded from WAL.
|
checkClosed, close, hasNextX, isClosed, nextX, onRemove, removeXhasNext, iterator, next, removeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, isClosedhasNextX, nextX, removeXforEach, iterator, spliteratorforEachRemaining, hasNext, next, removeprotected IgniteBiTuple<WALPointer,WALRecord> curRec
protected long curWalSegmIdx
@NotNull protected final IgniteLogger log
@NotNull protected final GridCacheSharedContext sharedCtx
@NotNull protected final FileIOFactory ioFactory
protected AbstractWalRecordsIterator(@NotNull
IgniteLogger log,
@NotNull
GridCacheSharedContext sharedCtx,
@NotNull
RecordSerializerFactory serializerFactory,
@NotNull
FileIOFactory ioFactory,
int bufSize)
log - Logger.sharedCtx - Shared context.serializerFactory - Serializer of current version to read headers.ioFactory - ioFactory for file IO access.bufSize - buffer for reading records size.protected IgniteBiTuple<WALPointer,WALRecord> onNext() throws IgniteCheckedException
onNext in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>IgniteCheckedException - If failed.protected boolean onHasNext()
throws IgniteCheckedException
onHasNext in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>True if iterator has next element.IgniteCheckedException - If failed.protected void onClose()
throws IgniteCheckedException
onClose in class GridCloseableIteratorAdapter<IgniteBiTuple<WALPointer,WALRecord>>IgniteCheckedException - If closing failed.protected void advance()
throws IgniteCheckedException
curRec will be updated.currWalSegment will be updated.advance() runs a step ahead GridIteratorAdapter.next()IgniteCheckedException - If failed.@Nullable protected AbstractWalRecordsIterator.AbstractReadFileHandle closeCurrentWalSegment() throws IgniteCheckedException
IgniteCheckedException - if IO failedprotected abstract AbstractWalRecordsIterator.AbstractReadFileHandle advanceSegment(@Nullable AbstractWalRecordsIterator.AbstractReadFileHandle curWalSegment) throws IgniteCheckedException
curWalSegment - current open WAL segment or null if there is no open segment yetIgniteCheckedException - if reading failed@NotNull protected WALRecord postProcessRecord(@NotNull WALRecord rec)
rec - record to post process.protected void handleRecordException(@NotNull
Exception e,
@Nullable
FileWALPointer ptr)
e - problem from records readingptr - file pointer was accessedprotected AbstractWalRecordsIterator.AbstractReadFileHandle initReadHandle(@NotNull AbstractWalRecordsIterator.AbstractFileDescriptor desc, @Nullable FileWALPointer start) throws IgniteCheckedException, FileNotFoundException
desc - File descriptor.start - Optional start pointer. Null means read from the beginningFileNotFoundException - If segment file is missing.IgniteCheckedException - If initialized failed due to another unexpected error.protected abstract AbstractWalRecordsIterator.AbstractReadFileHandle createReadFileHandle(FileIO fileIO, long idx, RecordSerializer ser, FileInput in)
Follow @ApacheIgnite
Ignite Fabric : ver. 2.5.0 Release Date : May 23 2018