use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method readLabelTokenRecord.
private LabelTokenRecord readLabelTokenRecord(int id, ReadableChannel channel) throws IOException {
// in_use(byte)+type_blockId(int)+nr_type_records(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);
}
LabelTokenRecord record = new LabelTokenRecord(id);
record.setInUse(inUse);
record.setNameId(channel.getInt());
int nrTypeRecords = channel.getInt();
for (int i = 0; i < nrTypeRecords; i++) {
DynamicRecord dr = readDynamicRecord(channel);
if (dr == null) {
return null;
}
record.addNameRecord(dr);
}
return record;
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method visitLabelTokenCommand.
private Command visitLabelTokenCommand(ReadableChannel channel) throws IOException {
int id = channel.getInt();
LabelTokenRecord before = readLabelTokenRecord(id, channel);
if (before == null) {
return null;
}
LabelTokenRecord after = readLabelTokenRecord(id, channel);
if (after == null) {
return null;
}
return new Command.LabelTokenCommand(before, after);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class BatchInserterImpl method createNewLabelId.
private int createNewLabelId(String stringKey) {
int keyId = (int) labelTokenStore.nextId();
LabelTokenRecord record = new LabelTokenRecord(keyId);
record.setInUse(true);
record.setCreated();
Collection<DynamicRecord> keyRecords = labelTokenStore.allocateNameRecords(encodeString(stringKey));
record.setNameId((int) Iterables.first(keyRecords).getId());
record.addNameRecords(keyRecords);
labelTokenStore.updateRecord(record);
labelTokens.addToken(new Token(stringKey, keyId));
return keyId;
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord 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);
}
use of org.neo4j.kernel.impl.store.record.LabelTokenRecord in project neo4j by neo4j.
the class TransactionWriter method create.
public void create(LabelTokenRecord labelToken) {
labelToken.setCreated();
update(new LabelTokenRecord(labelToken.getIntId()), labelToken);
}
Aggregations