Package org.elasticsearch.snapshots
Class SnapshotInfo
java.lang.Object
org.elasticsearch.snapshots.SnapshotInfo
- All Implemented Interfaces:
Comparable<SnapshotInfo>
,Writeable
,org.elasticsearch.common.xcontent.ToXContent
public final class SnapshotInfo
extends Object
implements Comparable<SnapshotInfo>, org.elasticsearch.common.xcontent.ToXContent, Writeable
Information about a snapshot
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic Version
static String
static String
static Version
static org.elasticsearch.common.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void>
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionSnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String,Object> userMetadata, long startTime, Map<String,SnapshotInfo.IndexSnapshotDetails> indexSnapshotDetails)
SnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, SnapshotState state)
SnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, Version version, SnapshotState state)
-
Method Summary
Modifier and TypeMethodDescriptionbasic()
Gets a newSnapshotInfo
instance from the givenSnapshotInfo
with all information stripped out except the snapshot id, state, and indices.int
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
int
Number of failed shards; a value of0
will be returned if there were no failed shards, or ifstate()
returnsnull
.static SnapshotInfo
fromXContentInternal(String repoName, org.elasticsearch.common.xcontent.XContentParser parser)
This method creates a SnapshotInfo from internal x-content.int
hashCode()
indices()
Returns indices that were included in this snapshot.static SnapshotInfo
readFrom(StreamInput in)
Constructs snapshot information from stream inputreason()
Returns snapshot failure reason;null
if the snapshot succeeded.Returns shard failures; an empty list will be returned if there were no shard failures, or ifstate()
returnsnull
.snapshot()
Returns snapshot idlong
state()
Returns snapshot state;null
if the state is unknown.status()
Returns snapshot REST statusint
Returns total number of shards that were successfully snapshotted; a value of0
will be returned ifstate()
returnsnull
.toString()
int
Returns total number of shards that were snapshotted; a value of0
will be returned ifstate()
returnsnull
.org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
Returns the custom metadata that was attached to this snapshot at creation time.version()
Returns the version of elasticsearch that the snapshot was created with.void
writeTo(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 Details
-
DATA_STREAMS_IN_SNAPSHOT
-
METADATA_FIELD_INTRODUCED
-
INDEX_DETAILS_XCONTENT_PARAM
- See Also:
- Constant Field Values
-
INCLUDE_REPOSITORY_XCONTENT_PARAM
- See Also:
- Constant Field Values
-
SNAPSHOT_INFO_PARSER
public static final org.elasticsearch.common.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void> SNAPSHOT_INFO_PARSER
-
-
Constructor Details
-
SnapshotInfo
public SnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, SnapshotState state) -
SnapshotInfo
public SnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, Version version, SnapshotState state) -
SnapshotInfo
-
SnapshotInfo
public SnapshotInfo(Snapshot snapshot, List<String> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String,Object> userMetadata, long startTime, Map<String,SnapshotInfo.IndexSnapshotDetails> indexSnapshotDetails)
-
-
Method Details
-
readFrom
Constructs snapshot information from stream input- Throws:
IOException
-
basic
Gets a newSnapshotInfo
instance from the givenSnapshotInfo
with all information stripped out except the snapshot id, state, and indices. -
snapshot
-
snapshotId
Returns snapshot id- Returns:
- snapshot id
-
repository
-
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
Returns indices that were included in this snapshot.- Returns:
- list of indices
-
dataStreams
- Returns:
- list of data streams that were included in this snapshot.
-
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
-
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
-
featureStates
-
indexSnapshotDetails
- Returns:
- details of each index in the snapshot, if available, or an empty map otherwise.
-
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 interfaceComparable<SnapshotInfo>
-
toString
-
status
Returns snapshot REST status -
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-
fromXContentInternal
public static SnapshotInfo fromXContentInternal(String repoName, org.elasticsearch.common.xcontent.XContentParser parser) throws IOExceptionThis 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
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-