Class 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
    • 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

      • 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 or null 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 or null if the information is not available.
      • getShardSize

        public long getShardSize​(ShardRouting shardRouting,
                                 long defaultValue)
        Returns the shard size for the given shard routing or defaultValue it that metric is not available.