Skip to content

Commit

Permalink
Remove set prefix from builder's setter methods
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
Sachin Kale committed Dec 23, 2022
1 parent 10fcab9 commit 7f77ca6
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,29 @@ EngineConfig engineConfigWithLargerIndexingMemory(EngineConfig config) {
.put("indices.memory.index_buffer_size", "10mb")
.build();
IndexSettings indexSettings = new IndexSettings(config.getIndexSettings().getIndexMetadata(), settings);
return new EngineConfig.Builder().setShardId(config.getShardId())
.setThreadPool(config.getThreadPool())
.setIndexSettings(indexSettings)
.setWarmer(config.getWarmer())
.setStore(config.getStore())
.setMergePolicy(config.getMergePolicy())
.setAnalyzer(config.getAnalyzer())
.setSimilarity(config.getSimilarity())
.setCodecService(new CodecService(null, LogManager.getLogger(IndexingMemoryControllerIT.class)))
.setEventListener(config.getEventListener())
.setQueryCache(config.getQueryCache())
.setQueryCachingPolicy(config.getQueryCachingPolicy())
.setTranslogConfig(config.getTranslogConfig())
.setFlushMergesAfter(config.getFlushMergesAfter())
.setExternalRefreshListener(config.getExternalRefreshListener())
.setInternalRefreshListener(config.getInternalRefreshListener())
.setIndexSort(config.getIndexSort())
.setCircuitBreakerService(config.getCircuitBreakerService())
.setGlobalCheckpointSupplier(config.getGlobalCheckpointSupplier())
.setRetentionLeasesSupplier(config.retentionLeasesSupplier())
.setPrimaryTermSupplier(config.getPrimaryTermSupplier())
.setTombstoneDocSupplier(config.getTombstoneDocSupplier())
.create();
return new EngineConfig.Builder().shardId(config.getShardId())
.threadPool(config.getThreadPool())
.indexSettings(indexSettings)
.warmer(config.getWarmer())
.store(config.getStore())
.mergePolicy(config.getMergePolicy())
.analyzer(config.getAnalyzer())
.similarity(config.getSimilarity())
.codecService(new CodecService(null, LogManager.getLogger(IndexingMemoryControllerIT.class)))
.eventListener(config.getEventListener())
.queryCache(config.getQueryCache())
.queryCachingPolicy(config.getQueryCachingPolicy())
.translogConfig(config.getTranslogConfig())
.flushMergesAfter(config.getFlushMergesAfter())
.externalRefreshListener(config.getExternalRefreshListener())
.internalRefreshListener(config.getInternalRefreshListener())
.indexSort(config.getIndexSort())
.circuitBreakerService(config.getCircuitBreakerService())
.globalCheckpointSupplier(config.getGlobalCheckpointSupplier())
.retentionLeasesSupplier(config.retentionLeasesSupplier())
.primaryTermSupplier(config.getPrimaryTermSupplier())
.tombstoneDocSupplier(config.getTombstoneDocSupplier())
.build();
}

@Override
Expand Down
52 changes: 26 additions & 26 deletions server/src/main/java/org/opensearch/index/engine/EngineConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,132 +472,132 @@ public static class Builder {
private boolean isReadOnlyReplica;
private TranslogFactory translogFactory = new InternalTranslogFactory();

public Builder setShardId(ShardId shardId) {
public Builder shardId(ShardId shardId) {
this.shardId = shardId;
return this;
}

public Builder setThreadPool(ThreadPool threadPool) {
public Builder threadPool(ThreadPool threadPool) {
this.threadPool = threadPool;
return this;
}

public Builder setIndexSettings(IndexSettings indexSettings) {
public Builder indexSettings(IndexSettings indexSettings) {
this.indexSettings = indexSettings;
return this;
}

public Builder setWarmer(Engine.Warmer warmer) {
public Builder warmer(Engine.Warmer warmer) {
this.warmer = warmer;
return this;
}

public Builder setStore(Store store) {
public Builder store(Store store) {
this.store = store;
return this;
}

public Builder setMergePolicy(MergePolicy mergePolicy) {
public Builder mergePolicy(MergePolicy mergePolicy) {
this.mergePolicy = mergePolicy;
return this;
}

public Builder setAnalyzer(Analyzer analyzer) {
public Builder analyzer(Analyzer analyzer) {
this.analyzer = analyzer;
return this;
}

public Builder setSimilarity(Similarity similarity) {
public Builder similarity(Similarity similarity) {
this.similarity = similarity;
return this;
}

public Builder setCodecService(CodecService codecService) {
public Builder codecService(CodecService codecService) {
this.codecService = codecService;
return this;
}

public Builder setEventListener(Engine.EventListener eventListener) {
public Builder eventListener(Engine.EventListener eventListener) {
this.eventListener = eventListener;
return this;
}

public Builder setQueryCache(QueryCache queryCache) {
public Builder queryCache(QueryCache queryCache) {
this.queryCache = queryCache;
return this;
}

public Builder setQueryCachingPolicy(QueryCachingPolicy queryCachingPolicy) {
public Builder queryCachingPolicy(QueryCachingPolicy queryCachingPolicy) {
this.queryCachingPolicy = queryCachingPolicy;
return this;
}

public Builder setTranslogConfig(TranslogConfig translogConfig) {
public Builder translogConfig(TranslogConfig translogConfig) {
this.translogConfig = translogConfig;
return this;
}

public Builder setFlushMergesAfter(TimeValue flushMergesAfter) {
public Builder flushMergesAfter(TimeValue flushMergesAfter) {
this.flushMergesAfter = flushMergesAfter;
return this;
}

public Builder setExternalRefreshListener(List<ReferenceManager.RefreshListener> externalRefreshListener) {
public Builder externalRefreshListener(List<ReferenceManager.RefreshListener> externalRefreshListener) {
this.externalRefreshListener = externalRefreshListener;
return this;
}

public Builder setInternalRefreshListener(List<ReferenceManager.RefreshListener> internalRefreshListener) {
public Builder internalRefreshListener(List<ReferenceManager.RefreshListener> internalRefreshListener) {
this.internalRefreshListener = internalRefreshListener;
return this;
}

public Builder setIndexSort(Sort indexSort) {
public Builder indexSort(Sort indexSort) {
this.indexSort = indexSort;
return this;
}

public Builder setCircuitBreakerService(CircuitBreakerService circuitBreakerService) {
public Builder circuitBreakerService(CircuitBreakerService circuitBreakerService) {
this.circuitBreakerService = circuitBreakerService;
return this;
}

public Builder setGlobalCheckpointSupplier(LongSupplier globalCheckpointSupplier) {
public Builder globalCheckpointSupplier(LongSupplier globalCheckpointSupplier) {
this.globalCheckpointSupplier = globalCheckpointSupplier;
return this;
}

public Builder setRetentionLeasesSupplier(Supplier<RetentionLeases> retentionLeasesSupplier) {
public Builder retentionLeasesSupplier(Supplier<RetentionLeases> retentionLeasesSupplier) {
this.retentionLeasesSupplier = retentionLeasesSupplier;
return this;
}

public Builder setPrimaryTermSupplier(LongSupplier primaryTermSupplier) {
public Builder primaryTermSupplier(LongSupplier primaryTermSupplier) {
this.primaryTermSupplier = primaryTermSupplier;
return this;
}

public Builder setTombstoneDocSupplier(TombstoneDocSupplier tombstoneDocSupplier) {
public Builder tombstoneDocSupplier(TombstoneDocSupplier tombstoneDocSupplier) {
this.tombstoneDocSupplier = tombstoneDocSupplier;
return this;
}

public Builder setTranslogDeletionPolicyFactory(TranslogDeletionPolicyFactory translogDeletionPolicyFactory) {
public Builder translogDeletionPolicyFactory(TranslogDeletionPolicyFactory translogDeletionPolicyFactory) {
this.translogDeletionPolicyFactory = translogDeletionPolicyFactory;
return this;
}

public Builder setIsReadOnlyReplica(boolean isReadOnlyReplica) {
public Builder readOnlyReplica(boolean isReadOnlyReplica) {
this.isReadOnlyReplica = isReadOnlyReplica;
return this;
}

public Builder setTranslogFactory(TranslogFactory translogFactory) {
public Builder translogFactory(TranslogFactory translogFactory) {
this.translogFactory = translogFactory;
return this;
}

public EngineConfig create() {
public EngineConfig build() {
return new EngineConfig(this);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,32 @@ public EngineConfig newEngineConfig(
codecServiceToUse = newCodecServiceOrDefault(indexSettings, null, null, null);
}

return new EngineConfig.Builder().setShardId(shardId)
.setThreadPool(threadPool)
.setIndexSettings(indexSettings)
.setWarmer(warmer)
.setStore(store)
.setMergePolicy(mergePolicy)
.setAnalyzer(analyzer)
.setSimilarity(similarity)
.setCodecService(codecServiceToUse)
.setEventListener(eventListener)
.setQueryCache(queryCache)
.setQueryCachingPolicy(queryCachingPolicy)
.setTranslogConfig(translogConfig)
.setTranslogDeletionPolicyFactory(translogDeletionPolicyFactory)
.setFlushMergesAfter(flushMergesAfter)
.setExternalRefreshListener(externalRefreshListener)
.setInternalRefreshListener(internalRefreshListener)
.setIndexSort(indexSort)
.setCircuitBreakerService(circuitBreakerService)
.setGlobalCheckpointSupplier(globalCheckpointSupplier)
.setRetentionLeasesSupplier(retentionLeasesSupplier)
.setPrimaryTermSupplier(primaryTermSupplier)
.setTombstoneDocSupplier(tombstoneDocSupplier)
.setIsReadOnlyReplica(isReadOnlyReplica)
.setTranslogFactory(translogFactory)
.create();
return new EngineConfig.Builder().shardId(shardId)
.threadPool(threadPool)
.indexSettings(indexSettings)
.warmer(warmer)
.store(store)
.mergePolicy(mergePolicy)
.analyzer(analyzer)
.similarity(similarity)
.codecService(codecServiceToUse)
.eventListener(eventListener)
.queryCache(queryCache)
.queryCachingPolicy(queryCachingPolicy)
.translogConfig(translogConfig)
.translogDeletionPolicyFactory(translogDeletionPolicyFactory)
.flushMergesAfter(flushMergesAfter)
.externalRefreshListener(externalRefreshListener)
.internalRefreshListener(internalRefreshListener)
.indexSort(indexSort)
.circuitBreakerService(circuitBreakerService)
.globalCheckpointSupplier(globalCheckpointSupplier)
.retentionLeasesSupplier(retentionLeasesSupplier)
.primaryTermSupplier(primaryTermSupplier)
.tombstoneDocSupplier(tombstoneDocSupplier)
.readOnlyReplica(isReadOnlyReplica)
.translogFactory(translogFactory)
.build();
}

public CodecService newCodecServiceOrDefault(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public void setUp() throws Exception {
}

public void testEngineConfig_DefaultValueForReadOnlyEngine() {
EngineConfig config = new EngineConfig.Builder().setIndexSettings(defaultIndexSettings)
.setRetentionLeasesSupplier(() -> RetentionLeases.EMPTY)
.create();
EngineConfig config = new EngineConfig.Builder().indexSettings(defaultIndexSettings)
.retentionLeasesSupplier(() -> RetentionLeases.EMPTY)
.build();
assertFalse(config.isReadOnlyReplica());
}

Expand All @@ -56,9 +56,9 @@ public void testEngineConfig_ReadOnlyEngineWithSegRepEnabled() {
}

private EngineConfig createReadOnlyEngine(IndexSettings indexSettings) {
return new EngineConfig.Builder().setIndexSettings(indexSettings)
.setRetentionLeasesSupplier(() -> RetentionLeases.EMPTY)
.setIsReadOnlyReplica(true)
.create();
return new EngineConfig.Builder().indexSettings(indexSettings)
.retentionLeasesSupplier(() -> RetentionLeases.EMPTY)
.readOnlyReplica(true)
.build();
}
}
Loading

0 comments on commit 7f77ca6

Please sign in to comment.