Class SnapshotInfo

java.lang.Object
org.elasticsearch.snapshots.SnapshotInfo
All Implemented Interfaces:
java.lang.Comparable<SnapshotInfo>, Writeable, org.elasticsearch.common.xcontent.ToXContent

public final class SnapshotInfo
extends java.lang.Object
implements java.lang.Comparable<SnapshotInfo>, org.elasticsearch.common.xcontent.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

    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

    Fields
    Modifier and Type Field Description
    static java.lang.String CONTEXT_MODE_PARAM  
    static java.lang.String CONTEXT_MODE_SNAPSHOT  
    static Version DATA_STREAMS_IN_SNAPSHOT  
    static Version METADATA_FIELD_INTRODUCED  
    static org.elasticsearch.common.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,​java.lang.Void> SNAPSHOT_INFO_PARSER  

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor Description
    SnapshotInfo​(SnapshotsInProgress.Entry entry)  
    SnapshotInfo​(StreamInput in)
    Constructs snapshot information from stream input
    SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, 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, long startTime)  
    SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, SnapshotState state)  
    SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, Version version, SnapshotState state)  
  • Method Summary

    Modifier and Type Method Description
    SnapshotInfo basic()
    Gets a new SnapshotInfo instance from the given SnapshotInfo 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.
    java.util.List<java.lang.String> dataStreams()  
    long endTime()
    Returns time when snapshot ended; a value of 0L will be returned if the snapshot is still running or if state() returns null.
    boolean equals​(java.lang.Object o)  
    int failedShards()
    Number of failed shards; a value of 0 will be returned if there were no failed shards, or if state() returns null.
    java.util.List<SnapshotFeatureInfo> featureStates()  
    static SnapshotInfo fromXContentInternal​(org.elasticsearch.common.xcontent.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 if state() returns null.
    SnapshotId snapshotId()
    Returns snapshot id
    long startTime()
    Returns time when snapshot started; a value of 0L will be returned if state() returns null.
    SnapshotState state()
    Returns snapshot state; null if the state is unknown.
    RestStatus status()
    Returns snapshot REST status
    int successfulShards()
    Returns total number of shards that were successfully snapshotted; a value of 0 will be returned if state() returns null.
    java.lang.String toString()  
    int totalShards()
    Returns total number of shards that were snapshotted; a value of 0 will be returned if state() returns null.
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.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.

    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

      public static final Version DATA_STREAMS_IN_SNAPSHOT
    • 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

      public static final Version METADATA_FIELD_INTRODUCED
    • SNAPSHOT_INFO_PARSER

      public static final org.elasticsearch.common.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,​java.lang.Void> SNAPSHOT_INFO_PARSER
  • Constructor Details

    • SnapshotInfo

      public SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, SnapshotState state)
    • SnapshotInfo

      public SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, Version version, SnapshotState state)
    • SnapshotInfo

      public SnapshotInfo​(SnapshotsInProgress.Entry entry)
    • SnapshotInfo

      public SnapshotInfo​(SnapshotId snapshotId, java.util.List<java.lang.String> indices, java.util.List<java.lang.String> dataStreams, java.util.List<SnapshotFeatureInfo> featureStates, 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, long startTime)
    • SnapshotInfo

      public SnapshotInfo​(StreamInput in) throws java.io.IOException
      Constructs snapshot information from stream input
      Throws:
      java.io.IOException
  • Method Details

    • basic

      public SnapshotInfo basic()
      Gets a new SnapshotInfo instance from the given SnapshotInfo with 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; null if the state is unknown.
      Returns:
      snapshot state
    • reason

      @Nullable public java.lang.String 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
    • dataStreams

      public java.util.List<java.lang.String> dataStreams()
      Returns:
      list of data streams that were included in this snapshot.
    • startTime

      public long startTime()
      Returns time when snapshot started; a value of 0L will be returned if state() returns null.
      Returns:
      snapshot start time
    • endTime

      public long endTime()
      Returns time when snapshot ended; a value of 0L will be returned if the snapshot is still running or if state() returns null.
      Returns:
      snapshot end time
    • totalShards

      public int totalShards()
      Returns total number of shards that were snapshotted; a value of 0 will be returned if state() returns null.
      Returns:
      number of shards
    • failedShards

      public int failedShards()
      Number of failed shards; a value of 0 will be returned if there were no failed shards, or if state() returns null.
      Returns:
      number of failed shards
    • successfulShards

      public int successfulShards()
      Returns total number of shards that were successfully snapshotted; a value of 0 will be returned if state() returns null.
      Returns:
      number of successful shards
    • includeGlobalState

      public java.lang.Boolean includeGlobalState()
    • shardFailures

      public java.util.List<SnapshotShardFailure> shardFailures()
      Returns shard failures; an empty list will be returned if there were no shard failures, or if state() returns null.
      Returns:
      shard failures
    • version

      @Nullable public Version version()
      Returns the version of elasticsearch that the snapshot was created with. Will only return null if state() returns null or SnapshotState.INCOMPATIBLE.
      Returns:
      version of elasticsearch that the snapshot was created with
    • userMetadata

      @Nullable public java.util.Map<java.lang.String,​java.lang.Object> userMetadata()
      Returns the custom metadata that was attached to this snapshot at creation time.
      Returns:
      custom metadata
    • featureStates

      public java.util.List<SnapshotFeatureInfo> featureStates()
    • 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:
      compareTo in interface java.lang.Comparable<SnapshotInfo>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • status

      public RestStatus 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 java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • fromXContentInternal

      public static SnapshotInfo fromXContentInternal​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.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:
      java.io.IOException
    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object