|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.raw.log.Scan
public class Scan
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
Field Summary | |
---|---|
static byte |
BACKWARD
|
static byte |
BACKWARD_FROM_LOG_END
|
private long |
currentInstant
|
private long |
currentLogFileLength
|
private long |
currentLogFileNumber
|
static byte |
FORWARD
|
private boolean |
fuzzyLogEnd
|
private long |
knownGoodLogEnd
|
private LogToFile |
logFactory
|
private StorageRandomAccessFile |
scan
|
private byte |
scanDirection
|
private long |
stopAt
|
Constructor Summary | |
---|---|
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 | |
---|---|
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. |
private LogRecord |
getNextRecordBackward(ArrayInputStream input,
TransactionId tranId,
int groupmask)
Read the previous log record. |
private LogRecord |
getNextRecordForward(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 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte FORWARD
public static final byte BACKWARD
public static final byte BACKWARD_FROM_LOG_END
private StorageRandomAccessFile scan
private LogToFile logFactory
private long currentLogFileNumber
private long currentLogFileLength
private long knownGoodLogEnd
private long currentInstant
private long stopAt
private byte scanDirection
private boolean fuzzyLogEnd
Constructor Detail |
---|
public Scan(LogToFile logFactory, long startAt, LogInstant stopAt, byte direction) throws java.io.IOException, StandardException
StandardException
- Standard Derby error policy
java.io.IOException
- cannot access the log at the new position.Method Detail |
---|
public LogRecord getNextRecord(ArrayInputStream input, TransactionId tranId, int groupmask) throws StandardException
getNextRecord
in interface StreamLogScan
input
- the ArrayInputStream to put the log recordtranId
- if non-null, only log record that equals tranId
will be returned. If null, log records are not
filtered on transaction Id.groupmask
- if non-zero, only log record whose Loggable's group
value is included in the groupmask is returned.
groupmask can be a bit wise OR of many Loggable
groups. If zero, log records are not filtered on
the Loggable's group.
StandardException
- Standard Derby error policyStreamLogScan.getNextRecord(org.apache.derby.iapi.services.io.ArrayInputStream, org.apache.derby.iapi.store.raw.xact.TransactionId, int)
private LogRecord getNextRecordBackward(ArrayInputStream input, TransactionId tranId, int groupmask) throws StandardException, java.io.IOException, java.lang.ClassNotFoundException
StandardException
java.io.IOException
java.lang.ClassNotFoundException
Side effects include:
on a successful read, setting currentInstant.
on a log file switch, setting currentLogFileNumber.
private LogRecord getNextRecordForward(ArrayInputStream input, TransactionId tranId, int groupmask) throws StandardException, java.io.IOException, java.lang.ClassNotFoundException
StandardException
java.io.IOException
java.lang.ClassNotFoundException
Side effects include:
on a successful read, setting currentInstant, knownGoodLogEnd
on a log file switch, setting currentLogFileNumber, currentLogFileLength.
on detecting a fuzzy log end that needs clearing, it will call
logFactory to clear the fuzzy log end.
public void resetPosition(LogInstant instant) throws java.io.IOException, StandardException
resetPosition
in interface StreamLogScan
instant
- the position to reset to
java.io.IOException
- scan cannot access the log at the new position.
StandardException
- standard Derby error policypublic long getInstant()
getInstant
in interface StreamLogScan
public long getLogRecordEnd()
getLogRecordEnd
in interface StreamLogScan
public boolean isLogEndFuzzy()
isLogEndFuzzy
in interface StreamLogScan
public LogInstant getLogInstant()
getLogInstant
in interface StreamLogScan
public void close()
close
in interface StreamLogScan
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |