forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify mixed mode behaviour in Remote Publication Enabled
Signed-off-by: Shivansh Arora <[email protected]>
- Loading branch information
Showing
9 changed files
with
275 additions
and
137 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
61 changes: 61 additions & 0 deletions
61
server/src/main/java/org/opensearch/cluster/coordination/PublishWithManifestRequest.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,61 @@ | ||
/* | ||
* 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.cluster.coordination; | ||
|
||
import org.opensearch.cluster.ClusterState; | ||
import org.opensearch.gateway.remote.ClusterMetadataManifest; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* This class represents a publish request that includes a {@link ClusterMetadataManifest}. | ||
* It extends the {@link PublishRequest} class and adds a field for the accepted manifest. | ||
*/ | ||
public class PublishWithManifestRequest extends PublishRequest { | ||
|
||
private final ClusterMetadataManifest acceptedManifest; | ||
|
||
public PublishWithManifestRequest(ClusterState acceptedState, ClusterMetadataManifest manifest) { | ||
super(acceptedState); | ||
this.acceptedManifest = manifest; | ||
} | ||
|
||
public ClusterMetadataManifest getAcceptedManifest() { | ||
return acceptedManifest; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
if (!super.equals(o)) return false; | ||
|
||
PublishWithManifestRequest that = (PublishWithManifestRequest) o; | ||
|
||
return acceptedManifest.equals(that.acceptedManifest); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), acceptedManifest); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PublishWithManifestRequest{term=" | ||
+ getAcceptedState().term() | ||
+ ", version=" | ||
+ getAcceptedState().version() | ||
+ ", state=" | ||
+ getAcceptedState() | ||
+ "manifest=" | ||
+ acceptedManifest | ||
+ "}"; | ||
} | ||
} |
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.