Skip to content

Commit

Permalink
Merge pull request #8518 from neo-technology/stitchup-fabric
Browse files Browse the repository at this point in the history
Stitchup fabric
  • Loading branch information
jjaderberg authored Dec 18, 2023
2 parents eb5d31d + 2c525f7 commit 74dd6e0
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.neo4j.configuration.connectors.ConnectorType;
import org.neo4j.configuration.helpers.DatabaseNameValidator;
import org.neo4j.dbms.api.DatabaseManagementService;
import org.neo4j.fabric.FabricDatabaseManager;
import org.neo4j.gds.annotation.SuppressForbidden;
import org.neo4j.gds.compat.CompatCallableProcedure;
import org.neo4j.gds.compat.CompatExecutionMonitor;
Expand Down Expand Up @@ -745,12 +744,6 @@ public TransactionalContext newQueryContext(
return contextFactory.newContext(tx, queryText, queryParameters, QueryExecutionConfiguration.DEFAULT_CONFIG);
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseManager = GraphDatabaseApiProxy.resolveDependency(databaseService, FabricDatabaseManager.class);
return databaseManager.isFabricDatabase(GraphDatabaseApiProxy.databaseId(databaseService));
}

public abstract CursorContextFactory cursorContextFactory(Optional<PageCacheTracer> pageCacheTracer);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
Expand All @@ -40,6 +41,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReferenceImpl;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -183,4 +186,13 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReferenceImpl.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
Expand All @@ -40,6 +41,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReferenceImpl;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -183,4 +186,13 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReferenceImpl.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
Expand All @@ -40,6 +41,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReferenceImpl;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -183,4 +186,13 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReferenceImpl.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.gds.compat._5x.CompatAccessModeImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.TokenSet;
Expand All @@ -44,6 +45,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReferenceImpl;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -202,4 +205,13 @@ public boolean allowsReadNodeProperty(
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReferenceImpl.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.gds.compat._5x.CompatAccessModeImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.TokenSet;
Expand All @@ -44,6 +45,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReferenceImpl;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -203,4 +206,13 @@ public String neo4jArrowServerAddressHeader() {
// TODO: replace this with a dependency to neo4j once we moved the corresponding piece to a public module
return "ArrowPluginAddress";
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReferenceImpl.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
package org.neo4j.gds.compat._56;

import org.neo4j.common.DependencyResolver;
import org.neo4j.fabric.FabricDatabaseManager;
import org.neo4j.gds.compat.BoltTransactionRunner;
import org.neo4j.gds.compat.CompatExecutionContext;
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat.StoreScan;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.NodeCursor;
import org.neo4j.internal.kernel.api.NodeLabelIndexCursor;
Expand Down Expand Up @@ -232,4 +234,10 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseManager = GraphDatabaseApiProxy.resolveDependency(databaseService, FabricDatabaseManager.class);
return databaseManager.isFabricDatabase(GraphDatabaseApiProxy.databaseId(databaseService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
package org.neo4j.gds.compat._57;

import org.neo4j.common.DependencyResolver;
import org.neo4j.fabric.FabricDatabaseManager;
import org.neo4j.gds.compat.BoltTransactionRunner;
import org.neo4j.gds.compat.CompatExecutionContext;
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat.StoreScan;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.NodeCursor;
import org.neo4j.internal.kernel.api.NodeLabelIndexCursor;
Expand Down Expand Up @@ -237,4 +239,10 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseManager = GraphDatabaseApiProxy.resolveDependency(databaseService, FabricDatabaseManager.class);
return databaseManager.isFabricDatabase(GraphDatabaseApiProxy.databaseId(databaseService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
package org.neo4j.gds.compat._58;

import org.neo4j.common.DependencyResolver;
import org.neo4j.fabric.FabricDatabaseManager;
import org.neo4j.gds.compat.BoltTransactionRunner;
import org.neo4j.gds.compat.CompatExecutionContext;
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
Expand Down Expand Up @@ -182,4 +184,10 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseManager = GraphDatabaseApiProxy.resolveDependency(databaseService, FabricDatabaseManager.class);
return databaseManager.isFabricDatabase(GraphDatabaseApiProxy.databaseId(databaseService));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.neo4j.gds.compat.GlobalProcedureRegistry;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat._5x.CommonNeo4jProxyImpl;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.internal.kernel.api.Cursor;
import org.neo4j.internal.kernel.api.PartitionedScan;
import org.neo4j.internal.kernel.api.exceptions.ProcedureException;
Expand All @@ -40,6 +41,8 @@
import org.neo4j.kernel.api.KernelTransaction;
import org.neo4j.kernel.api.procedure.Context;
import org.neo4j.kernel.api.procedure.GlobalProcedures;
import org.neo4j.kernel.database.DatabaseReference;
import org.neo4j.kernel.database.DatabaseReferenceRepository;
import org.neo4j.kernel.impl.store.RecordStore;
import org.neo4j.kernel.impl.store.record.AbstractBaseRecord;
import org.neo4j.procedure.Mode;
Expand Down Expand Up @@ -182,4 +185,13 @@ public void close() {
public String neo4jArrowServerAddressHeader() {
throw new UnsupportedOperationException("Not implemented for Neo4j versions <5.14");
}

@Override
public boolean isCompositeDatabase(GraphDatabaseService databaseService) {
var databaseId = GraphDatabaseApiProxy.databaseId(databaseService);
var repo = GraphDatabaseApiProxy.resolveDependency(databaseService, DatabaseReferenceRepository.class);
return repo.getCompositeDatabaseReferences().stream()
.map(DatabaseReference.Internal::databaseId)
.anyMatch(databaseId::equals);
}
}

0 comments on commit 74dd6e0

Please sign in to comment.