Skip to content

Commit

Permalink
[BWC and API enforcement] Reduce the visibility of some existing APIs (
Browse files Browse the repository at this point in the history
…#11242)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored Nov 17, 2023
1 parent 37ec313 commit 03a9650
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.apache.logging.log4j.Logger;
import org.opensearch.action.OriginalIndices;
import org.opensearch.common.Nullable;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.annotation.InternalApi;
import org.opensearch.common.lease.Releasable;
import org.opensearch.common.util.concurrent.AtomicArray;
import org.opensearch.search.SearchPhaseResult;
Expand All @@ -49,9 +49,9 @@
/**
* This class provide contextual state and access to resources across multiple search phases.
*
* @opensearch.api
* @opensearch.internal
*/
@PublicApi(since = "1.0.0")
@InternalApi
public interface SearchPhaseContext extends Executor {
// TODO maybe we can make this concrete later - for now we just implement this in the base class for all initial phases

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.apache.logging.log4j.LogManager;
import org.apache.lucene.search.TotalHits;
import org.opensearch.common.annotation.InternalApi;

import java.util.EnumMap;
import java.util.HashMap;
Expand All @@ -22,7 +23,8 @@
*
* @opensearch.internal
*/
public class SearchRequestContext {
@InternalApi
class SearchRequestContext {
private final SearchRequestOperationsListener searchRequestOperationsListener;
private long absoluteStartNanos;
private final Map<String, Long> phaseTookMap;
Expand All @@ -32,11 +34,11 @@ public class SearchRequestContext {
/**
* This constructor is for testing only
*/
public SearchRequestContext() {
SearchRequestContext() {
this(new SearchRequestOperationsListener.CompositeListener(List.of(), LogManager.getLogger()));
}

public SearchRequestContext(SearchRequestOperationsListener searchRequestOperationsListener) {
SearchRequestContext(SearchRequestOperationsListener searchRequestOperationsListener) {
this.searchRequestOperationsListener = searchRequestOperationsListener;
this.absoluteStartNanos = System.nanoTime();
this.phaseTookMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.annotation.InternalApi;

import java.util.List;

/**
* A listener for search, fetch and context events at the coordinator node level
*
* @opensearch.api
* @opensearch.internal
*/
@PublicApi(since = "1.0.0")
public interface SearchRequestOperationsListener {
@InternalApi
interface SearchRequestOperationsListener {

void onPhaseStart(SearchPhaseContext context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public Parameter<T> setValidator(Consumer<T> validator) {
/**
* Configure a custom serializer for this parameter
*/
protected Parameter<T> setSerializer(Serializer<T> serializer, Function<T, String> conflictSerializer) {
public Parameter<T> setSerializer(Serializer<T> serializer, Function<T, String> conflictSerializer) {
this.serializer = serializer;
this.conflictSerializer = conflictSerializer;
return this;
Expand All @@ -291,7 +291,7 @@ protected Parameter<T> setSerializer(Serializer<T> serializer, Function<T, Strin
/**
* Configure a custom serialization check for this parameter
*/
protected Parameter<T> setSerializerCheck(SerializerCheck<T> check) {
public Parameter<T> setSerializerCheck(SerializerCheck<T> check) {
this.serializerCheck = check;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.opensearch.action.search.SearchPhase;
import org.opensearch.action.search.SearchPhaseContext;
import org.opensearch.action.search.SearchPhaseName;
import org.opensearch.action.search.SearchRequestContext;
import org.opensearch.action.search.SearchRequestStats;
import org.opensearch.index.search.stats.SearchStats.Stats;
import org.opensearch.test.OpenSearchTestCase;
Expand Down Expand Up @@ -86,7 +85,7 @@ public void testShardLevelSearchGroupStats() throws Exception {
when(mockSearchPhase.getSearchPhaseName()).thenReturn(searchPhaseName);
for (int iterator = 0; iterator < paramValue; iterator++) {
testRequestStats.onPhaseStart(ctx);
testRequestStats.onPhaseEnd(ctx, new SearchRequestContext());
testRequestStats.onPhaseEnd(ctx, null /* not needed */);
}
}
searchStats1.setSearchRequestStats(testRequestStats);
Expand Down

0 comments on commit 03a9650

Please sign in to comment.