Module org.elasticsearch.server
Class IndexReshardingState.Split
java.lang.Object
org.elasticsearch.cluster.metadata.IndexReshardingState
org.elasticsearch.cluster.metadata.IndexReshardingState.Split
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
- Enclosing class:
IndexReshardingState
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic enumNested classes/interfaces inherited from class org.elasticsearch.cluster.metadata.IndexReshardingState
IndexReshardingState.Noop, IndexReshardingState.SplitNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested 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.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a Builder from the state of this Split The Split itself is immutable.booleangetSourceShardState(int shardNum) Get the current shard state of a source shardgetTargetShardState(int shardNum) Get the current target state of a shardinthashCode()booleanCheck whether this metadata represents an incomplete splitbooleanisTargetShard(int shardId) static IndexReshardingState.SplitnewSplitByMultiple(int shardCount, int multiple) Create resharding metadata representing a new split operation Split only supports updating an index to a multiple of its current shard countintintintsourceShard(int targetShard) booleantargetsDone(int shardNum) Check whether all target shards for the given source shard are done.booleantargetStateAtLeast(int shardNum, IndexReshardingState.Split.TargetShardState targetShardState) toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
shardCountBefore
public int shardCountBefore()- Specified by:
shardCountBeforein classIndexReshardingState- Returns:
- the number of shards the index has at the start of this operation
-
shardCountAfter
public int shardCountAfter()- Specified by:
shardCountAfterin classIndexReshardingState- Returns:
- the number of shards that the index will have when resharding completes
-
sourceShard
public int sourceShard(int targetShard) -
newSplitByMultiple
Create resharding metadata representing a new split operation Split only supports updating an index to a multiple of its current shard count- Parameters:
shardCount- the number of shards in the index at the start of the operationmultiple- the new shard count is shardCount * multiple- Returns:
- Split representing the start of the requested split
-
builder
Create a Builder from the state of this Split The Split itself is immutable. Modifications can be applied to the builder, which can be used to replace the current Split in IndexMetadata when it in turn is built.- Returns:
- a Builder reflecting the state of this split
-
getSourceShardState
Get the current shard state of a source shard- Parameters:
shardNum- an index into the shards which must be no greater than the number of shards before split- Returns:
- the source shard state of the shard identified by shardNum
-
isTargetShard
public boolean isTargetShard(int shardId) -
getTargetShardState
Get the current target state of a shard- Parameters:
shardNum- an index into shards greater than or equal to the old shard count and less than the new shard count- Returns:
- the target shard state for the shard identified by shardNum
-
targetStateAtLeast
public boolean targetStateAtLeast(int shardNum, IndexReshardingState.Split.TargetShardState targetShardState) -
inProgress
public boolean inProgress()Check whether this metadata represents an incomplete split- Returns:
- true if the split is incomplete (not all source shards are DONE)
-
targetStates
-
targetsDone
public boolean targetsDone(int shardNum) Check whether all target shards for the given source shard are done.- Parameters:
shardNum- a source shard index greater than or equal to 0 and less than the original shard count- Returns:
- true if all target shards for the given source shard are done.
-