Skip to content

Commit

Permalink
Merge pull request #8571 from soerenreichardt/dev-token-holders-compa…
Browse files Browse the repository at this point in the history
…t-fix

Compat fix for token holders dev changes
  • Loading branch information
soerenreichardt authored Jan 9, 2024
2 parents 63c7f7b + 1509ccf commit 17bb11f
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseInternalSettings.storage_engine;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
import org.neo4j.storageengine.api.StorageEntityCursor;
import org.neo4j.storageengine.api.StoragePropertyCursor;
import org.neo4j.storageengine.api.StorageRelationshipTraversalCursor;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

import static org.neo4j.configuration.GraphDatabaseSettings.db_format;

Expand Down Expand Up @@ -137,4 +140,13 @@ public void properties(
public Edition dbmsEdition(GraphDatabaseService databaseService) {
return GraphDatabaseApiProxy.dbmsInfo(databaseService).edition;
}

@Override
public TokenHolders newTokenHolders() {
return new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ AbstractInMemoryRelationshipPropertyCursor inMemoryRelationshipPropertyCursor(
void properties(StorageEntityCursor storageCursor, StoragePropertyCursor propertyCursor, int[] propertySelection);

Edition dbmsEdition(GraphDatabaseService databaseService);

TokenHolders newTokenHolders();
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@ public static void properties(StorageEntityCursor storageCursor, StorageProperty
public static Edition dbmsEdition(GraphDatabaseService databaseService) {
return IMPL.dbmsEdition(databaseService);
}

public static TokenHolders newTokenHolders() {
return IMPL.newTokenHolders();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
import org.neo4j.gds.BaseTest;
import org.neo4j.gds.api.GraphStore;
import org.neo4j.gds.compat.GraphDatabaseApiProxy;
import org.neo4j.gds.compat.StorageEngineProxy;
import org.neo4j.gds.config.GraphProjectConfig;
import org.neo4j.gds.core.cypher.CypherGraphStore;
import org.neo4j.gds.core.loading.GraphStoreCatalog;
import org.neo4j.internal.recordstorage.InMemoryStorageEngineCompanion;
import org.neo4j.storageengine.api.StorageEngine;
import org.neo4j.token.DelegatingTokenHolder;
import org.neo4j.token.ReadOnlyTokenCreator;
import org.neo4j.token.TokenHolders;
import org.neo4j.token.api.TokenHolder;

public abstract class CypherTest extends BaseTest {

Expand All @@ -46,11 +44,7 @@ void setup() throws Exception {

GraphStoreCatalog.set(GraphProjectConfig.emptyWithName("", GraphDatabaseApiProxy.databaseLayout(db).getDatabaseName()), graphStore);

this.tokenHolders = new TokenHolders(
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_PROPERTY_KEY),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_LABEL),
new DelegatingTokenHolder(new ReadOnlyTokenCreator(), TokenHolder.TYPE_RELATIONSHIP_TYPE)
);
this.tokenHolders = StorageEngineProxy.newTokenHolders();

this.storageEngine = InMemoryStorageEngineCompanion.create(GraphDatabaseApiProxy.databaseLayout(db), tokenHolders);
this.storageEngine.schemaAndTokensLifecycle().init();
Expand Down

0 comments on commit 17bb11f

Please sign in to comment.