Skip to content

Commit

Permalink
Merge pull request #9631 from neo-technology/inline-compat-proxy
Browse files Browse the repository at this point in the history
Inline usages of Neo4jProxy
  • Loading branch information
knutwalker authored Sep 24, 2024
2 parents 161c8d3 + 808824a commit 32bc290
Show file tree
Hide file tree
Showing 65 changed files with 473 additions and 874 deletions.
34 changes: 15 additions & 19 deletions algo/src/main/java/org/neo4j/gds/paths/PathFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

import org.jetbrains.annotations.TestOnly;
import org.neo4j.gds.api.NodeLookup;
import org.neo4j.gds.compat.Neo4jProxy;
import org.neo4j.gds.compat.VirtualRelationshipImpl;
import org.neo4j.graphalgo.impl.util.PathImpl;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Path;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;

import java.util.List;
Expand All @@ -48,12 +50,10 @@ public static Path create(
long targetNodeId = nodeIds[i + 1];


var relationship = Neo4jProxy.virtualRelationship(
RelationshipIds.next(),
nodeLookup.getNodeById(sourceNodeId),
nodeLookup.getNodeById(targetNodeId),
relationshipType
);
long id = RelationshipIds.next();
Node startNode = nodeLookup.getNodeById(sourceNodeId);
Node endNode = nodeLookup.getNodeById(targetNodeId);
var relationship = (Relationship) new VirtualRelationshipImpl(id, startNode, endNode, relationshipType);
var costDifference = costs[i + 1] - costs[i];
relationship.setProperty(costPropertyName, costDifference);
pathBuilder = pathBuilder.push(relationship);
Expand All @@ -77,13 +77,11 @@ public static Path create(
long sourceNodeId = nodeIds.get(i);
long targetNodeId = nodeIds.get(i + 1);

long id = RelationshipIds.next();
Node startNode = nodeLookup.getNodeById(sourceNodeId);
Node endNode = nodeLookup.getNodeById(targetNodeId);
var relationship = (Relationship) new VirtualRelationshipImpl(id, startNode, endNode, relationshipType);

var relationship = Neo4jProxy.virtualRelationship(
RelationshipIds.next(),
nodeLookup.getNodeById(sourceNodeId),
nodeLookup.getNodeById(targetNodeId),
relationshipType
);
var costDifference = costs.get(i + 1) - costs.get(i);
relationship.setProperty(costPropertyName, costDifference);
pathBuilder = pathBuilder.push(relationship);
Expand All @@ -104,12 +102,10 @@ public static Path create(
long sourceNodeId = nodeIds.get(i);
long targetNodeId = nodeIds.get(i + 1);

var relationship = Neo4jProxy.virtualRelationship(
RelationshipIds.next(),
nodeLookup.getNodeById(sourceNodeId),
nodeLookup.getNodeById(targetNodeId),
relationshipType
);
long id = RelationshipIds.next();
Node startNode = nodeLookup.getNodeById(sourceNodeId);
Node endNode = nodeLookup.getNodeById(targetNodeId);
var relationship = (Relationship) new VirtualRelationshipImpl(id, startNode, endNode, relationshipType);
pathBuilder = pathBuilder.push(relationship);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.neo4j.gds.compat.Neo4jProxy;
import org.neo4j.gds.compat.VirtualRelationshipImpl;
import org.neo4j.graphalgo.impl.util.PathImpl;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.kernel.impl.core.NodeEntity;
Expand Down Expand Up @@ -92,7 +92,7 @@ static Stream<Arguments> typesInput() {
arguments(1, "number"),
arguments(Boolean.TRUE, "boolean"),
arguments(new NodeEntity(null, 1), "node"),
arguments(Neo4jProxy.virtualRelationship(
arguments(new VirtualRelationshipImpl(
0,
new NodeEntity(null, 1),
new NodeEntity(null, 2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@

import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.security.AccessMode;
import org.neo4j.io.pagecache.context.CursorContext;

public interface CompatExecutionContext extends AutoCloseable {

CursorContext cursorContext();

AccessMode accessMode();

<C extends Cursor> boolean reservePartition(PartitionedScan<C> scan, C cursor);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.List;
import java.util.PriorityQueue;

public abstract class CompositeNodeCursor extends DefaultCloseListenable implements Cursor {
public class CompositeNodeCursor extends DefaultCloseListenable implements Cursor {

private final PriorityQueue<NodeLabelIndexCursor> cursorQueue;
private boolean repopulateCursorQueue;
Expand All @@ -43,7 +43,7 @@ public abstract class CompositeNodeCursor extends DefaultCloseListenable impleme

private boolean closed = false;

protected CompositeNodeCursor(List<NodeLabelIndexCursor> cursors, int[] labelIds) {
public CompositeNodeCursor(List<NodeLabelIndexCursor> cursors, int[] labelIds) {
this.cursors = cursors;
this.cursorQueue = new PriorityQueue<>(
cursors.size(),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import java.nio.file.Path;
import java.util.Map;

public class GdsDatabaseManagementServiceBuilderImpl implements GdsDatabaseManagementServiceBuilder {
public final class GdsDatabaseManagementServiceBuilderImpl implements GdsDatabaseManagementServiceBuilder {

private final DatabaseManagementServiceBuilderImplementation dbmsBuilder;

GdsDatabaseManagementServiceBuilderImpl(Path storeDir) {
public GdsDatabaseManagementServiceBuilderImpl(Path storeDir) {
this.dbmsBuilder = new DatabaseManagementServiceBuilderImplementation(storeDir);
}

Expand Down
Loading

0 comments on commit 32bc290

Please sign in to comment.