-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Version the order of the actions in a phase.
- Loading branch information
Showing
16 changed files
with
396 additions
and
146 deletions.
There are no files selected for viewing
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
104 changes: 104 additions & 0 deletions
104
...re/src/main/java/org/elasticsearch/xpack/core/ilm/TimeseriesLifecycleActionsRegistry.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,104 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.ilm; | ||
|
||
import org.elasticsearch.common.util.set.Sets; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.stream.Stream; | ||
|
||
/** | ||
* Defines a record of the actions that are allowed for the timeseries lifecycle. | ||
* The order of actions is versioned, newer versions must contain all previous defined actions and are | ||
* allowed to make additive changes (we do not support removing actions, but actions to be removed | ||
* must be converted to no-ops) | ||
*/ | ||
public final class TimeseriesLifecycleActionsRegistry { | ||
|
||
public static final int VERSION_ONE = 1; | ||
public static final int CURRENT_VERSION = VERSION_ONE; | ||
|
||
static final String HOT_PHASE = "hot"; | ||
static final String WARM_PHASE = "warm"; | ||
static final String COLD_PHASE = "cold"; | ||
static final String FROZEN_PHASE = "frozen"; | ||
static final String DELETE_PHASE = "delete"; | ||
|
||
public static final Map<Integer, List<String>> ORDERED_VALID_HOT_ACTIONS = Map.of( | ||
VERSION_ONE, | ||
Stream.of( | ||
SetPriorityAction.NAME, | ||
UnfollowAction.NAME, | ||
RolloverAction.NAME, | ||
ReadOnlyAction.NAME, | ||
DownsampleAction.NAME, | ||
ShrinkAction.NAME, | ||
ForceMergeAction.NAME, | ||
SearchableSnapshotAction.NAME | ||
).filter(Objects::nonNull).toList() | ||
); | ||
|
||
public static final Map<Integer, List<String>> ORDERED_VALID_WARM_ACTIONS = Map.of( | ||
VERSION_ONE, | ||
Stream.of( | ||
SetPriorityAction.NAME, | ||
UnfollowAction.NAME, | ||
ReadOnlyAction.NAME, | ||
DownsampleAction.NAME, | ||
AllocateAction.NAME, | ||
MigrateAction.NAME, | ||
ShrinkAction.NAME, | ||
ForceMergeAction.NAME | ||
).filter(Objects::nonNull).toList() | ||
); | ||
|
||
public static final Map<Integer, List<String>> ORDERED_VALID_COLD_ACTIONS = Map.of( | ||
VERSION_ONE, | ||
Stream.of( | ||
SetPriorityAction.NAME, | ||
UnfollowAction.NAME, | ||
ReadOnlyAction.NAME, | ||
DownsampleAction.NAME, | ||
SearchableSnapshotAction.NAME, | ||
AllocateAction.NAME, | ||
MigrateAction.NAME, | ||
FreezeAction.NAME | ||
).filter(Objects::nonNull).toList() | ||
); | ||
|
||
public static final Map<Integer, List<String>> ORDERED_VALID_FROZEN_ACTIONS = Map.of( | ||
VERSION_ONE, | ||
List.of(UnfollowAction.NAME, SearchableSnapshotAction.NAME) | ||
); | ||
public static final Map<Integer, List<String>> ORDERED_VALID_DELETE_ACTIONS = Map.of( | ||
VERSION_ONE, | ||
List.of(WaitForSnapshotAction.NAME, DeleteAction.NAME) | ||
); | ||
|
||
static final Set<String> VALID_HOT_ACTIONS = Sets.newHashSet(ORDERED_VALID_HOT_ACTIONS.get(CURRENT_VERSION)); | ||
static final Set<String> VALID_WARM_ACTIONS = Sets.newHashSet(ORDERED_VALID_WARM_ACTIONS.get(CURRENT_VERSION)); | ||
static final Set<String> VALID_COLD_ACTIONS = Sets.newHashSet(ORDERED_VALID_COLD_ACTIONS.get(CURRENT_VERSION)); | ||
static final Set<String> VALID_FROZEN_ACTIONS = Sets.newHashSet(ORDERED_VALID_FROZEN_ACTIONS.get(CURRENT_VERSION)); | ||
static final Set<String> VALID_DELETE_ACTIONS = Sets.newHashSet(ORDERED_VALID_DELETE_ACTIONS.get(CURRENT_VERSION)); | ||
|
||
static final Map<String, Set<String>> ALLOWED_ACTIONS = Map.of( | ||
HOT_PHASE, | ||
VALID_HOT_ACTIONS, | ||
WARM_PHASE, | ||
VALID_WARM_ACTIONS, | ||
COLD_PHASE, | ||
VALID_COLD_ACTIONS, | ||
DELETE_PHASE, | ||
VALID_DELETE_ACTIONS, | ||
FROZEN_PHASE, | ||
VALID_FROZEN_ACTIONS | ||
); | ||
} |
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
Oops, something went wrong.