use of org.neo4j.kernel.KernelVersion in project neo4j by neo4j.
the class SchemaStorage method streamAllSchemaRules.
@VisibleForTesting
Stream<SchemaRule> streamAllSchemaRules(boolean ignoreMalformed, CursorContext cursorContext) {
long startId = schemaStore.getNumberOfReservedLowIds();
long endId = schemaStore.getHighId();
Stream<IndexDescriptor> nli = Stream.empty();
KernelVersion currentVersion;
try {
currentVersion = versionSupplier.kernelVersion();
} catch (IllegalStateException ignored) {
// If KernelVersion is missing we are an older store.
currentVersion = KernelVersion.V4_2;
}
if (currentVersion.isLessThan(KernelVersion.VERSION_IN_WHICH_TOKEN_INDEXES_ARE_INTRODUCED)) {
nli = Stream.of(IndexDescriptor.INJECTED_NLI);
}
return Stream.concat(LongStream.range(startId, endId).mapToObj(id -> schemaStore.getRecord(id, schemaStore.newRecord(), RecordLoad.LENIENT_ALWAYS, cursorContext)).filter(AbstractBaseRecord::inUse).flatMap(record -> readSchemaRuleThrowingRuntimeException(record, ignoreMalformed, cursorContext)), nli);
}
use of org.neo4j.kernel.KernelVersion in project neo4j by neo4j.
the class VersionAwareLogEntryReaderTest method shouldReadACommandLogEntry.
@Test
void shouldReadACommandLogEntry() throws IOException {
// given
KernelVersion version = LATEST;
TestCommand testCommand = new TestCommand(new byte[] { 100, 101, 102 });
final LogEntryCommand command = new LogEntryCommand(version, testCommand);
final InMemoryClosableChannel channel = new InMemoryClosableChannel(true);
channel.put(version.version());
channel.put(LogEntryTypeCodes.COMMAND);
testCommand.serialize(channel);
// when
final LogEntry logEntry = logEntryReader.readLogEntry(channel);
// then
assertEquals(command, logEntry);
}
Aggregations