-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Created ScriptExtension interface #318 * Created ScriptExtension interface #318 * Created ScriptExtension interface #318 --------- (cherry picked from commit 18b1802) Signed-off-by: Aisara Imangaliyeva <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Aisara Imangaliyeva <[email protected]>
- Loading branch information
1 parent
980dd82
commit 7442d1a
Showing
2 changed files
with
50 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* 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.sdk; | ||
|
||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.script.ScriptContext; | ||
import org.opensearch.script.ScriptEngine; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* An additional extension point for {@link Extension}s that extends OpenSearch's scripting functionality. | ||
*/ | ||
public interface ScriptExtension { | ||
|
||
/** | ||
* Returns a {@link ScriptEngine} instance or <code>null</code> if this extension doesn't add a new script engine. | ||
* @param settings Node settings | ||
* @param contexts The contexts that {@link ScriptEngine#compile(String, String, ScriptContext, Map)} may be called with | ||
*/ | ||
default ScriptEngine getScriptEngine(Settings settings, Collection<ScriptContext<?>> contexts) { | ||
return null; | ||
} | ||
|
||
/** | ||
* Return script contexts this extension wants to allow using. | ||
*/ | ||
default List<ScriptContext<?>> getContexts() { | ||
return Collections.emptyList(); | ||
} | ||
} |
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