Ensure all Steps have Javadoc (#35757)

Adds or corrects Javadoc on subclasses of Step.
This commit is contained in:
Gordon Brown 2018-11-21 10:06:57 -07:00 committed by GitHub
parent e179bd393d
commit d9c6986b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 62 additions and 2 deletions

View File

@ -32,6 +32,9 @@ import java.io.IOException;
import java.util.Collections;
import java.util.Objects;
/**
* Checks whether all shards have been correctly routed in response to an update to the allocation rules for an index.
*/
public class AllocationRoutedStep extends ClusterStateWaitStep {
public static final String NAME = "check-allocation";

View File

@ -9,6 +9,9 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
/**
* Performs an action which must be performed asynchronously because it may take time to complete.
*/
public abstract class AsyncActionStep extends Step {
private Client client;

View File

@ -9,6 +9,12 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.xcontent.ToXContentObject;
/**
* A step which will be called periodically, waiting for some condition to become true.
* Called asynchronously, as the condition may take time to check.
*
* If checking something based on the current cluster state which does not take time to check, use {@link ClusterStateWaitStep}.
*/
public abstract class AsyncWaitStep extends Step {
private Client client;

View File

@ -8,6 +8,9 @@ package org.elasticsearch.xpack.core.indexlifecycle;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.index.Index;
/**
* Updates the cluster state, similar to {@link org.elasticsearch.cluster.ClusterStateUpdateTask}.
*/
public abstract class ClusterStateActionStep extends Step {
public ClusterStateActionStep(StepKey key, StepKey nextStepKey) {

View File

@ -9,6 +9,11 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.index.Index;
/**
* Checks whether a condition has been met based on the cluster state.
*
* If checking a condition not based on the cluster state, or which may take time to evaluate, use {@link AsyncWaitStep}.
*/
public abstract class ClusterStateWaitStep extends Step {
public ClusterStateWaitStep(StepKey key, StepKey nextStepKey) {

View File

@ -11,6 +11,9 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
/**
* Deletes a single index.
*/
public class DeleteStep extends AsyncActionStep {
public static final String NAME = "delete";

View File

@ -5,6 +5,9 @@
*/
package org.elasticsearch.xpack.core.indexlifecycle;
/**
* Signals that an error was encountered during the execution of a policy on an index.
*/
public class ErrorStep extends Step {
public static final String NAME = "ERROR";

View File

@ -13,6 +13,9 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
import java.util.Objects;
/**
* Invokes a force merge on a single index.
*/
public class ForceMergeStep extends AsyncActionStep {
public static final String NAME = "forcemerge";
private final int maxNumSegments;

View File

@ -14,6 +14,9 @@ import org.elasticsearch.index.Index;
import static org.elasticsearch.xpack.core.indexlifecycle.LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY;
/**
* Initializes the {@link LifecycleExecutionState} for an index. This should be the first Step called on an index.
*/
public final class InitializePolicyContextStep extends ClusterStateActionStep {
public static final String INITIALIZATION_PHASE = "new";
public static final StepKey KEY = new StepKey(INITIALIZATION_PHASE, "init", "init");

View File

@ -21,7 +21,7 @@ import java.util.Objects;
import java.util.stream.StreamSupport;
/**
* This {@link Step} evaluates whether force_merge was successful
* This {@link Step} evaluates whether force_merge was successful by checking the segment count.
*/
public class SegmentCountStep extends AsyncWaitStep {
public static final String NAME = "segment-count";

View File

@ -27,6 +27,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
/**
* Allocates all shards in a single index to one node.
* For example, as preparation for shrinking that index.
*/
public class SetSingleNodeAllocateStep extends AsyncActionStep {
public static final String NAME = "set-single-node-allocation";

View File

@ -13,6 +13,10 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
import java.util.Objects;
/**
* Following shrinking an index and deleting the original index, this step creates an alias with the same name as the original index which
* points to the new shrunken index to allow clients to continue to use the original index name without being aware that it has shrunk.
*/
public class ShrinkSetAliasStep extends AsyncActionStep {
public static final String NAME = "aliases";
private String shrunkIndexPrefix;

View File

@ -15,6 +15,9 @@ import org.elasticsearch.common.settings.Settings;
import java.util.Objects;
/**
* Shrinks an index, using a prefix prepended to the original index name for the name of the shrunken index.
*/
public class ShrinkStep extends AsyncActionStep {
public static final String NAME = "shrink";

View File

@ -17,6 +17,9 @@ import org.elasticsearch.index.Index;
import java.io.IOException;
import java.util.Objects;
/**
* Checks whether all shards in a shrunken index have been successfully allocated.
*/
public class ShrunkShardsAllocatedStep extends ClusterStateWaitStep {
public static final String NAME = "shrunk-shards-allocated";
private String shrunkIndexPrefix;

View File

@ -19,6 +19,10 @@ import org.elasticsearch.index.Index;
import java.io.IOException;
import java.util.Objects;
/**
* Verifies that an index was created through a shrink operation, rather than created some other way.
* Also checks the name of the index to ensure it aligns with what is expected from an index shrunken via a previous step.
*/
public class ShrunkenIndexCheckStep extends ClusterStateWaitStep {
public static final String NAME = "is-shrunken-index";
private static final Logger logger = LogManager.getLogger(InitializePolicyContextStep.class);

View File

@ -19,7 +19,7 @@ import java.io.IOException;
import java.util.Objects;
/**
* A {@link LifecycleAction} which deletes the index.
* Represents one part of the execution of a {@link LifecycleAction}.
*/
public abstract class Step {
private final StepKey key;

View File

@ -5,6 +5,9 @@
*/
package org.elasticsearch.xpack.core.indexlifecycle;
/**
* Signals that the policy for an index has been fully executed.
*/
public class TerminalPolicyStep extends Step {
public static final String COMPLETED_PHASE = "completed";
public static final StepKey KEY = new StepKey(COMPLETED_PHASE, "completed", "completed");

View File

@ -14,6 +14,10 @@ import org.elasticsearch.index.Index;
import static org.elasticsearch.xpack.core.indexlifecycle.LifecycleExecutionState.ILM_CUSTOM_METADATA_KEY;
/**
* Copies the lifecycle reference date to a new index created by rolling over an alias.
* Used so that the "age" of an index doesn't get reset on rollover.
*/
public class UpdateRolloverLifecycleDateStep extends ClusterStateActionStep {
public static final String NAME = "update-rollover-lifecycle-date";

View File

@ -14,6 +14,9 @@ import org.elasticsearch.common.settings.Settings;
import java.util.Objects;
/**
* Updates the settings for an index.
*/
public class UpdateSettingsStep extends AsyncActionStep {
public static final String NAME = "update-settings";