Skip to content

Commit

Permalink
Add CompatSince annotation and annotate the compat api
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwalker committed Feb 6, 2024
1 parent 6724d6a commit ea20349
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.gds.compat;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Marker interface to help with keeping the compat layer as small as necessary.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface CompatSince {

/**
* The Neo4j version that brought the change that required
* this compatibility method to exist.
*/
Neo4jVersion value();

/**
* If the Neo4jVersion is "dev", this field can be used
* to specify the exact version, since there most likely is no
* enum value for it.
*/
String dev() default "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,24 @@

public interface Neo4jProxyApi {

AccessMode accessMode(CustomAccessMode customAccessMode);

long estimateNodeCount(Read read, int label);

long estimateRelationshipCount(Read read, int sourceLabel, int targetLabel, int type);

@CompatSince(Neo4jVersion.V_5_12)
CursorContextFactory cursorContextFactory(Optional<PageCacheTracer> pageCacheTracer);

@CompatSince(Neo4jVersion.V_5_12)
DependencyResolver emptyDependencyResolver();

@CompatSince(Neo4jVersion.V_5_13)
AccessMode accessMode(CustomAccessMode customAccessMode);

@CompatSince(Neo4jVersion.V_5_14)
String neo4jArrowServerAddressHeader();

@CompatSince(Neo4jVersion.V_5_15)
String metricsManagerClass();

@CompatSince(value = Neo4jVersion.V_Dev, dev = "5.17")
long estimateNodeCount(Read read, int label);

@CompatSince(value = Neo4jVersion.V_Dev, dev = "5.17")
long estimateRelationshipCount(Read read, int sourceLabel, int targetLabel, int type);
}

0 comments on commit ea20349

Please sign in to comment.