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 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.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Modifier and TypeFieldDescriptionstatic IndexLongFieldRange
Sentinel value indicating an empty range, for instance because the field is missing or has no values in any shard.static IndexLongFieldRange
Sentinel value indicating that no information is currently available, for instance because the index has just been created.static IndexLongFieldRange
Sentinel 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 TypeMethodDescriptionboolean
boolean
extendWithShardRange(int shardId, int shardCount, ShardLongFieldRange shardFieldRange)
static IndexLongFieldRange
fromXContent(org.elasticsearch.common.xcontent.XContentParser parser)
long
getMax()
long
getMin()
int
hashCode()
boolean
static IndexLongFieldRange
readFrom(StreamInput in)
removeShard(int shardId, int numberOfShards)
Remove the given shard from the set of known shards, possibly without adjusting the min and max.toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
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
-
fromXContent
public static IndexLongFieldRange fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException- Throws:
IOException
-
extendWithShardRange
public IndexLongFieldRange extendWithShardRange(int shardId, int shardCount, ShardLongFieldRange shardFieldRange) -
toString
-
equals
-
hashCode
public int hashCode() -
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.
-