Class 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
  • Field Details

  • 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

      public SnapshotInfo​(StreamInput in) throws
      Constructs snapshot information from stream input
  • 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
      snapshot id
    • state

      @Nullable public SnapshotState state()
      Returns snapshot state; null if the state is unknown.
      snapshot state
    • reason

      @Nullable public java.lang.String reason()
      Returns snapshot failure reason; null if the snapshot succeeded.
      snapshot failure reason
    • indices

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

      public long startTime()
      Returns time when snapshot started; a value of 0L will be returned if state() returns null.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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:
      compareTo in interface java.lang.Comparable<SnapshotInfo>
    • toString

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

      public RestStatus status()
      Returns snapshot REST status
    • toXContent

      public XContentBuilder toXContent​(XContentBuilder builder, ToXContent.Params params) throws
      Specified by:
      toXContent in interface ToXContent
    • fromXContentInternal

      public static SnapshotInfo fromXContentInternal​(XContentParser parser) throws
      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.
    • writeTo

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

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

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