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 java.lang.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

    Nested Classes
    Modifier and Type Class Description
    static class  ClusterInfo.NodeAndPath
    Represents a data path on a node
    static class  ClusterInfo.ReservedSpace
    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
    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, ImmutableOpenMap<ClusterInfo.NodeAndPath,​ClusterInfo.ReservedSpace> reservedSpace)
    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 or null 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.
    ClusterInfo.ReservedSpace getReservedSpace​(java.lang.String nodeId, java.lang.String dataPath)
    Returns the reserved space for each shard on the given node/path pair
    java.lang.Long getShardSize​(ShardRouting shardRouting)
    Returns the shard size for the given shard routing or null it that metric is not available.
    long getShardSize​(ShardRouting shardRouting, long defaultValue)
    Returns the shard size for the given shard routing or defaultValue it that metric is not available.
    static java.lang.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

  • Constructor Details

  • Method Details

    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      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. Note that this does not take account of reserved space: there may be another path with less available _and unreserved_ space.
    • 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. Note that this does not take account of reserved space: there may be another path with more available _and unreserved_ space.
    • 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.
    • getReservedSpace

      public ClusterInfo.ReservedSpace getReservedSpace​(java.lang.String nodeId, java.lang.String dataPath)
      Returns the reserved space for each shard on the given node/path pair
    • shardIdentifierFromRouting

      public static java.lang.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.