public class LogVerifier extends Object
Environment.
The caller supplies the contents of the log file by passing arrays of
bytes in a series of calls to the verify(byte[], int, int) method, which verifies the
checksums for log records, and by calling the verifyAtEof() when the
entire contents are complete, to detect incomplete entries at the end of the
file. The primary intended use of this class is to verify the contents of
log files that are being copied as part of a programmatic backup. It is
critical that invalid files are not added to a backup set, since then both
the live environment and the backup will be invalid.
LogVerificationInputStream| Constructor and Description |
|---|
LogVerifier(EnvironmentImpl envImpl,
String fileName)
Creates a log verifier.
|
LogVerifier(EnvironmentImpl envImpl,
String fileName,
long fileNum)
Creates a log verifier for use with an internal environment.
|
LogVerifier(Environment env,
String fileName)
Creates a log verifier.
|
| Modifier and Type | Method and Description |
|---|---|
void |
verify(byte[] buf,
int off,
int len)
Verifies the next portion of the log file.
|
void |
verifyAtEof()
Checks that the log file ends with a complete log entry, after having
completed verifying the log file contents through calls to
verify(byte[], int, int). |
public LogVerifier(Environment env, String fileName)
env - the Environment associated with the logfileName - the file name of the log, for reporting in the LogVerificationException. This should be a simple file name of the
form NNNNNNNN.jdb, where NNNNNNNN is the file number in
hexadecimal format.EnvironmentFailureException - if an unexpected, internal or
environment-wide failure occurspublic LogVerifier(EnvironmentImpl envImpl, String fileName)
envImpl - the EnvironmentImpl associated with the logfileName - the file name of the log, for reporting in the LogVerificationException. This should be a simple file name of the
form NNNNNNNN.jdb, where NNNNNNNN is the file number in
hexadecimal format.EnvironmentFailureException - if an unexpected, internal or
environment-wide failure occurspublic LogVerifier(EnvironmentImpl envImpl, String fileName, long fileNum)
Creates a log verifier for use with an internal environment. If
fileNum is less than zero, it is derived from fileName.
envImpl - the EnvironmentImpl associated with the logfileName - the file name of the log, for reporting in the LogVerificationException. This should be a simple file name of the
form NNNNNNNN.jdb, where NNNNNNNN is the file number in
hexadecimal format.fileNum - the file numberpublic void verify(byte[] buf,
int off,
int len)
throws LogVerificationException
buf - the buffer containing the log file bytesoff - the start offset of the log file bytes in the bufferlen - the number of log file bytes in the bufferLogVerificationException - if a checksum cannot be verified or a
log entry is determined to be invalid by examining its contentsEnvironmentFailureException - if an unexpected, internal or
environment-wide failure occurspublic void verifyAtEof()
throws LogVerificationException
verify(byte[], int, int).LogVerificationException - if the stream does not end with a
complete log entryEnvironmentFailureException - if an unexpected, internal or
environment-wide failure occursCopyright © 2024. All rights reserved.