Package org.opensearch.snapshots
Class SnapshotInfo
java.lang.Object
org.opensearch.snapshots.SnapshotInfo
- All Implemented Interfaces:
Comparable<SnapshotInfo>
,org.opensearch.core.common.io.stream.Writeable
,org.opensearch.core.xcontent.ToXContent
@PublicApi(since="1.0.0")
public final class SnapshotInfo
extends Object
implements Comparable<SnapshotInfo>, org.opensearch.core.xcontent.ToXContent, org.opensearch.core.common.io.stream.Writeable
Information about a snapshot
- Opensearch.api:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Builds snapshot informationNested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.Params
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final org.opensearch.Version
static final org.opensearch.Version
static final org.opensearch.core.xcontent.ObjectParser
<SnapshotInfo.SnapshotInfoBuilder, Void> Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionSnapshotInfo
(org.opensearch.core.common.io.stream.StreamInput in) Constructs snapshot information from stream inputSnapshotInfo
(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, long startTime, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String, Object> userMetadata, Boolean remoteStoreIndexShallowCopy) SnapshotInfo
(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, long startTime, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String, Object> userMetadata, Boolean remoteStoreIndexShallowCopy, long pinnedTimestamp) SnapshotInfo
(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, SnapshotState state) SnapshotInfo
(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, SnapshotState state, org.opensearch.Version version) -
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
(org.opensearch.core.xcontent.XContentParser parser) This method creates a SnapshotInfo from internal x-content.long
int
hashCode()
indices()
Returns indices that were included in this snapshot.reason()
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
.Returns snapshot idlong
state()
Returns snapshot state;null
if the state is unknown.org.opensearch.core.rest.RestStatus
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.opensearch.core.xcontent.XContentBuilder
toXContent
(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) Returns the custom metadata that was attached to this snapshot at creation time.org.opensearch.Version
version()
Returns the version of opensearch that the snapshot was created with.void
writeTo
(org.opensearch.core.common.io.stream.StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opensearch.core.xcontent.ToXContent
isFragment
-
Field Details
-
DATA_STREAMS_IN_SNAPSHOT
public static final org.opensearch.Version DATA_STREAMS_IN_SNAPSHOT -
CONTEXT_MODE_PARAM
- See Also:
-
CONTEXT_MODE_SNAPSHOT
- See Also:
-
METADATA_FIELD_INTRODUCED
public static final org.opensearch.Version METADATA_FIELD_INTRODUCED -
SNAPSHOT_INFO_PARSER
public static final org.opensearch.core.xcontent.ObjectParser<SnapshotInfo.SnapshotInfoBuilder,Void> SNAPSHOT_INFO_PARSER
-
-
Constructor Details
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, SnapshotState state) -
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, SnapshotState state, org.opensearch.Version version) -
SnapshotInfo
-
SnapshotInfo
-
SnapshotInfo
public SnapshotInfo(SnapshotId snapshotId, List<String> indices, List<String> dataStreams, long startTime, String reason, long endTime, int totalShards, List<SnapshotShardFailure> shardFailures, Boolean includeGlobalState, Map<String, Object> userMetadata, Boolean remoteStoreIndexShallowCopy, long pinnedTimestamp) -
SnapshotInfo
Constructs snapshot information from stream input- Throws:
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
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
-
isRemoteStoreIndexShallowCopyEnabled
-
getPinnedTimestamp
public long getPinnedTimestamp() -
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 org.opensearch.Version version()Returns the version of opensearch that the snapshot was created with. Will only returnnull
ifstate()
returnsnull
orSnapshotState.INCOMPATIBLE
.- Returns:
- version of opensearch 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 interfaceComparable<SnapshotInfo>
-
toString
-
status
public org.opensearch.core.rest.RestStatus status()Returns snapshot REST status -
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceorg.opensearch.core.xcontent.ToXContent
- Throws:
IOException
-
fromXContentInternal
public static SnapshotInfo fromXContentInternal(org.opensearch.core.xcontent.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
- Specified by:
writeTo
in interfaceorg.opensearch.core.common.io.stream.Writeable
- Throws:
IOException
-
equals
-
hashCode
public int hashCode()
-