@Override public boolean next() throws ChangelogException { final boolean hasNext = currentCursor.next(); if (hasNext) { return true; } final LogFile<K, V> logFile = log.getNextLogFile(currentLogFile); if (logFile != null) { switchToLogFile(logFile); return currentCursor.next(); } return false; }
@Override public boolean positionTo( final K key, final KeyMatchingStrategy matchStrategy, final PositionStrategy positionStrategy) throws ChangelogException { final LogFile<K, V> logFile = log.findLogFileFor(key); if (logFile != currentLogFile) { switchToLogFile(logFile); } return (key == null) ? true : currentCursor.positionTo(key, matchStrategy, positionStrategy); }
/** Returns the state of this cursor. */ @Override CursorState<K, V> getState() throws ChangelogException { return new CursorState<>( currentLogFile, currentCursor.getFilePosition(), currentCursor.getRecord()); }
@Override public Record<K, V> getRecord() { return currentCursor != null ? currentCursor.getRecord() : null; }