use of org.neo4j.kernel.impl.store.PropertyStore in project neo4j by neo4j.
the class StoreIteratorRelationshipCursorTest method newRecordCursorsWithMockedNeoStores.
private static RecordCursors newRecordCursorsWithMockedNeoStores(RelationshipStore relationshipStore) {
NeoStores neoStores = mock(NeoStores.class);
NodeStore nodeStore = newStoreMockWithRecordCursor(NodeStore.class);
RelationshipGroupStore relGroupStore = newStoreMockWithRecordCursor(RelationshipGroupStore.class);
PropertyStore propertyStore = newStoreMockWithRecordCursor(PropertyStore.class);
DynamicStringStore dynamicStringStore = newStoreMockWithRecordCursor(DynamicStringStore.class);
DynamicArrayStore dynamicArrayStore = newStoreMockWithRecordCursor(DynamicArrayStore.class);
DynamicArrayStore dynamicLabelStore = newStoreMockWithRecordCursor(DynamicArrayStore.class);
when(neoStores.getNodeStore()).thenReturn(nodeStore);
when(neoStores.getRelationshipStore()).thenReturn(relationshipStore);
when(neoStores.getRelationshipGroupStore()).thenReturn(relGroupStore);
when(neoStores.getPropertyStore()).thenReturn(propertyStore);
when(propertyStore.getStringStore()).thenReturn(dynamicStringStore);
when(propertyStore.getArrayStore()).thenReturn(dynamicArrayStore);
when(nodeStore.getDynamicLabelStore()).thenReturn(dynamicLabelStore);
return new RecordCursors(neoStores);
}
use of org.neo4j.kernel.impl.store.PropertyStore in project neo4j by neo4j.
the class MockedNeoStores method basicMockedNeoStores.
@SuppressWarnings({ "unchecked", "rawtypes" })
public static NeoStores basicMockedNeoStores() {
NeoStores neoStores = mock(NeoStores.class);
// Cursor, absolutely mocked and cannot be used at all as it is
RecordCursor cursor = mockedRecordCursor();
// NodeStore - DynamicLabelStore
NodeStore nodeStore = mock(NodeStore.class);
when(nodeStore.newRecordCursor(any())).thenReturn(cursor);
when(neoStores.getNodeStore()).thenReturn(nodeStore);
// NodeStore - DynamicLabelStore
DynamicArrayStore dynamicLabelStore = mock(DynamicArrayStore.class);
when(dynamicLabelStore.newRecordCursor(any())).thenReturn(cursor);
when(nodeStore.getDynamicLabelStore()).thenReturn(dynamicLabelStore);
// RelationshipStore
RelationshipStore relationshipStore = mock(RelationshipStore.class);
when(relationshipStore.newRecordCursor(any())).thenReturn(cursor);
when(neoStores.getRelationshipStore()).thenReturn(relationshipStore);
// RelationshipGroupStore
RelationshipGroupStore relationshipGroupStore = mock(RelationshipGroupStore.class);
when(relationshipGroupStore.newRecordCursor(any())).thenReturn(cursor);
when(neoStores.getRelationshipGroupStore()).thenReturn(relationshipGroupStore);
// PropertyStore
PropertyStore propertyStore = mock(PropertyStore.class);
when(propertyStore.newRecordCursor(any())).thenReturn(cursor);
when(neoStores.getPropertyStore()).thenReturn(propertyStore);
// PropertyStore -- DynamicStringStore
DynamicStringStore propertyStringStore = mock(DynamicStringStore.class);
when(propertyStringStore.newRecordCursor(any())).thenReturn(cursor);
when(propertyStore.getStringStore()).thenReturn(propertyStringStore);
// PropertyStore -- DynamicArrayStore
DynamicArrayStore propertyArrayStore = mock(DynamicArrayStore.class);
when(propertyArrayStore.newRecordCursor(any())).thenReturn(cursor);
when(propertyStore.getArrayStore()).thenReturn(propertyArrayStore);
return neoStores;
}
use of org.neo4j.kernel.impl.store.PropertyStore in project neo4j by neo4j.
the class HighIdTransactionApplier method visitPropertyCommand.
@Override
public boolean visitPropertyCommand(PropertyCommand command) throws IOException {
PropertyStore propertyStore = neoStores.getPropertyStore();
track(propertyStore, command);
for (PropertyBlock block : command.getAfter()) {
switch(block.getType()) {
case STRING:
track(propertyStore.getStringStore(), block.getValueRecords());
break;
case ARRAY:
track(propertyStore.getArrayStore(), block.getValueRecords());
break;
default:
// Not needed, no dynamic records then
break;
}
}
return false;
}
use of org.neo4j.kernel.impl.store.PropertyStore in project neo4j by neo4j.
the class DumpStoreChain method chainForNode.
private static DumpStoreChain chainForNode(Args args) {
Set<String> kwArgs = args.asMap().keySet();
verifyParameters(kwArgs, kwArgs.contains(RELS) ? RELS : PROPS, NODE);
final long node = Long.parseLong(args.get(NODE, null));
if (args.getBoolean(RELS, false, true)) {
return new DumpRelationshipChain(-1, node, false) {
@Override
RelationshipStore store(NeoStores neoStores) {
NodeRecord nodeRecord = nodeRecord(neoStores, node);
first = nodeRecord.isDense() ? -1 : nodeRecord.getNextRel();
return super.store(neoStores);
}
};
} else if (args.getBoolean(PROPS, false, true)) {
return new DumpPropertyChain(-1, false) {
@Override
PropertyStore store(NeoStores neoStores) {
first = nodeRecord(neoStores, node).getNextProp();
return super.store(neoStores);
}
};
} else {
throw invalidUsage(String.format("Must be either -%s or -%s", RELS, PROPS));
}
}
use of org.neo4j.kernel.impl.store.PropertyStore in project neo4j by neo4j.
the class PropertyDeduplicator method deduplicateProperties.
public void deduplicateProperties() throws IOException {
StoreFactory factory = new StoreFactory(workingDir, pageCache, fileSystem, NullLogProvider.getInstance());
try (NeoStores neoStores = factory.openNeoStores(StoreType.PROPERTY, StoreType.NODE, StoreType.SCHEMA)) {
PropertyStore propertyStore = neoStores.getPropertyStore();
NodeStore nodeStore = neoStores.getNodeStore();
SchemaStore schemaStore = neoStores.getSchemaStore();
PrimitiveLongObjectMap<List<DuplicateCluster>> duplicateClusters = collectConflictingProperties(propertyStore);
resolveConflicts(duplicateClusters, propertyStore, nodeStore, schemaStore, neoStores.getStoreDir());
}
}
Aggregations