Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Jan 22, 2025
1 parent ac07a92 commit 19a8efb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
public abstract class AbstractLookupService<R extends AbstractLookupService.Request, T extends AbstractLookupService.TransportRequest> {
private final String actionName;
private final ClusterService clusterService;
private final CreateShardContext createShardContext;
private final LookupShardContextFactory lookupShardContextFactory;
private final TransportService transportService;
private final Executor executor;
private final BigArrays bigArrays;
Expand All @@ -152,7 +152,7 @@ public abstract class AbstractLookupService<R extends AbstractLookupService.Requ
AbstractLookupService(
String actionName,
ClusterService clusterService,
CreateShardContext createShardContext,
LookupShardContextFactory lookupShardContextFactory,
TransportService transportService,
BigArrays bigArrays,
BlockFactory blockFactory,
Expand All @@ -161,7 +161,7 @@ public abstract class AbstractLookupService<R extends AbstractLookupService.Requ
) {
this.actionName = actionName;
this.clusterService = clusterService;
this.createShardContext = createShardContext;
this.lookupShardContextFactory = lookupShardContextFactory;
this.transportService = transportService;
this.executor = transportService.getThreadPool().executor(ThreadPool.Names.SEARCH);
this.bigArrays = bigArrays;
Expand Down Expand Up @@ -324,7 +324,7 @@ private void doLookup(T request, CancellableTask task, ActionListener<List<Page>
final List<Releasable> releasables = new ArrayList<>(6);
boolean started = false;
try {
LookupShardContext shardContext = createShardContext.create(request.shardId);
LookupShardContext shardContext = lookupShardContextFactory.create(request.shardId);
releasables.add(shardContext.release);
final LocalCircuitBreaker localBreaker = new LocalCircuitBreaker(
blockFactory.breaker(),
Expand Down Expand Up @@ -677,10 +677,10 @@ public boolean hasReferences() {
/**
* Create a {@link LookupShardContext} for a locally allocated {@link ShardId}.
*/
public interface CreateShardContext {
public interface LookupShardContextFactory {
LookupShardContext create(ShardId shardId) throws IOException;

static CreateShardContext fromSearchService(SearchService searchService) {
static LookupShardContextFactory fromSearchService(SearchService searchService) {
return shardId -> {
ShardSearchRequest shardSearchRequest = new ShardSearchRequest(shardId, 0, AliasFilter.EMPTY);
return LookupShardContext.fromSearchContext(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public class EnrichLookupService extends AbstractLookupService<EnrichLookupServi

public EnrichLookupService(
ClusterService clusterService,
CreateShardContext createShardContext,
LookupShardContextFactory lookupShardContextFactory,
TransportService transportService,
BigArrays bigArrays,
BlockFactory blockFactory
) {
super(
LOOKUP_ACTION_NAME,
clusterService,
createShardContext,
lookupShardContextFactory,
transportService,
bigArrays,
blockFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public class LookupFromIndexService extends AbstractLookupService<LookupFromInde

public LookupFromIndexService(
ClusterService clusterService,
CreateShardContext createShardContext,
LookupShardContextFactory lookupShardContextFactory,
TransportService transportService,
BigArrays bigArrays,
BlockFactory blockFactory
) {
super(
LOOKUP_ACTION_NAME,
clusterService,
createShardContext,
lookupShardContextFactory,
transportService,
bigArrays,
blockFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,18 @@ public TransportEsqlQueryAction(
exchangeService.registerTransportHandler(transportService);
this.exchangeService = exchangeService;
this.enrichPolicyResolver = new EnrichPolicyResolver(clusterService, transportService, planExecutor.indexResolver());
AbstractLookupService.CreateShardContext lookupCreateShardContext = AbstractLookupService.CreateShardContext.fromSearchService(
searchService
);
AbstractLookupService.LookupShardContextFactory lookupLookupShardContextFactory = AbstractLookupService.LookupShardContextFactory
.fromSearchService(searchService);
this.enrichLookupService = new EnrichLookupService(
clusterService,
lookupCreateShardContext,
lookupLookupShardContextFactory,
transportService,
bigArrays,
blockFactory
);
this.lookupFromIndexService = new LookupFromIndexService(
clusterService,
lookupCreateShardContext,
lookupLookupShardContextFactory,
transportService,
bigArrays,
blockFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,13 @@ private LookupFromIndexService lookupService(DriverContext mainContext) {
DriverContext ctx = beCranky ? crankyDriverContext() : driverContext();
BigArrays bigArrays = ctx.bigArrays();
BlockFactory blockFactory = ctx.blockFactory();
return new LookupFromIndexService(clusterService, createShardContext(), transportService(clusterService), bigArrays, blockFactory);
return new LookupFromIndexService(
clusterService,
lookupShardContextFactory(),
transportService(clusterService),
bigArrays,
blockFactory
);
}

private ThreadPool threadPool() {
Expand Down Expand Up @@ -216,7 +222,7 @@ private TransportService transportService(ClusterService clusterService) {
return transportService;
}

private AbstractLookupService.CreateShardContext createShardContext() {
private AbstractLookupService.LookupShardContextFactory lookupShardContextFactory() {
return shardId -> {
MapperServiceTestCase mapperHelper = new MapperServiceTestCase() {
};
Expand Down

0 comments on commit 19a8efb

Please sign in to comment.