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, see
InternalClusterInfoService.shardIdentifierFromRouting(String)
for the key used in the shardSizes map-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic 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
FieldsModifier and TypeFieldDescriptionstatic final TransportVersionstatic final TransportVersionstatic final ClusterInfo -
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) Creates a new ClusterInfo instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetDataPath(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 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.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.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
-
DATA_SET_SIZE_SIZE_VERSION
-
DATA_PATH_NEW_KEY_VERSION
-
-
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) 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 path- 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
-
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. -
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
-