-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/opensearch-project/OpenSearch…
… into listsegmentsfinal
- Loading branch information
Showing
21 changed files
with
2,228 additions
and
5 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
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
92 changes: 92 additions & 0 deletions
92
server/src/main/java/org/opensearch/cluster/decommission/DecommissionAttribute.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,92 @@ | ||
/* | ||
* 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.decommission; | ||
|
||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.io.stream.StreamOutput; | ||
import org.opensearch.common.io.stream.Writeable; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* {@link DecommissionAttribute} encapsulates information about decommissioned node attribute like attribute name, attribute value. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public final class DecommissionAttribute implements Writeable { | ||
private final String attributeName; | ||
private final String attributeValue; | ||
|
||
/** | ||
* Constructs new decommission attribute name value pair | ||
* | ||
* @param attributeName attribute name | ||
* @param attributeValue attribute value | ||
*/ | ||
public DecommissionAttribute(String attributeName, String attributeValue) { | ||
this.attributeName = attributeName; | ||
this.attributeValue = attributeValue; | ||
} | ||
|
||
/** | ||
* Returns attribute name | ||
* | ||
* @return attributeName | ||
*/ | ||
public String attributeName() { | ||
return this.attributeName; | ||
} | ||
|
||
/** | ||
* Returns attribute value | ||
* | ||
* @return attributeValue | ||
*/ | ||
public String attributeValue() { | ||
return this.attributeValue; | ||
} | ||
|
||
public DecommissionAttribute(StreamInput in) throws IOException { | ||
attributeName = in.readString(); | ||
attributeValue = in.readString(); | ||
} | ||
|
||
/** | ||
* Writes decommission attribute name value to stream output | ||
* | ||
* @param out stream output | ||
*/ | ||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeString(attributeName); | ||
out.writeString(attributeValue); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
DecommissionAttribute that = (DecommissionAttribute) o; | ||
|
||
if (!attributeName.equals(that.attributeName)) return false; | ||
return attributeValue.equals(that.attributeValue); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(attributeName, attributeValue); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DecommissionAttribute{" + "attributeName='" + attributeName + '\'' + ", attributeValue='" + attributeValue + '\'' + '}'; | ||
} | ||
} |
Oops, something went wrong.