Skip to content

Commit

Permalink
Maintain bwc in PluginInfo with addition of semver range
Browse files Browse the repository at this point in the history
Signed-off-by: Abhilasha Seth <[email protected]>
  • Loading branch information
abseth-amzn committed Dec 5, 2023
1 parent 7bae459 commit 8657300
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public RangeOperator getRangeOperator() {
return rangeOperator;
}

/**
* Return the version for this range.
* @return the range version
*/
public Version getRangeVersion() {
return rangeVersion;
}

/**
* Check if range is satisfied by given version string.
*
Expand Down
12 changes: 10 additions & 2 deletions server/src/main/java/org/opensearch/plugins/PluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ public PluginInfo(final StreamInput in) throws IOException {
this.name = in.readString();
this.description = in.readString();
this.version = in.readString();
this.opensearchVersionRange = in.readSemverRange();
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
this.opensearchVersionRange = in.readSemverRange();
} else {
this.opensearchVersionRange = new SemverRange(in.readVersion(), SemverRange.RangeOperator.DEFAULT);
}
this.javaVersion = in.readString();
this.classname = in.readString();
this.customFolderName = in.readString();
Expand All @@ -195,7 +199,11 @@ public void writeTo(final StreamOutput out) throws IOException {
out.writeString(name);
out.writeString(description);
out.writeString(version);
out.writeSemverRange(opensearchVersionRange);
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
out.writeSemverRange(opensearchVersionRange);
} else {
out.writeVersion(opensearchVersionRange.getRangeVersion());
}
out.writeString(javaVersion);
out.writeString(classname);
if (customFolderName != null) {
Expand Down

0 comments on commit 8657300

Please sign in to comment.