Package org.elasticsearch.action.support
Class ActiveShardCount
- java.lang.Object
-
- org.elasticsearch.action.support.ActiveShardCount
-
-
Nested Class Summary
-
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 ActiveShardCount
ALL
static ActiveShardCount
DEFAULT
static ActiveShardCount
NONE
static ActiveShardCount
ONE
-
Method Summary
Modifier and Type Method Description boolean
enoughShardsActive(int activeShardCount)
Returns true iff the given number of active shards is enough to meet the required shard count represented by this instance.boolean
enoughShardsActive(ClusterState clusterState, java.lang.String... indices)
Returns true iff the given cluster state's routing table contains enough active shards for the given indices to meet the required shard count represented by this instance.boolean
enoughShardsActive(IndexShardRoutingTable shardRoutingTable)
Returns true iff the active shard count in the shard routing table is enough to meet the required shard count represented by this instance.boolean
equals(java.lang.Object o)
static ActiveShardCount
from(int value)
Get an ActiveShardCount instance for the given value.int
hashCode()
static ActiveShardCount
parseString(java.lang.String str)
Parses the active shard count from the given string.static ActiveShardCount
readFrom(StreamInput in)
java.lang.String
toString()
boolean
validate(int numberOfReplicas)
Validates that the instance is valid for the given number of replicas in an index.void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
-
-
Field Detail
-
DEFAULT
public static final ActiveShardCount DEFAULT
-
ALL
public static final ActiveShardCount ALL
-
NONE
public static final ActiveShardCount NONE
-
ONE
public static final ActiveShardCount ONE
-
-
Method Detail
-
from
public static ActiveShardCount from(int value)
Get an ActiveShardCount instance for the given value. The value is first validated to ensure it is a valid shard count and throws an IllegalArgumentException if validation fails. Valid values are any non-negative number. Directly useDEFAULT
for the default value (which is one shard copy) orALL
to specify all the shards.
-
validate
public boolean validate(int numberOfReplicas)
Validates that the instance is valid for the given number of replicas in an index.
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Writeable
Write this into the StreamOutput.
-
readFrom
public static ActiveShardCount readFrom(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
parseString
public static ActiveShardCount parseString(java.lang.String str)
Parses the active shard count from the given string. Valid values are "all" for all shard copies, null for the default value (which defaults to one shard copy), or a numeric value greater than or equal to 0. Any other input will throw an IllegalArgumentException.
-
enoughShardsActive
public boolean enoughShardsActive(int activeShardCount)
Returns true iff the given number of active shards is enough to meet the required shard count represented by this instance. This method should only be invoked withActiveShardCount
objects created fromfrom(int)
, orNONE
orONE
.
-
enoughShardsActive
public boolean enoughShardsActive(ClusterState clusterState, java.lang.String... indices)
Returns true iff the given cluster state's routing table contains enough active shards for the given indices to meet the required shard count represented by this instance.
-
enoughShardsActive
public boolean enoughShardsActive(IndexShardRoutingTable shardRoutingTable)
Returns true iff the active shard count in the shard routing table is enough to meet the required shard count represented by this instance.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-