Package org.elasticsearch.cluster
Class SnapshotsInProgress.Entry
java.lang.Object
org.elasticsearch.cluster.SnapshotsInProgress.Entry
- All Implemented Interfaces:
Writeable
,org.elasticsearch.common.xcontent.ToXContent
,RepositoryOperation
- Enclosing class:
- SnapshotsInProgress
public static class SnapshotsInProgress.Entry
extends Object
implements Writeable, org.elasticsearch.common.xcontent.ToXContent, RepositoryOperation
-
Nested Class Summary
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 inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionEntry(SnapshotsInProgress.Entry entry, SnapshotsInProgress.State state, Map<String,IndexId> indices, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, Version version, String failure)
Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String,IndexId> indices, List<String> dataStreams, long startTime, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, Map<String,Object> userMetadata, Version version)
Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String,IndexId> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, long startTime, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, String failure, Map<String,Object> userMetadata, Version version)
-
Method Summary
Modifier and TypeMethodDescriptionabort()
Create a new instance by aborting this instance.clones()
boolean
fail(ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, SnapshotsInProgress.State state, String failure)
failure()
int
hashCode()
boolean
indices()
boolean
isClone()
boolean
boolean
partial()
Name of the repository affected.long
The repository state id at the time the operation began.shards()
snapshot()
source()
long
state()
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
version()
What version of metadata to use for the snapshot in the repositorywithClones(ImmutableOpenMap<RepositoryShardId,SnapshotsInProgress.ShardSnapshotStatus> updatedClones)
withRepoGen(long newRepoGen)
Create a new instance that has its shard assignments replaced by the given shard assignment map.Same aswithShardStates(org.elasticsearch.common.collect.ImmutableOpenMap<org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.SnapshotsInProgress.ShardSnapshotStatus>)
but does not check if the snapshot completed and thus is only to be used when starting new shard snapshots on data nodes for a running snapshot.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Constructor Details
-
Entry
public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String,IndexId> indices, List<String> dataStreams, List<SnapshotFeatureInfo> featureStates, long startTime, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, String failure, Map<String,Object> userMetadata, Version version) -
Entry
public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, SnapshotsInProgress.State state, Map<String,IndexId> indices, List<String> dataStreams, long startTime, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, Map<String,Object> userMetadata, Version version) -
Entry
public Entry(SnapshotsInProgress.Entry entry, SnapshotsInProgress.State state, Map<String,IndexId> indices, long repositoryStateId, ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, Version version, String failure)
-
-
Method Details
-
withRepoGen
-
withClones
public SnapshotsInProgress.Entry withClones(ImmutableOpenMap<RepositoryShardId,SnapshotsInProgress.ShardSnapshotStatus> updatedClones) -
abort
Create a new instance by aborting this instance. Moving all in-progress shards toSnapshotsInProgress.ShardState.ABORTED
if assigned to a data node or toSnapshotsInProgress.ShardState.FAILED
if not assigned to any data node. If the instance had no in-progress shard snapshots assigned to data nodes it's moved to stateSnapshotsInProgress.State.SUCCESS
, otherwise it's moved to stateSnapshotsInProgress.State.ABORTED
. In the special case where this instance has not yet made any progress on any shard this method just returnsnull
since no abort is needed and the snapshot can simply be removed from the cluster state outright.- Returns:
- aborted snapshot entry or
null
if entry can be removed from the cluster state directly
-
fail
public SnapshotsInProgress.Entry fail(ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards, SnapshotsInProgress.State state, String failure) -
withShardStates
public SnapshotsInProgress.Entry withShardStates(ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards)Create a new instance that has its shard assignments replaced by the given shard assignment map. If the given shard assignments show all shard snapshots in a completed state then the returned instance will be of stateSnapshotsInProgress.State.SUCCESS
, otherwise the state remains unchanged.- Parameters:
shards
- new shard snapshot states- Returns:
- new snapshot entry
-
withStartedShards
public SnapshotsInProgress.Entry withStartedShards(ImmutableOpenMap<ShardId,SnapshotsInProgress.ShardSnapshotStatus> shards)Same aswithShardStates(org.elasticsearch.common.collect.ImmutableOpenMap<org.elasticsearch.index.shard.ShardId, org.elasticsearch.cluster.SnapshotsInProgress.ShardSnapshotStatus>)
but does not check if the snapshot completed and thus is only to be used when starting new shard snapshots on data nodes for a running snapshot. -
repository
Description copied from interface:RepositoryOperation
Name of the repository affected.- Specified by:
repository
in interfaceRepositoryOperation
-
snapshot
-
shards
-
state
-
indices
-
includeGlobalState
public boolean includeGlobalState() -
userMetadata
-
partial
public boolean partial() -
startTime
public long startTime() -
dataStreams
-
featureStates
-
repositoryStateId
public long repositoryStateId()Description copied from interface:RepositoryOperation
The repository state id at the time the operation began.- Specified by:
repositoryStateId
in interfaceRepositoryOperation
-
failure
-
version
What version of metadata to use for the snapshot in the repository -
source
-
isClone
public boolean isClone() -
clones
-
equals
-
hashCode
public int hashCode() -
toString
-
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
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
isFragment
public boolean isFragment()- Specified by:
isFragment
in interfaceorg.elasticsearch.common.xcontent.ToXContent
-