Package org.elasticsearch.cluster
Class ClusterInfo
java.lang.Object
org.elasticsearch.cluster.ClusterInfo
- All Implemented Interfaces:
Writeable
,org.elasticsearch.common.xcontent.ToXContent
,org.elasticsearch.common.xcontent.ToXContentFragment
public class ClusterInfo
extends Object
implements org.elasticsearch.common.xcontent.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
Modifier and TypeClassDescriptionstatic class
Represents a data path on a nodestatic class
Represents 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.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
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ModifierConstructorDescriptionprotected
ClusterInfo(ImmutableOpenMap<String,DiskUsage> leastAvailableSpaceUsage, ImmutableOpenMap<String,DiskUsage> mostAvailableSpaceUsage, ImmutableOpenMap<String,Long> shardSizes, ImmutableOpenMap<ShardId,Long> shardDataSetSizes, ImmutableOpenMap<ShardRouting,String> routingToDataPath, ImmutableOpenMap<ClusterInfo.NodeAndPath,ClusterInfo.ReservedSpace> reservedSpace)
Creates a new ClusterInfo instance. -
Method Summary
Modifier and TypeMethodDescriptiongetDataPath(ShardRouting shardRouting)
Returns the nodes absolute data-path the given shard is allocated on ornull
if 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 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.static String
shardIdentifierFromRouting(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.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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
DATA_SET_SIZE_SIZE_VERSION
-
EMPTY
-
-
Constructor Details
-
ClusterInfo
protected ClusterInfo() -
ClusterInfo
public ClusterInfo(ImmutableOpenMap<String,DiskUsage> leastAvailableSpaceUsage, ImmutableOpenMap<String,DiskUsage> mostAvailableSpaceUsage, ImmutableOpenMap<String,Long> shardSizes, ImmutableOpenMap<ShardId,Long> shardDataSetSizes, ImmutableOpenMap<ShardRouting,String> routingToDataPath, ImmutableOpenMap<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 shardroutingToDataPath
- the shard routing to datapath mappingreservedSpace
- reserved space per shard broken down by node and data path- See Also:
shardIdentifierFromRouting(org.elasticsearch.cluster.routing.ShardRouting)
-
ClusterInfo
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- 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
-
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 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. -
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.
-