Skip to content

Commit a4cd771

Browse files
committed
Rename methods
1 parent 05c5606 commit a4cd771

File tree

6 files changed

+16
-18
lines changed

6 files changed

+16
-18
lines changed

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/ExecuteStepsUpdateTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public ClusterState doExecute(final ClusterState currentState) throws IOExceptio
129129
logger.trace("[{}] moving cluster state to next step [{}]", index.getName(), nextStepKey);
130130
state = ClusterState.builder(state)
131131
.putProjectMetadata(
132-
IndexLifecycleTransition.moveProjectToStep(
132+
IndexLifecycleTransition.moveIndexToStep(
133133
index,
134134
state.metadata().getProject(),
135135
nextStepKey,
@@ -176,7 +176,7 @@ public ClusterState doExecute(final ClusterState currentState) throws IOExceptio
176176
} else {
177177
state = ClusterState.builder(state)
178178
.putProjectMetadata(
179-
IndexLifecycleTransition.moveProjectToStep(
179+
IndexLifecycleTransition.moveIndexToStep(
180180
index,
181181
state.metadata().getProject(),
182182
nextStepKey,

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ public StepKey resolveStepKey(ClusterState state, Index index, String phase, @Nu
161161
* thrown.
162162
* @throws IllegalArgumentException if the step movement cannot be validated
163163
*/
164-
public ProjectMetadata moveProjectToStep(ProjectMetadata project, Index index, StepKey currentStepKey, StepKey newStepKey) {
164+
public ProjectMetadata moveIndexToStep(ProjectMetadata project, Index index, StepKey currentStepKey, StepKey newStepKey) {
165165
// We manually validate here, because any API must correctly specify the current step key
166166
// when moving to an arbitrary step key (to avoid race conditions between the
167167
// check-and-set). moveProjectToStep also does its own validation, but doesn't take
168168
// the user-input for the current step (which is why we validate here for a passed in step)
169169
IndexLifecycleTransition.validateTransition(project.index(index), currentStepKey, newStepKey, policyRegistry);
170-
return IndexLifecycleTransition.moveProjectToStep(index, project, newStepKey, nowSupplier, policyRegistry, true);
170+
return IndexLifecycleTransition.moveIndexToStep(index, project, newStepKey, nowSupplier, policyRegistry, true);
171171
}
172172

173173
public ClusterState moveClusterStateToPreviouslyFailedStep(ClusterState currentState, String[] indices) {

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public static void validateTransition(
115115
* @param forcePhaseDefinitionRefresh Whether to force the phase JSON to be reread or not
116116
* @return The updated cluster state where the index moved to <code>newStepKey</code>
117117
*/
118-
static ProjectMetadata moveProjectToStep(
118+
static ProjectMetadata moveIndexToStep(
119119
Index index,
120120
ProjectMetadata project,
121121
Step.StepKey newStepKey,

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/MoveToNextStepUpdateTask.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ public ClusterState doExecute(ClusterState currentState) {
5959
if (policy.equals(idxMeta.getLifecyclePolicyName()) && currentStepKey.equals(Step.getCurrentStepKey(lifecycleState))) {
6060
logger.trace("moving [{}] to next step ({})", index.getName(), nextStepKey);
6161
return ClusterState.builder(currentState)
62-
.putProjectMetadata(
63-
IndexLifecycleTransition.moveProjectToStep(index, project, nextStepKey, nowSupplier, stepRegistry, false)
64-
)
62+
.putProjectMetadata(IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, nowSupplier, stepRegistry, false))
6563
.build();
6664
} else {
6765
// either the policy has changed or the step is now

x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/TransportMoveToStepAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public ClusterState execute(ClusterState currentState) {
147147
}
148148

149149
concreteTargetKey.set(concreteTargetStepKey);
150-
final var updatedProject = indexLifecycleService.moveProjectToStep(
150+
final var updatedProject = indexLifecycleService.moveIndexToStep(
151151
currentState.metadata().getProject(),
152152
indexMetadata.getIndex(),
153153
request.getCurrentStepKey(),

x-pack/plugin/ilm/src/test/java/org/elasticsearch/xpack/ilm/IndexLifecycleTransitionTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void testMoveClusterStateToNextStep() {
9898
);
9999
Index index = project.index(indexName).getIndex();
100100
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
101-
ProjectMetadata newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
101+
ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
102102
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
103103

104104
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
@@ -113,7 +113,7 @@ public void testMoveClusterStateToNextStep() {
113113

114114
project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
115115
index = project.index(indexName).getIndex();
116-
newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
116+
newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
117117
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
118118
}
119119

@@ -142,7 +142,7 @@ public void testMoveClusterStateToNextStepSamePhase() {
142142
);
143143
Index index = project.index(indexName).getIndex();
144144
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
145-
ProjectMetadata newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
145+
ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
146146
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
147147

148148
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
@@ -157,7 +157,7 @@ public void testMoveClusterStateToNextStepSamePhase() {
157157

158158
project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
159159
index = project.index(indexName).getIndex();
160-
newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
160+
newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
161161
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
162162
}
163163

@@ -186,7 +186,7 @@ public void testMoveClusterStateToNextStepSameAction() {
186186
);
187187
Index index = project.index(indexName).getIndex();
188188
PolicyStepsRegistry stepsRegistry = createOneStepPolicyStepRegistry(policy.getName(), new MockStep(nextStep, nextStep));
189-
ProjectMetadata newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
189+
ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
190190
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
191191

192192
LifecycleExecutionState.Builder lifecycleState = LifecycleExecutionState.builder();
@@ -201,7 +201,7 @@ public void testMoveClusterStateToNextStepSameAction() {
201201

202202
project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
203203
index = project.index(indexName).getIndex();
204-
newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStep, () -> now, stepsRegistry, false);
204+
newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStep, () -> now, stepsRegistry, false);
205205
assertProjectOnNextStep(project, index, currentStep, nextStep, newProject, now);
206206
}
207207

@@ -234,7 +234,7 @@ public void testSuccessfulValidatedMoveClusterStateToNextStep() {
234234
Settings.Builder indexSettingsBuilder = Settings.builder().put(LifecycleSettings.LIFECYCLE_NAME, policyName);
235235
ProjectMetadata project = buildProject(indexName, indexSettingsBuilder, lifecycleState.build(), policyMetadatas);
236236
Index index = project.index(indexName).getIndex();
237-
ProjectMetadata newProject = IndexLifecycleTransition.moveProjectToStep(index, project, nextStepKey, () -> now, stepRegistry, true);
237+
ProjectMetadata newProject = IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true);
238238
assertProjectOnNextStep(project, index, currentStepKey, nextStepKey, newProject, now);
239239
}
240240

@@ -257,7 +257,7 @@ public void testValidatedMoveClusterStateToNextStepWithoutPolicy() {
257257
Index index = project.index(indexName).getIndex();
258258
IllegalArgumentException exception = expectThrows(
259259
IllegalArgumentException.class,
260-
() -> IndexLifecycleTransition.moveProjectToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
260+
() -> IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
261261
);
262262
assertThat(exception.getMessage(), equalTo("index [my_index] is not associated with an Index Lifecycle Policy"));
263263
}
@@ -281,7 +281,7 @@ public void testValidatedMoveClusterStateToNextStepInvalidNextStep() {
281281
Index index = project.index(indexName).getIndex();
282282
IllegalArgumentException exception = expectThrows(
283283
IllegalArgumentException.class,
284-
() -> IndexLifecycleTransition.moveProjectToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
284+
() -> IndexLifecycleTransition.moveIndexToStep(index, project, nextStepKey, () -> now, stepRegistry, true)
285285
);
286286
assertThat(exception.getMessage(), equalTo("""
287287
step [{"phase":"next_phase","action":"next_action","name":"next_step"}] \

0 commit comments

Comments
 (0)