@Override public LogPositionMarker getCurrentPosition( LogPositionMarker positionMarker ) throws IOException { positionMarker.mark( logVersionedStoreChannel.getVersion(), channel.position() ); return positionMarker; }
@Override public LogPositionMarker getCurrentPosition( LogPositionMarker positionMarker ) throws IOException { positionMarker.mark( channel.getVersion(), position() ); return positionMarker; }
/** * Reading {@link LogEntry log entries} may have the source move over physically multiple log files. * This accessor returns the log version of the most recent call to {@link #next()}. * * @return the log version of the most recent {@link LogEntry} returned from {@link #next(). */ public long getCurrentLogVersion() throws IOException { channel.getCurrentPosition( position ); return position.getLogVersion(); } }
@Override public ReadableLogChannel getReader( LogPosition position, LogVersionBridge logVersionBridge ) throws IOException { PhysicalLogVersionedStoreChannel logChannel = logFiles.openForVersion( position.getLogVersion() ); logChannel.position( position.getByteOffset() ); return new ReadAheadLogChannel( logChannel, logVersionBridge ); }
@Override public void start() throws IOException { // Recovery has taken place before this, so the log file has been truncated to last known good tx // Just read header and move to the end long lastLogVersionUsed = logVersionRepository.getCurrentLogVersion(); channel = logFiles.createLogChannelForVersion( lastLogVersionUsed, OpenMode.READ_WRITE, context::getLastCommittedTransactionId ); // Move to the end channel.position( channel.size() ); writer = new PositionAwarePhysicalFlushableChannel( channel ); }
@Override public void publishAsClosed() { transactionIdStore.transactionClosed( transactionId, logPosition.getLogVersion(), logPosition.getByteOffset() ); }
public void setCurrentPosition( LogPosition position ) throws IOException, UnsupportedOperationException { channel.position( position.getByteOffset() ); } }
public PhysicalTransactionCursor( T channel, LogEntryReader<T> entryReader ) throws IOException { this.channel = channel; channel.getCurrentPosition( lastGoodPositionMarker ); this.logEntryCursor = new LogEntryCursor( (LogEntryReader<ReadableClosablePositionAwareChannel>) entryReader, channel ); }
@Override public Flushable prepareForFlush() throws IOException { return channel.prepareForFlush(); }
@Override public TransactionCursor getTransactionsInReverseOrder( LogPosition backToPosition ) throws IOException { return physicalStore.getTransactionsInReverseOrder( backToPosition ); }
@Override public boolean requiresApplicationOrdering() { return commitment.hasExplicitIndexChanges(); }
@Override public FlushableChannel put( byte value ) throws IOException { return channel.put( value ); }
@Override public FlushableChannel putLong( long value ) throws IOException { return channel.putLong( value ); }
@Override public FlushableChannel putDouble( double value ) throws IOException { return channel.putDouble( value ); }
@Override public int getInt() throws ReadPastEndException { return reader.getInt(); }
@Override public void get( byte[] bytes, int length ) throws ReadPastEndException { reader.get( bytes, length ); }
@Override public LogPositionMarker getCurrentPosition( LogPositionMarker positionMarker ) { // Hmm, this would be for the writer. return writer.getCurrentPosition( positionMarker ); }