Package org.elasticsearch.snapshots
Class SnapshotInfo
- java.lang.Object
-
- org.elasticsearch.snapshots.SnapshotInfo
-
- All Implemented Interfaces:
Comparable<SnapshotInfo>,Writeable,ToXContent
public final class SnapshotInfo extends Object implements Comparable<SnapshotInfo>, ToXContent, Writeable
Information about a snapshot
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSnapshotInfo.SnapshotInfoBuilder-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTEXT_MODE_PARAMstatic StringCONTEXT_MODE_SNAPSHOTstatic VersionMETADATA_FIELD_INTRODUCEDstatic ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void>SNAPSHOT_INFO_PARSER-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description SnapshotInfo(StreamInput in)Constructs snapshot information from stream inputSnapshotInfo(SnapshotId snapshotId, List<String> indices, long startTime, Boolean includeGlobalState, Map<String,Object> userMetadata)SnapshotInfo(SnapshotId snapshotId, List<String> indices, long startTime, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String,Object> userMetadata)SnapshotInfo(SnapshotId snapshotId, List<String> indices, SnapshotState state)SnapshotInfo(SnapshotId snapshotId, List<String> indices, SnapshotState state, Version version)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SnapshotInfobasic()Gets a newSnapshotInfoinstance from the givenSnapshotInfowith all information stripped out except the snapshot id, state, and indices.intcompareTo(SnapshotInfo o)Compares two snapshots by their start time; if the start times are the same, then compares the two snapshots by their snapshot ids.longendTime()Returns time when snapshot ended; a value of0Lwill be returned if the snapshot is still running or ifstate()returnsnull.booleanequals(Object o)intfailedShards()Number of failed shards; a value of0will be returned if there were no failed shards, or ifstate()returnsnull.static SnapshotInfofromXContentInternal(XContentParser parser)This method creates a SnapshotInfo from internal x-content.inthashCode()BooleanincludeGlobalState()List<String>indices()Returns indices that were included in this snapshot.Stringreason()Returns snapshot failure reason;nullif the snapshot succeeded.List<SnapshotShardFailure>shardFailures()Returns shard failures; an empty list will be returned if there were no shard failures, or ifstate()returnsnull.SnapshotIdsnapshotId()Returns snapshot idlongstartTime()SnapshotStatestate()Returns snapshot state;nullif the state is unknown.RestStatusstatus()Returns snapshot REST statusintsuccessfulShards()Returns total number of shards that were successfully snapshotted; a value of0will be returned ifstate()returnsnull.StringtoString()inttotalShards()Returns total number of shards that were snapshotted; a value of0will be returned ifstate()returnsnull.XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)Map<String,Object>userMetadata()Returns the custom metadata that was attached to this snapshot at creation time.Versionversion()Returns the version of elasticsearch that the snapshot was created with.voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
isFragment
-
-
-
-
Field Detail
-
CONTEXT_MODE_PARAM
public static final String CONTEXT_MODE_PARAM
- See Also:
- Constant Field Values
-
CONTEXT_MODE_SNAPSHOT
public static final String CONTEXT_MODE_SNAPSHOT
- See Also:
- Constant Field Values
-
METADATA_FIELD_INTRODUCED
public static final Version METADATA_FIELD_INTRODUCED
-
SNAPSHOT_INFO_PARSER
public static final ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void> SNAPSHOT_INFO_PARSER
-
-
Constructor Detail
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, SnapshotState state)
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, SnapshotState state, Version version)
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, long startTime, Boolean includeGlobalState, Map<String,Object> userMetadata)
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, long startTime, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String,Object> userMetadata)
-
SnapshotInfo
public SnapshotInfo(StreamInput in) throws IOException
Constructs snapshot information from stream input- Throws:
IOException
-
-
Method Detail
-
basic
public SnapshotInfo basic()
Gets a newSnapshotInfoinstance from the givenSnapshotInfowith all information stripped out except the snapshot id, state, and indices.
-
snapshotId
public SnapshotId snapshotId()
Returns snapshot id- Returns:
- snapshot id
-
state
@Nullable public SnapshotState state()
Returns snapshot state;nullif the state is unknown.- Returns:
- snapshot state
-
reason
@Nullable public String reason()
Returns snapshot failure reason;nullif the snapshot succeeded.- Returns:
- snapshot failure reason
-
indices
public List<String> indices()
Returns indices that were included in this snapshot.- Returns:
- list of indices
-
startTime
public long startTime()
- Returns:
- snapshot start time
-
endTime
public long endTime()
Returns time when snapshot ended; a value of0Lwill be returned if the snapshot is still running or ifstate()returnsnull.- Returns:
- snapshot end time
-
totalShards
public int totalShards()
Returns total number of shards that were snapshotted; a value of0will be returned ifstate()returnsnull.- Returns:
- number of shards
-
failedShards
public int failedShards()
Number of failed shards; a value of0will be returned if there were no failed shards, or ifstate()returnsnull.- Returns:
- number of failed shards
-
successfulShards
public int successfulShards()
Returns total number of shards that were successfully snapshotted; a value of0will be returned ifstate()returnsnull.- Returns:
- number of successful shards
-
includeGlobalState
public Boolean includeGlobalState()
-
shardFailures
public List<SnapshotShardFailure> shardFailures()
Returns shard failures; an empty list will be returned if there were no shard failures, or ifstate()returnsnull.- Returns:
- shard failures
-
version
@Nullable public Version version()
Returns the version of elasticsearch that the snapshot was created with. Will only returnnullifstate()returnsnullorSnapshotState.INCOMPATIBLE.- Returns:
- version of elasticsearch that the snapshot was created with
-
userMetadata
@Nullable public Map<String,Object> userMetadata()
Returns the custom metadata that was attached to this snapshot at creation time.- Returns:
- custom metadata
-
compareTo
public int compareTo(SnapshotInfo o)
Compares two snapshots by their start time; if the start times are the same, then compares the two snapshots by their snapshot ids.- Specified by:
compareToin interfaceComparable<SnapshotInfo>
-
status
public RestStatus status()
Returns snapshot REST status
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
fromXContentInternal
public static SnapshotInfo fromXContentInternal(XContentParser parser) throws IOException
This method creates a SnapshotInfo from internal x-content. It does not handle x-content written with the external version as external x-content is only for display purposes and does not need to be parsed.- Throws:
IOException
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
-