Skip to content

Commit 1036ff8

Browse files
committed
Add getters for the failure lifecycle
1 parent e24ff93 commit 1036ff8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,37 @@ public IndexMode getIndexMode() {
517517
return indexMode;
518518
}
519519

520+
/**
521+
* Retrieves the lifecycle configuration meant for the backing indices.
522+
*/
520523
@Nullable
521524
public DataStreamLifecycle getDataLifecycle() {
522525
return lifecycle;
523526
}
524527

528+
/**
529+
* Retrieves the lifecycle configuration meant for the failure store. Currently, it's the same with {@link #getDataLifecycle()}
530+
* but it will change.
531+
*/
532+
@Nullable
533+
public DataStreamLifecycle getFailuresLifecycle() {
534+
return lifecycle;
535+
}
536+
537+
/**
538+
* Retrieves the correct lifecycle for the provided index. Returns null if the index does not belong to this data stream
539+
*/
540+
@Nullable
541+
public DataStreamLifecycle getDataLifecycleForIndex(Index index) {
542+
if (backingIndices.containsIndex(index.getName())) {
543+
return getDataLifecycle();
544+
}
545+
if (failureIndices.containsIndex(index.getName())) {
546+
return getFailuresLifecycle();
547+
}
548+
return null;
549+
}
550+
525551
/**
526552
* Returns the latest auto sharding event that happened for this data stream
527553
*/

0 commit comments

Comments
 (0)