-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MapperService has to be passed in as null for EnginePlugins CodecServ…
…ice constructor (#2177) * MapperService has to be passed in as null for EnginePlugins CodecService constructor Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Addressing code review comments Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Delayed CodecService instantiation up to the shard initialization Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Added logger (associated with shard) to CodecServiceConfig Signed-off-by: Andriy Redko <andriy.redko@aiven.io> * Refactored the EngineConfigFactory / IndexShard instantiation of the CodecService Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
- Loading branch information
Showing
6 changed files
with
200 additions
and
7 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
server/src/main/java/org/opensearch/index/codec/CodecServiceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.codec; | ||
|
||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.common.Nullable; | ||
import org.opensearch.index.IndexSettings; | ||
import org.opensearch.index.mapper.MapperService; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* The configuration parameters necessary for the {@link CodecService} instance construction. | ||
*/ | ||
public final class CodecServiceConfig { | ||
private final IndexSettings indexSettings; | ||
private final MapperService mapperService; | ||
private final Logger logger; | ||
|
||
public CodecServiceConfig(IndexSettings indexSettings, @Nullable MapperService mapperService, @Nullable Logger logger) { | ||
this.indexSettings = Objects.requireNonNull(indexSettings); | ||
this.mapperService = mapperService; | ||
this.logger = logger; | ||
} | ||
|
||
public IndexSettings getIndexSettings() { | ||
return indexSettings; | ||
} | ||
|
||
@Nullable | ||
public MapperService getMapperService() { | ||
return mapperService; | ||
} | ||
|
||
@Nullable | ||
public Logger getLogger() { | ||
return logger; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
server/src/main/java/org/opensearch/index/codec/CodecServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.codec; | ||
|
||
/** | ||
* A factory for creating new {@link CodecService} instance | ||
*/ | ||
@FunctionalInterface | ||
public interface CodecServiceFactory { | ||
/** | ||
* Create new {@link CodecService} instance | ||
* @param config code service configuration | ||
* @return new {@link CodecService} instance | ||
*/ | ||
CodecService createCodecService(CodecServiceConfig config); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters