Package org.elasticsearch.index.shard
Class IndexLongFieldRange
java.lang.Object
org.elasticsearch.index.shard.IndexLongFieldRange
- All Implemented Interfaces:
Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
public class IndexLongFieldRange extends java.lang.Object implements Writeable, org.elasticsearch.common.xcontent.ToXContentFragment
Class representing an (inclusive) range of
long values in a field in an index which may comprise multiple shards. This
information is accumulated shard-by-shard, and we keep track of which shards are represented in this value. Only once all shards are
represented should this information be considered accurate for the index.-
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.ParamsNested 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 IndexLongFieldRangeEMPTYSentinel value indicating an empty range, for instance because the field is missing or has no values in any shard.static IndexLongFieldRangeNO_SHARDSSentinel value indicating that no information is currently available, for instance because the index has just been created.static IndexLongFieldRangeUNKNOWNSentinel value indicating the actual range is unknown, for instance because more docs may be added in future.Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Method Summary
Modifier and Type Method Description booleancontainsAllShardRanges()booleanequals(java.lang.Object o)IndexLongFieldRangeextendWithShardRange(int shardId, int shardCount, ShardLongFieldRange shardFieldRange)static IndexLongFieldRangefromXContent(org.elasticsearch.common.xcontent.XContentParser parser)longgetMax()longgetMin()inthashCode()booleanisComplete()static IndexLongFieldRangereadFrom(StreamInput in)IndexLongFieldRangeremoveShard(int shardId, int numberOfShards)Remove the given shard from the set of known shards, possibly without adjusting the min and max.java.lang.StringtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
NO_SHARDS
Sentinel value indicating that no information is currently available, for instance because the index has just been created. -
EMPTY
Sentinel value indicating an empty range, for instance because the field is missing or has no values in any shard. -
UNKNOWN
Sentinel value indicating the actual range is unknown, for instance because more docs may be added in future.
-
-
Method Details
-
isComplete
public boolean isComplete()- Returns:
- whether this range includes information from all shards yet.
-
containsAllShardRanges
public boolean containsAllShardRanges()- Returns:
- whether this range includes information from all shards and can be used meaningfully.
-
getMin
public long getMin()- Returns:
- the (inclusive) minimum of this range.
-
getMax
public long getMax()- Returns:
- the (inclusive) maximum of this range.
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
readFrom
- Throws:
java.io.IOException
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-
fromXContent
public static IndexLongFieldRange fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException- Throws:
java.io.IOException
-
extendWithShardRange
public IndexLongFieldRange extendWithShardRange(int shardId, int shardCount, ShardLongFieldRange shardFieldRange) -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
removeShard
Remove the given shard from the set of known shards, possibly without adjusting the min and max. Used when allocating a stale primary which may have a different range from the original, so we must allow the range to grow. Note that this doesn't usually allow the range to shrink, so we may in theory hit this shard more than needed after allocating a stale primary.
-