Documentation of 'org.apache.derby.impl.store.raw.log.Scan' Java class
Scan
org.apache.derby.impl.store.raw.log

Class Scan

  • All Implemented Interfaces:
    LogScan, StreamLogScan


    public class Scan
    extends java.lang.Object
    implements StreamLogScan
    Scan the the log which is implemented by a series of log files.n This log scan knows how to move across log file if it is positioned at the boundary of a log file and needs to getNextRecord.
            4 bytes - length of user data, i.e. N
            8 bytes - long representing log instant
            N bytes of supplied data
            4 bytes - length of user data, i.e. N
            
    • Constructor Summary

      Constructors 
      Constructor and Description
      Scan(LogToFile logFactory, long startAt, LogInstant stopAt, byte direction)
      For backward scan, we expect a scan positioned at the end of the next log record.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Close the scan.
      long getInstant()
      Return the log instant (as an integer) the scan is currently on - this is the log instant of the log record that was returned by getNextRecord.
      LogInstant getLogInstant()
      Return the log instant the scan is currently on - this is the log instant of the log record that was returned by getNextRecord.
      long getLogRecordEnd()
      Return the log instant at the end of the log record on the current LogFile in the form of a log instant.
      LogRecord getNextRecord(ArrayInputStream input, TransactionId tranId, int groupmask)
      Read the next log record.
      boolean isLogEndFuzzy()
      returns true if there is partially writen log records before the crash in the last log file.
      void resetPosition(LogInstant instant)
      Reset the scan to the given LogInstant.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Scan

        public Scan(LogToFile logFactory,
                    long startAt,
                    LogInstant stopAt,
                    byte direction)
             throws java.io.IOException,
                    StandardException
        For backward scan, we expect a scan positioned at the end of the next log record. For forward scan, we expect a scan positioned at the beginning of the next log record. For forward flushed scan, we expect stopAt to be the instant for the first not-flushed log record. Like any forward scan, we expect a scan positioned at the beginning of the next log record.
        Throws:
        StandardException - Standard Derby error policy
        java.io.IOException - cannot access the log at the new position.
    • Method Detail

      • resetPosition

        public void resetPosition(LogInstant instant)
                           throws java.io.IOException,
                                  StandardException
        Reset the scan to the given LogInstant.
        Specified by:
        resetPosition in interface StreamLogScan
        Parameters:
        instant - the position to reset to
        Throws:
        java.io.IOException - scan cannot access the log at the new position.
        StandardException - standard Derby error policy
      • getInstant

        public long getInstant()
        Return the log instant (as an integer) the scan is currently on - this is the log instant of the log record that was returned by getNextRecord.
        Specified by:
        getInstant in interface StreamLogScan
        Returns:
        INVALID_LOG_INSTANT if no records have been returned yet or the scan has completed.
      • getLogRecordEnd

        public long getLogRecordEnd()
        Return the log instant at the end of the log record on the current LogFile in the form of a log instant. After the scan has been closed, the end of the last log record will be returned except when the scan ended in an empty log file. In that case, the start of this empty log file will be returned. (This is done to make sure new log records are inserted into the newest log file.)
        Specified by:
        getLogRecordEnd in interface StreamLogScan
        Returns:
        INVALID_LOG_INSTANT if this is not a FORWARD scan or, no record have been returned yet or the scan has completed.
      • isLogEndFuzzy

        public boolean isLogEndFuzzy()
        returns true if there is partially writen log records before the crash in the last log file. Partiall wrires are identified during forward redo scans for log recovery.
        Specified by:
        isLogEndFuzzy in interface StreamLogScan
        Returns:
        true if fuzzy log end found during forward scan, this happens if there was a partially written log records before the crash.
      • getLogInstant

        public LogInstant getLogInstant()
        Return the log instant the scan is currently on - this is the log instant of the log record that was returned by getNextRecord.
        Specified by:
        getLogInstant in interface StreamLogScan
        Returns:
        null if no records have been returned yet or the scan has completed.
      • close

        public void close()
        Close the scan.
        Specified by:
        close in interface StreamLogScan

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.