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 toDiskUsage
and a map of shard ids to shard sizes, seeInternalClusterInfoService.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
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
EMPTY
public static final ClusterInfo EMPTY
-
-
Constructor Detail
-
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
public ClusterInfo(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
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
public 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.
-
getNodeMostAvailableDiskUsages
public 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.
-
getShardSize
public java.lang.Long getShardSize(ShardRouting shardRouting)
Returns the shard size for the given shard routing ornull
it that metric is not available.
-
getDataPath
public 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.
-
getShardSize
public long getShardSize(ShardRouting shardRouting, long defaultValue)
Returns the shard size for the given shard routing ordefaultValue
it that metric is not available.
-
-