-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introducing custom uuid setting in SPI (#278)
* introducing custom uuid setting in SPI Signed-off-by: Ravi Thaluru <[email protected]>
- Loading branch information
Showing
20 changed files
with
173 additions
and
88 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
16 changes: 0 additions & 16 deletions
16
...ain/kotlin/org.opensearch.indexmanagement.spi/indexstatemanagement/ClusterEventHandler.kt
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
spi/src/main/kotlin/org.opensearch.indexmanagement.spi/indexstatemanagement/StatusChecker.kt
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,29 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.spi.indexstatemanagement | ||
|
||
import org.opensearch.cluster.ClusterState | ||
|
||
interface StatusChecker { | ||
|
||
/** | ||
* checks and returns the status of the extension | ||
*/ | ||
fun check(clusterState: ClusterState): Status { | ||
return Status.ENABLED | ||
} | ||
} | ||
|
||
enum class Status(private val value: String) { | ||
ENABLED("enabled"), | ||
DISABLED("disabled"); | ||
|
||
override fun toString(): String { | ||
return value | ||
} | ||
} | ||
|
||
class DefaultStatusChecker : StatusChecker |
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
23 changes: 23 additions & 0 deletions
23
...main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/ExtensionStatusChecker.kt
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,23 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.indexstatemanagement | ||
|
||
import org.opensearch.cluster.service.ClusterService | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.Status | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.StatusChecker | ||
|
||
/** | ||
* Check the extension status check. The extension status should be used to represent if the extension is turned on or off, | ||
* not as a health check denoting availability. | ||
*/ | ||
class ExtensionStatusChecker(private val extensionCheckers: Map<String, StatusChecker>, val clusterService: ClusterService) { | ||
|
||
fun isEnabled(extensionName: String?): Boolean { | ||
val checker = extensionCheckers[extensionName] ?: return true | ||
val clusterState = clusterService.state() | ||
return checker.check(clusterState) == Status.ENABLED | ||
} | ||
} |
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.