use of org.neo4j.kernel.impl.transaction.log.entry.LogHeaderReader.readLogHeader in project neo4j by neo4j.
the class LogTestUtils method openLogEntryCursor.
private static LogEntryCursor openLogEntryCursor(FileSystemAbstraction fs, File firstFile, LogVersionBridge versionBridge) {
StoreChannel channel = null;
try {
channel = fs.open(firstFile, "r");
ByteBuffer buffer = ByteBuffer.allocate(LogHeader.LOG_HEADER_SIZE);
LogHeader header = LogHeaderReader.readLogHeader(buffer, channel, true, firstFile);
PhysicalLogVersionedStoreChannel logVersionedChannel = new PhysicalLogVersionedStoreChannel(channel, header.logVersion, header.logFormatVersion);
ReadableLogChannel logChannel = new ReadAheadLogChannel(logVersionedChannel, versionBridge, ReadAheadLogChannel.DEFAULT_READ_AHEAD_SIZE);
return new LogEntryCursor(new VersionAwareLogEntryReader<>(), logChannel);
} catch (Throwable t) {
if (channel != null) {
try {
channel.close();
} catch (IOException e) {
t.addSuppressed(e);
}
}
throw new RuntimeException(t);
}
}
Aggregations