Package org.elasticsearch.cluster
Class ClusterInfo
java.lang.Object
org.elasticsearch.cluster.ClusterInfo
- All Implemented Interfaces:
Writeable
,ToXContent
,ToXContentFragment
public class ClusterInfo extends java.lang.Object implements ToXContentFragment, Writeable
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 classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
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 ClusterInfo
EMPTY
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClusterInfo()
ClusterInfo(ImmutableOpenMap<java.lang.String,DiskUsage> leastAvailableSpaceUsage, ImmutableOpenMap<java.lang.String,DiskUsage> mostAvailableSpaceUsage, ImmutableOpenMap<java.lang.String,java.lang.Long> shardSizes, ImmutableOpenMap<ShardRouting,java.lang.String> routingToDataPath)
Creates a new ClusterInfo instance.ClusterInfo(StreamInput in)
-
Method Summary
Modifier and Type Method Description java.lang.String
getDataPath(ShardRouting shardRouting)
Returns the nodes absolute data-path the given shard is allocated on ornull
if the information is not available.ImmutableOpenMap<java.lang.String,DiskUsage>
getNodeLeastAvailableDiskUsages()
Returns a node id to disk usage mapping for the path that has the least available space on the node.ImmutableOpenMap<java.lang.String,DiskUsage>
getNodeMostAvailableDiskUsages()
Returns a node id to disk usage mapping for the path that has the most available space on the node.java.lang.Long
getShardSize(ShardRouting shardRouting)
Returns the shard size for the given shard routing ornull
it that metric is not available.long
getShardSize(ShardRouting shardRouting, long defaultValue)
Returns the shard size for the given shard routing ordefaultValue
it that metric is not available.XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
Constructor Details
-
ClusterInfo
protected ClusterInfo() -
ClusterInfo
public ClusterInfo(ImmutableOpenMap<java.lang.String,DiskUsage> leastAvailableSpaceUsage, ImmutableOpenMap<java.lang.String,DiskUsage> mostAvailableSpaceUsage, ImmutableOpenMap<java.lang.String,java.lang.Long> shardSizes, ImmutableOpenMap<ShardRouting,java.lang.String> routingToDataPath)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.routingToDataPath
- the shard routing to datapath mapping- See Also:
shardIdentifierFromRouting(org.elasticsearch.cluster.routing.ShardRouting)
-
ClusterInfo
- Throws:
java.io.IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
getNodeLeastAvailableDiskUsages
Returns a node id to disk usage mapping for the path that has the least available space on the node. -
getNodeMostAvailableDiskUsages
Returns a node id to disk usage mapping for the path that has the most available space on the node. -
getShardSize
Returns the shard size for the given shard routing ornull
it that metric is not available. -
getDataPath
Returns the nodes absolute data-path the given shard is allocated on ornull
if the information is not available. -
getShardSize
Returns the shard size for the given shard routing ordefaultValue
it that metric is not available.
-