use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method readPropertyKeyTokenRecord.
private PropertyKeyTokenRecord readPropertyKeyTokenRecord(int id, ReadableChannel channel) throws IOException {
// in_use(byte)+count(int)+key_blockId(int)
byte inUseFlag = channel.get();
boolean inUse = false;
if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue()) {
inUse = true;
} else if (inUseFlag != Record.NOT_IN_USE.byteValue()) {
throw new IOException("Illegal in use flag: " + inUseFlag);
}
PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(id);
record.setInUse(inUse);
record.setPropertyCount(channel.getInt());
record.setNameId(channel.getInt());
if (readDynamicRecords(channel, record, PROPERTY_INDEX_DYNAMIC_RECORD_ADDER) == -1) {
return null;
}
return record;
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method visitPropertyKeyTokenCommand.
private Command visitPropertyKeyTokenCommand(ReadableChannel channel) throws IOException {
int id = channel.getInt();
PropertyKeyTokenRecord before = readPropertyKeyTokenRecord(id, channel);
if (before == null) {
return null;
}
PropertyKeyTokenRecord after = readPropertyKeyTokenRecord(id, channel);
if (after == null) {
return null;
}
return new Command.PropertyKeyTokenCommand(before, after);
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_10 method visitPropertyKeyTokenCommand.
private Command visitPropertyKeyTokenCommand(ReadableChannel channel) throws IOException {
// id+in_use(byte)+count(int)+key_blockId(int)
int id = channel.getInt();
byte inUseFlag = channel.get();
boolean inUse = false;
if ((inUseFlag & Record.IN_USE.byteValue()) == Record.IN_USE.byteValue()) {
inUse = true;
} else if (inUseFlag != Record.NOT_IN_USE.byteValue()) {
throw new IOException("Illegal in use flag: " + inUseFlag);
}
PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(id);
record.setInUse(inUse);
record.setPropertyCount(channel.getInt());
record.setNameId(channel.getInt());
if (readDynamicRecords(channel, record, PROPERTY_INDEX_DYNAMIC_RECORD_ADDER) == -1) {
return null;
}
return new Command.PropertyKeyTokenCommand(null, record);
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class BatchInserterImpl method createNewPropertyKeyId.
private int createNewPropertyKeyId(String stringKey) {
int keyId = (int) propertyKeyTokenStore.nextId();
PropertyKeyTokenRecord record = new PropertyKeyTokenRecord(keyId);
record.setInUse(true);
record.setCreated();
Collection<DynamicRecord> keyRecords = propertyKeyTokenStore.allocateNameRecords(encodeString(stringKey));
record.setNameId((int) Iterables.first(keyRecords).getId());
record.addNameRecords(keyRecords);
propertyKeyTokenStore.updateRecord(record);
propertyKeyTokens.addToken(new Token(stringKey, keyId));
return keyId;
}
use of org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord in project neo4j by neo4j.
the class SchemaRecordCheckTest method shouldReportInvalidPropertyReferenceFromIndexRule.
@Test
public void shouldReportInvalidPropertyReferenceFromIndexRule() throws Exception {
// given
int schemaRuleId = 0;
DynamicRecord record = inUse(dynamicRecord(schemaRuleId));
SchemaIndexProvider.Descriptor providerDescriptor = new SchemaIndexProvider.Descriptor("in-memory", "1.0");
IndexRule rule = indexRule(schemaRuleId, labelId, propertyKeyId, providerDescriptor);
when(checker().ruleAccess.loadSingleSchemaRule(schemaRuleId)).thenReturn(rule);
add(inUse(new LabelTokenRecord(labelId)));
PropertyKeyTokenRecord propertyKeyToken = add(notInUse(new PropertyKeyTokenRecord(propertyKeyId)));
// when
ConsistencyReport.SchemaConsistencyReport report = check(record);
// then
verify(report).propertyKeyNotInUse(propertyKeyToken);
}
Aggregations