Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Create ReloadableExtension interface #574

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/main/java/org/opensearch/sdk/ReloadableExtension.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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;

/**
* An extension point for {@link Plugin}s that can be reloaded. There is no
* clear definition about what reloading a plugin actually means. When a plugin
* is reloaded it might rebuild any internal members. Plugins usually implement
* this interface in order to reread the values of {@code SecureSetting}s and
* then rebuild any dependent internal members.
*/
public interface ReloadableExtension {

/**
* Called to trigger the rebuilt of the plugin's internal members. The reload
* operation <b>is required to have been completed</b> when the method returns.
* Strictly speaking, the <code>settings</code> argument should not be accessed
* outside of this method's call stack, as any values stored in the node's
* keystore (see {@code SecureSetting}) will not otherwise be retrievable. The
* setting values do not follow dynamic updates, i.e. the values are identical
* to the ones during the initial plugin loading, barring the keystore file on
* disk changes. Any failure during the operation should be signaled by raising
* an exception, but the plugin should otherwise continue to function
* unperturbed.
*
* @param settings
* Settings used while reloading the plugin. All values are
* retrievable, including the values stored in the node's keystore.
* The setting values are the initial ones, from when the node has be
* started, i.e. they don't follow dynamic updates.
* @throws Exception
* if the operation failed. The plugin should continue to operate as
* if the offending call didn't happen.
*/

void reload(Settings settings) throws Exception;
}