generated from opensearch-project/opensearch-plugin-template-java
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for snapshot related metrics
Signed-off-by: Smit Patel <[email protected]>
- Loading branch information
Showing
8 changed files
with
215 additions
and
12 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
74 changes: 74 additions & 0 deletions
74
src/main/java/org/opensearch/action/SnapshotsResponse.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,74 @@ | ||
/* | ||
* Copyright [2018] [Vincent VAN HOLLEBEKE] | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.opensearch.action; | ||
|
||
import org.opensearch.core.action.ActionResponse; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.snapshots.SnapshotInfo; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Represents a container class for holding response data related to snapshots. | ||
*/ | ||
public class SnapshotsResponse extends ActionResponse { | ||
private final List<SnapshotInfo> snapshotInfos; | ||
|
||
/** | ||
* A constructor. | ||
* @param in A streamInput to materialize the instance from | ||
* @throws IOException if there is an exception reading from inputStream | ||
*/ | ||
public SnapshotsResponse(StreamInput in) throws IOException { | ||
super(in); | ||
snapshotInfos = in.readList(SnapshotInfo::new); | ||
} | ||
|
||
/** | ||
* A constructor. | ||
* | ||
* @param snapshotInfos A list of {@link SnapshotInfo} objects to initialize the instance with. | ||
*/ | ||
public SnapshotsResponse(List<SnapshotInfo> snapshotInfos) { | ||
this.snapshotInfos = Collections.unmodifiableList(snapshotInfos); | ||
} | ||
|
||
/** | ||
* Writes the instance into {@link StreamOutput}. | ||
* | ||
* @param out the output stream to which the instance is to be written | ||
* @throws IOException if there is an exception writing to the output stream | ||
*/ | ||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeCollection(snapshotInfos); | ||
} | ||
|
||
/** | ||
* Getter for {@code snapshotInfos} list. | ||
* The returned list is unmodifiable to ensure immutability. | ||
* | ||
* @return the list of {@link SnapshotInfo} objects | ||
*/ | ||
public List<SnapshotInfo> getSnapshotInfos() { | ||
return snapshotInfos; | ||
} | ||
} |
Oops, something went wrong.