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

Added new baseclasses in opensearch for ccr classloader issue #13615

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased 2.x]
### Added
- Add useCompoundFile index setting ([#13478](https://github.com/opensearch-project/OpenSearch/pull/13478))
- Added ClusterManagerNodeAckRequest and TransportClusterManagerNodeExtendedAction classes with flexible generic constraint for cluster-manager operations ([#13615](https://github.com/opensearch-project/OpenSearch/pull/13615))

### Dependencies
- Bump `com.github.spullara.mustache.java:compiler` from 0.9.10 to 0.9.13 ([#13329](https://github.com/opensearch-project/OpenSearch/pull/13329), [#13559](https://github.com/opensearch-project/OpenSearch/pull/13559))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.action.support.clustermanager;

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.cluster.ack.AckedRequest;
import org.opensearch.common.unit.TimeValue;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;

import java.io.IOException;

import static org.opensearch.common.unit.TimeValue.timeValueSeconds;

/**
* A base request for cluster-manager based operations.
* It is similar to ClusterManagerNodeRequest, but extends ActionRequest and AckedRequest.
* @opensearch.api
*/
public abstract class ClusterManagerNodeAckRequest extends ActionRequest implements AckedRequest {

public static final TimeValue DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT = TimeValue.timeValueSeconds(30);
protected TimeValue clusterManagerNodeTimeout = DEFAULT_CLUSTER_MANAGER_NODE_TIMEOUT;
protected TimeValue masterNodeTimeout = clusterManagerNodeTimeout;
public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30);
protected TimeValue timeout = DEFAULT_ACK_TIMEOUT;

protected ClusterManagerNodeAckRequest() {}

protected ClusterManagerNodeAckRequest(StreamInput in) throws IOException {
super(in);
clusterManagerNodeTimeout = in.readTimeValue();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeTimeValue(clusterManagerNodeTimeout);
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
@SuppressWarnings("unchecked")
public final ClusterManagerNodeAckRequest clusterManagerNodeTimeout(TimeValue timeout) {
this.clusterManagerNodeTimeout = timeout;
return this;
}

/**
* A timeout value in case the cluster-manager has not been discovered yet or disconnected.
*/
public final ClusterManagerNodeAckRequest clusterManagerNodeTimeout(String timeout) {
return clusterManagerNodeTimeout(
TimeValue.parseTimeValue(timeout, null, getClass().getSimpleName() + ".clusterManagerNodeTimeout")
);
}

public final TimeValue clusterManagerNodeTimeout() {
return this.clusterManagerNodeTimeout;
}

/** @deprecated As of 2.1, because supporting inclusive language, replaced by {@link #clusterManagerNodeTimeout()} */
@Deprecated
public final TimeValue masterNodeTimeout() {
return clusterManagerNodeTimeout();
}

@Override
public ActionRequestValidationException validate() {
return null;
}

@Override
public TimeValue ackTimeout() {
return this.timeout;
}
}
Loading
Loading