java.lang.Object
org.elasticsearch.cluster.ClusterInfo
- All Implemented Interfaces:
Writeable,ChunkedToXContent
ClusterInfo is an object representing a map of nodes to
DiskUsage
and a map of shard ids to shard sizes and shard write-loads, see
InternalClusterInfoService.shardIdentifierFromRouting(String)
for the key used in the shardSizes map-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final recordRepresents a data path on a nodestatic final recordstatic final recordRepresents the total amount of "reserved" space on a particular data path, together with the set of shards considered.Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClusterInfo(Map<String, DiskUsage> leastAvailableSpaceUsage, Map<String, DiskUsage> mostAvailableSpaceUsage, Map<String, Long> shardSizes, Map<ShardId, Long> shardDataSetSizes, Map<ClusterInfo.NodeAndShard, String> dataPath, Map<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace> reservedSpace, Map<String, EstimatedHeapUsage> estimatedHeapUsages, Map<String, NodeUsageStatsForThreadPools> nodeUsageStatsForThreadPools, Map<ShardId, Double> shardWriteLoads) Creates a new ClusterInfo instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterInfo.Builderbuilder()booleangetDataPath(ClusterInfo.NodeAndShard nodeAndShard) getDataPath(ShardRouting shardRouting) Returns the nodes absolute data-path the given shard is allocated on ornullif the information is not available.Returns a node id to estimated heap usage mapping for all nodes that we have such data for.Returns a node id to disk usage mapping for the path that has the least available space on the node.Returns a node id to disk usage mapping for the path that has the most available space on the node.Returns a map containing thread pool usage stats for each node, keyed by node ID.getReservedSpace(String nodeId, String dataPath) Returns the reserved space for each shard on the given node/path pairgetShardDataSetSize(ShardId shardId) getShardSize(ShardRouting shardRouting) Returns the shard size for the given shard routing ornullif that metric is not available.longgetShardSize(ShardRouting shardRouting, long defaultValue) Returns the shard size for the given shard routing ordefaultValueit that metric is not available.getShardSize(ShardId shardId, boolean primary) Returns the shard size for the given shardId ornullif that metric is not available.longgetShardSize(ShardId shardId, boolean primary, long defaultValue) Returns the shard size for the given shard routing ordefaultValueit that metric is not available.Returns a map of shard IDs to the write-loads for use in balancing.inthashCode()static StringshardIdentifierFromRouting(ShardRouting shardRouting) Method that incorporates the ShardId for the shard into a string that includes a 'p' or 'r' depending on whether the shard is a primary.static StringshardIdentifierFromRouting(ShardId shardId, boolean primary) toString()Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params) Create an iterator ofToXContentchunks for a REST response.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.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8
-
Field Details
-
EMPTY
-
-
Constructor Details
-
ClusterInfo
protected ClusterInfo() -
ClusterInfo
public ClusterInfo(Map<String, DiskUsage> leastAvailableSpaceUsage, Map<String, DiskUsage> mostAvailableSpaceUsage, Map<String, Long> shardSizes, Map<ShardId, Long> shardDataSetSizes, Map<ClusterInfo.NodeAndShard, String> dataPath, Map<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace> reservedSpace, Map<String, EstimatedHeapUsage> estimatedHeapUsages, Map<String, NodeUsageStatsForThreadPools> nodeUsageStatsForThreadPools, Map<ShardId, Double> shardWriteLoads) Creates a new ClusterInfo instance.- Parameters:
leastAvailableSpaceUsage- a node id to disk usage mapping for the path that has the least available space on the node.mostAvailableSpaceUsage- a node id to disk usage mapping for the path that has the most available space on the node.shardSizes- a shardkey to size in bytes mapping per shard.shardDataSetSizes- a shard id to data set size in bytes mapping per sharddataPath- the shard routing to datapath mappingreservedSpace- reserved space per shard broken down by node and data pathestimatedHeapUsages- estimated heap usage broken down by nodenodeUsageStatsForThreadPools- node-level usage stats (operational load) broken down by node- See Also:
-
ClusterInfo
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContentCreate an iterator ofToXContentchunks for a REST response. Each chunk is serialized with the sameXContentBuilderandToXContent.Params, which is also the same as theToXContent.Paramspassed as theparamsargument. For best results, all chunks should beO(1)size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelperfor some handy utilities.Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.
- Specified by:
toXContentChunkedin interfaceChunkedToXContent- Returns:
- iterator over chunks of
ToXContent
-
getEstimatedHeapUsages
Returns a node id to estimated heap usage mapping for all nodes that we have such data for. Note that these estimates should be considered minimums. They may be used to determine whether there IS NOT capacity to do something, but not to determine that there IS capacity to do something. Also note that the map may not be complete, it may contain none, or a subset of the nodes in the cluster at any time. It may also contain entries for nodes that have since left the cluster. -
getNodeUsageStatsForThreadPools
Returns a map containing thread pool usage stats for each node, keyed by node ID. -
getNodeLeastAvailableDiskUsages
Returns a node id to disk usage mapping for the path that has the least available space on the node. Note that this does not take account of reserved space: there may be another path with less available _and unreserved_ space. -
getNodeMostAvailableDiskUsages
Returns a node id to disk usage mapping for the path that has the most available space on the node. Note that this does not take account of reserved space: there may be another path with more available _and unreserved_ space. -
getShardWriteLoads
Returns a map of shard IDs to the write-loads for use in balancing. The write-loads can be interpreted as the average number of threads that ingestion to the shard will consume. This information may be partial or missing altogether under some circumstances. The absence of a shard write load from the map should be interpreted as "unknown". -
getShardSize
Returns the shard size for the given shardId ornullif that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ornullif that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ordefaultValueit that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ordefaultValueit that metric is not available. -
getDataPath
Returns the nodes absolute data-path the given shard is allocated on ornullif the information is not available. -
getDataPath
-
getShardDataSetSize
-
getReservedSpace
Returns the reserved space for each shard on the given node/path pair -
shardIdentifierFromRouting
Method that incorporates the ShardId for the shard into a string that includes a 'p' or 'r' depending on whether the shard is a primary. -
shardIdentifierFromRouting
-
equals
-
hashCode
public int hashCode() -
toString
-
builder
-