Skip to content

Commit fc63e6c

Browse files
authored
Rename NoopEngine -> NoOpEngine (#31398)
In #31163 (comment) Jason requested renaming NoopEngine to NoOpEngine. This commit renames the class and relevant parts. Relates to #31141
1 parent 1c4d8a0 commit fc63e6c

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

server/src/main/java/org/elasticsearch/index/engine/NoopEngine.java renamed to server/src/main/java/org/elasticsearch/index/engine/NoOpEngine.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import java.util.stream.Stream;
4343

4444
/**
45-
* NoopEngine is an engine implementation that does nothing but the bare minimum
45+
* NoOpEngine is an engine implementation that does nothing but the bare minimum
4646
* required in order to have an engine. All attempts to do something (search,
4747
* index, get), throw {@link UnsupportedOperationException}. This does maintain
4848
* a translog with a deletion policy so that when flushing, no translog is
@@ -52,7 +52,7 @@
5252
* Directory so that the last commit's user data can be read for the historyUUID
5353
* and last committed segment info.
5454
*/
55-
final class NoopEngine extends Engine {
55+
final class NoOpEngine extends Engine {
5656

5757
private static final Translog.Snapshot EMPTY_TRANSLOG_SNAPSHOT = new Translog.Snapshot() {
5858
@Override
@@ -79,7 +79,7 @@ public void close() {
7979
private final String historyUUID;
8080
private final SegmentInfos lastCommittedSegmentInfos;
8181

82-
NoopEngine(EngineConfig engineConfig) {
82+
NoOpEngine(EngineConfig engineConfig) {
8383
super(engineConfig);
8484

8585
store.incRef();
@@ -114,7 +114,7 @@ public void close() {
114114
}
115115
}
116116
}
117-
logger.trace("created new NoopEngine");
117+
logger.trace("created new NoOpEngine");
118118
}
119119

120120
private Translog openTranslog(EngineConfig engineConfig, TranslogDeletionPolicy translogDeletionPolicy,
@@ -169,32 +169,32 @@ public void trimOperationsFromTranslog(long belowTerm, long aboveSeqNo) throws E
169169

170170
@Override
171171
public IndexResult index(Index index) {
172-
throw new UnsupportedOperationException("indexing is not supported on a noop engine");
172+
throw new UnsupportedOperationException("indexing is not supported on a noOp engine");
173173
}
174174

175175
@Override
176176
public DeleteResult delete(Delete delete) {
177-
throw new UnsupportedOperationException("deletion is not supported on a noop engine");
177+
throw new UnsupportedOperationException("deletion is not supported on a noOp engine");
178178
}
179179

180180
@Override
181181
public NoOpResult noOp(NoOp noOp) {
182-
throw new UnsupportedOperationException("noop is not supported on a noop engine");
182+
throw new UnsupportedOperationException("noOp is not supported on a noOp engine");
183183
}
184184

185185
@Override
186186
public SyncedFlushResult syncFlush(String syncId, CommitId expectedCommitId) throws EngineException {
187-
throw new UnsupportedOperationException("synced flush is not supported on a noop engine");
187+
throw new UnsupportedOperationException("synced flush is not supported on a noOp engine");
188188
}
189189

190190
@Override
191191
public GetResult get(Get get, BiFunction<String, SearcherScope, Searcher> searcherFactory) throws EngineException {
192-
throw new UnsupportedOperationException("gets are not supported on a noop engine");
192+
throw new UnsupportedOperationException("gets are not supported on a noOp engine");
193193
}
194194

195195
@Override
196196
public Searcher acquireSearcher(String source, SearcherScope scope) throws EngineException {
197-
throw new UnsupportedOperationException("searching is not supported on a noop engine");
197+
throw new UnsupportedOperationException("searching is not supported on a noOp engine");
198198
}
199199

200200
@Override
@@ -278,7 +278,7 @@ public void refresh(String source) throws EngineException {
278278
// Override the refreshNeeded method so that we don't attempt to acquire a searcher checking if we need to refresh
279279
@Override
280280
public boolean refreshNeeded() {
281-
// We never need to refresh a noop engine so always return false
281+
// We never need to refresh a noOp engine so always return false
282282
return false;
283283
}
284284

server/src/test/java/org/elasticsearch/index/engine/NoopEngineTests.java renamed to server/src/test/java/org/elasticsearch/index/engine/NoOpEngineTests.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
import static org.hamcrest.Matchers.equalTo;
4242
import static org.hamcrest.Matchers.instanceOf;
4343

44-
public class NoopEngineTests extends EngineTestCase {
44+
public class NoOpEngineTests extends EngineTestCase {
4545
private static final IndexSettings INDEX_SETTINGS = IndexSettingsModule.newIndexSettings("index", Settings.EMPTY);
4646

4747
public void testNoopEngine() throws IOException {
4848
engine.close();
49-
final NoopEngine engine = new NoopEngine(noopConfig(INDEX_SETTINGS, store, primaryTranslogDir));
49+
final NoOpEngine engine = new NoOpEngine(noOpConfig(INDEX_SETTINGS, store, primaryTranslogDir));
5050
expectThrows(UnsupportedOperationException.class, () -> engine.index(null));
5151
expectThrows(UnsupportedOperationException.class, () -> engine.delete(null));
5252
expectThrows(UnsupportedOperationException.class, () -> engine.noOp(null));
@@ -63,11 +63,11 @@ public void testNoopEngine() throws IOException {
6363

6464
public void testTwoNoopEngines() throws IOException {
6565
engine.close();
66-
// It's so noop you can even open two engines for the same store without tripping anything,
66+
// It's so noOp you can even open two engines for the same store without tripping anything,
6767
// this ensures we're not doing any kind of locking on the store or filesystem level in
68-
// the noop engine
69-
final NoopEngine engine1 = new NoopEngine(noopConfig(INDEX_SETTINGS, store, primaryTranslogDir));
70-
final NoopEngine engine2 = new NoopEngine(noopConfig(INDEX_SETTINGS, store, primaryTranslogDir));
68+
// the noOp engine
69+
final NoOpEngine engine1 = new NoOpEngine(noOpConfig(INDEX_SETTINGS, store, primaryTranslogDir));
70+
final NoOpEngine engine2 = new NoOpEngine(noOpConfig(INDEX_SETTINGS, store, primaryTranslogDir));
7171
engine1.close();
7272
engine2.close();
7373
}
@@ -97,24 +97,24 @@ public void testNoopAfterRegularEngine() throws IOException {
9797
long maxSeqNo = engine.getSeqNoStats(100L).getMaxSeqNo();
9898
engine.close();
9999

100-
final NoopEngine noopEngine = new NoopEngine(noopConfig(INDEX_SETTINGS, store, primaryTranslogDir, tracker));
101-
assertThat(noopEngine.getLocalCheckpoint(), equalTo(localCheckpoint));
102-
assertThat(noopEngine.getSeqNoStats(100L).getMaxSeqNo(), equalTo(maxSeqNo));
103-
try (Engine.IndexCommitRef ref = noopEngine.acquireLastIndexCommit(false)) {
100+
final NoOpEngine noOpEngine = new NoOpEngine(noOpConfig(INDEX_SETTINGS, store, primaryTranslogDir, tracker));
101+
assertThat(noOpEngine.getLocalCheckpoint(), equalTo(localCheckpoint));
102+
assertThat(noOpEngine.getSeqNoStats(100L).getMaxSeqNo(), equalTo(maxSeqNo));
103+
try (Engine.IndexCommitRef ref = noOpEngine.acquireLastIndexCommit(false)) {
104104
try (IndexReader reader = DirectoryReader.open(ref.getIndexCommit())) {
105105
assertThat(reader.numDocs(), equalTo(docs));
106106
}
107107
}
108-
noopEngine.close();
108+
noOpEngine.close();
109109
}
110110

111111
public void testNoopEngineWithInvalidTranslogUUID() throws IOException {
112112
Path newTranslogDir = createTempDir();
113-
// A new translog will have a different UUID than the existing store/noop engine does
113+
// A new translog will have a different UUID than the existing store/noOp engine does
114114
Translog newTranslog = createTranslog(newTranslogDir, () -> 1L);
115115
newTranslog.close();
116116
EngineCreationFailureException e = expectThrows(EngineCreationFailureException.class,
117-
() -> new NoopEngine(noopConfig(INDEX_SETTINGS, store, newTranslogDir)));
117+
() -> new NoOpEngine(noOpConfig(INDEX_SETTINGS, store, newTranslogDir)));
118118
assertThat(e.getCause(), instanceOf(TranslogCorruptedException.class));
119119
}
120120
}

test/framework/src/main/java/org/elasticsearch/index/engine/EngineTestCase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,11 @@ public void onFailedEngine(String reason, @Nullable Exception e) {
466466
return config;
467467
}
468468

469-
protected EngineConfig noopConfig(IndexSettings indexSettings, Store store, Path translogPath) {
470-
return noopConfig(indexSettings, store, translogPath, null);
469+
protected EngineConfig noOpConfig(IndexSettings indexSettings, Store store, Path translogPath) {
470+
return noOpConfig(indexSettings, store, translogPath, null);
471471
}
472472

473-
protected EngineConfig noopConfig(IndexSettings indexSettings, Store store, Path translogPath, LongSupplier globalCheckpointSupplier) {
473+
protected EngineConfig noOpConfig(IndexSettings indexSettings, Store store, Path translogPath, LongSupplier globalCheckpointSupplier) {
474474
return config(indexSettings, store, translogPath, newMergePolicy(), null, null, globalCheckpointSupplier);
475475
}
476476

0 commit comments

Comments
 (0)