Package org.elasticsearch.snapshots
Class SnapshotInfo
java.lang.Object
org.elasticsearch.snapshots.SnapshotInfo
- All Implemented Interfaces:
java.lang.Comparable<SnapshotInfo>
,Writeable
,ToXContent
public final class SnapshotInfo extends java.lang.Object implements java.lang.Comparable<SnapshotInfo>, ToXContent, Writeable
Information about a snapshot
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SnapshotInfo.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 java.lang.String
CONTEXT_MODE_PARAM
static java.lang.String
CONTEXT_MODE_SNAPSHOT
static Version
METADATA_FIELD_INTRODUCED
static ObjectParser<SnapshotInfo.SnapshotInfoBuilder,java.lang.Void>
SNAPSHOT_INFO_PARSER
-
Constructor Summary
Constructors Constructor Description SnapshotInfo(StreamInput in)
Constructs snapshot information from stream inputSnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, long startTime, java.lang.Boolean includeGlobalState, java.util.Map<java.lang.String,java.lang.Object> userMetadata)
SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, long startTime, java.lang.String reason, long endTime, int totalShards, java.util.List<SnapshotShardFailure> shardFailures, java.lang.Boolean includeGlobalState, java.util.Map<java.lang.String,java.lang.Object> userMetadata)
SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, SnapshotState state)
SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, SnapshotState state, Version version)
-
Method Summary
Modifier and Type Method Description SnapshotInfo
basic()
Gets a newSnapshotInfo
instance from the givenSnapshotInfo
with all information stripped out except the snapshot id, state, and indices.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.long
endTime()
Returns time when snapshot ended; a value of0L
will be returned if the snapshot is still running or ifstate()
returnsnull
.boolean
equals(java.lang.Object o)
int
failedShards()
Number of failed shards; a value of0
will be returned if there were no failed shards, or ifstate()
returnsnull
.static SnapshotInfo
fromXContentInternal(XContentParser parser)
This method creates a SnapshotInfo from internal x-content.int
hashCode()
java.lang.Boolean
includeGlobalState()
java.util.List<java.lang.String>
indices()
Returns indices that were included in this snapshot.java.lang.String
reason()
Returns snapshot failure reason;null
if the snapshot succeeded.java.util.List<SnapshotShardFailure>
shardFailures()
Returns shard failures; an empty list will be returned if there were no shard failures, or ifstate()
returnsnull
.SnapshotId
snapshotId()
Returns snapshot idlong
startTime()
SnapshotState
state()
Returns snapshot state;null
if the state is unknown.RestStatus
status()
Returns snapshot REST statusint
successfulShards()
Returns total number of shards that were successfully snapshotted; a value of0
will be returned ifstate()
returnsnull
.java.lang.String
toString()
int
totalShards()
Returns total number of shards that were snapshotted; a value of0
will be returned ifstate()
returnsnull
.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
java.util.Map<java.lang.String,java.lang.Object>
userMetadata()
Returns the custom metadata that was attached to this snapshot at creation time.Version
version()
Returns the version of elasticsearch that the snapshot was created with.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
CONTEXT_MODE_PARAM
public static final java.lang.String CONTEXT_MODE_PARAM- See Also:
- Constant Field Values
-
CONTEXT_MODE_SNAPSHOT
public static final java.lang.String CONTEXT_MODE_SNAPSHOT- See Also:
- Constant Field Values
-
METADATA_FIELD_INTRODUCED
-
SNAPSHOT_INFO_PARSER
public static final ObjectParser<SnapshotInfo.SnapshotInfoBuilder,java.lang.Void> SNAPSHOT_INFO_PARSER
-
-
Constructor Details
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, SnapshotState state) -
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, SnapshotState state, Version version) -
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, long startTime, java.lang.Boolean includeGlobalState, java.util.Map<java.lang.String,java.lang.Object> userMetadata) -
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, java.util.List<java.lang.String> indices, long startTime, java.lang.String reason, long endTime, int totalShards, java.util.List<SnapshotShardFailure> shardFailures, java.lang.Boolean includeGlobalState, java.util.Map<java.lang.String,java.lang.Object> userMetadata) -
SnapshotInfo
Constructs snapshot information from stream input- Throws:
java.io.IOException
-
-
Method Details
-
basic
Gets a newSnapshotInfo
instance from the givenSnapshotInfo
with all information stripped out except the snapshot id, state, and indices. -
snapshotId
Returns snapshot id- Returns:
- snapshot id
-
state
Returns snapshot state;null
if the state is unknown.- Returns:
- snapshot state
-
reason
Returns snapshot failure reason;null
if the snapshot succeeded.- Returns:
- snapshot failure reason
-
indices
public java.util.List<java.lang.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 of0L
will 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 of0
will be returned ifstate()
returnsnull
.- Returns:
- number of shards
-
failedShards
public int failedShards()Number of failed shards; a value of0
will 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 of0
will be returned ifstate()
returnsnull
.- Returns:
- number of successful shards
-
includeGlobalState
public java.lang.Boolean includeGlobalState() -
shardFailures
Returns shard failures; an empty list will be returned if there were no shard failures, or ifstate()
returnsnull
.- Returns:
- shard failures
-
version
Returns the version of elasticsearch that the snapshot was created with. Will only returnnull
ifstate()
returnsnull
orSnapshotState.INCOMPATIBLE
.- Returns:
- version of elasticsearch that the snapshot was created with
-
userMetadata
Returns the custom metadata that was attached to this snapshot at creation time.- Returns:
- custom metadata
-
compareTo
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:
compareTo
in interfacejava.lang.Comparable<SnapshotInfo>
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
status
Returns snapshot REST status -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
fromXContentInternal
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:
java.io.IOException
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-