-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change replication index setting from boolean to Enum
Also incorporates PR feedback about the feature flag scope and naming Signed-off-by: Kartik Ganesh <[email protected]>
- Loading branch information
Showing
5 changed files
with
53 additions
and
10 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
38 changes: 38 additions & 0 deletions
38
server/src/main/java/org/opensearch/indices/replication/common/ReplicationType.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,38 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices.replication.common; | ||
|
||
public enum ReplicationType { | ||
|
||
DOCUMENT("document"), | ||
|
||
SEGMENT("segment"); | ||
|
||
private final String value; | ||
|
||
ReplicationType(String replicationType) { | ||
this.value = replicationType; | ||
} | ||
|
||
public static ReplicationType parseString(String replicationType) { | ||
try { | ||
return ReplicationType.valueOf(replicationType); | ||
} catch (IllegalArgumentException e) { | ||
throw new IllegalArgumentException("Could not parse ReplicationStrategy for [" + replicationType + "]"); | ||
} catch (NullPointerException npe) { | ||
// return a default value for null input | ||
return DOCUMENT; | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
} |