public PhysicalTransactionCursor( T channel, LogEntryReader<T> entryReader ) throws IOException { this.channel = channel; channel.getCurrentPosition( lastGoodPositionMarker ); this.logEntryCursor = new LogEntryCursor( (LogEntryReader<ReadableClosablePositionAwareChannel>) entryReader, channel ); }
public static List<LogEntry> logEntries( FileSystemAbstraction fileSystem, String logPath ) throws IOException { File logFile = new File( logPath ); StoreChannel fileChannel = fileSystem.open( logFile, OpenMode.READ ); // Always a header LogHeader header = readLogHeader( ByteBuffer.allocate( LOG_HEADER_SIZE ), fileChannel, true, logFile ); // Read all log entries PhysicalLogVersionedStoreChannel versionedStoreChannel = new PhysicalLogVersionedStoreChannel( fileChannel, header.logVersion, header.logFormatVersion ); ReadableLogChannel logChannel = new ReadAheadLogChannel( versionedStoreChannel ); LogEntryCursor logEntryCursor = new LogEntryCursor( new VersionAwareLogEntryReader<>(), logChannel ); return Iterables.asList( new IOCursorAsResourceIterable<>( logEntryCursor ) ); }
public List<CheckPoint> find( long version ) throws IOException { List<CheckPoint> checkPoints = new ArrayList<>(); for (; version >= INITIAL_LOG_VERSION && logFiles.versionExists( version ); version-- ) { LogVersionedStoreChannel channel = logFiles.openForVersion( version ); ReadableClosablePositionAwareChannel recoveredDataChannel = new ReadAheadLogChannel( channel ); try ( LogEntryCursor cursor = new LogEntryCursor( logEntryReader, recoveredDataChannel ) ) { while ( cursor.next() ) { LogEntry entry = cursor.get(); if ( entry instanceof CheckPoint ) { checkPoints.add( entry.as() ); } } } } return checkPoints; } }
try ( IOCursor<LogEntry> cursor = new LogEntryCursor( new VersionAwareLogEntryReader<>(), logChannel ) )
LogEntryCursor cursor = new LogEntryCursor( logEntryReader, logChannel ) )
try ( LogVersionedStoreChannel channel = logFiles.openForVersion( version ); ReadAheadLogChannel readAheadLogChannel = new ReadAheadLogChannel( channel ); LogEntryCursor cursor = new LogEntryCursor( logEntryReader, readAheadLogChannel ) )
public PhysicalTransactionCursor( T channel, LogEntryReader<T> entryReader ) throws IOException { this.channel = channel; channel.getCurrentPosition( lastGoodPositionMarker ); this.logEntryCursor = new LogEntryCursor( (LogEntryReader<ReadableClosablePositionAwareChannel>) entryReader, channel ); }
LogEntryCursor cursor = new LogEntryCursor( logEntryReader, logChannel ) )
try ( LogVersionedStoreChannel channel = logFiles.openForVersion( version ); ReadAheadLogChannel readAheadLogChannel = new ReadAheadLogChannel( channel ); LogEntryCursor cursor = new LogEntryCursor( logEntryReader, readAheadLogChannel ) )