Class ClusterInfo

org.elasticsearch.cluster.ClusterInfo
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public class ClusterInfo extends 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 
    Represents a data path on a node
    static 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
    Modifier and Type
    Field
    Description
    static Version
     
     

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
     
    ,​DiskUsage> leastAvailableSpaceUsage, ,​DiskUsage> mostAvailableSpaceUsage, ,​> shardSizes, > shardDataSetSizes, > routingToDataPath, ImmutableOpenMap<ClusterInfo.NodeAndPath,​ClusterInfo.ReservedSpace> reservedSpace)
    Creates a new ClusterInfo instance.
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getDataPath​(ShardRouting shardRouting)
    Returns the nodes absolute data-path the given shard is allocated on or null 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.
     nodeId,  dataPath)
    Returns the reserved space for each shard on the given node/path pair
    <>
     
    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
    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
    Write this into the StreamOutput.

    Methods inherited from class java.lang.

    , , , , , , , , , ,

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • DATA_SET_SIZE_SIZE_VERSION

      public static final Version DATA_SET_SIZE_SIZE_VERSION
    • EMPTY

      public static final ClusterInfo EMPTY
  • Constructor Details

    • ClusterInfo

      protected ClusterInfo()
    • ClusterInfo

      public ClusterInfo(,​DiskUsage> leastAvailableSpaceUsage, ,​DiskUsage> mostAvailableSpaceUsage, ,​> shardSizes, > shardDataSetSizes, > 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 shard
      routingToDataPath - the shard routing to datapath mapping
      reservedSpace - reserved space per shard broken down by node and data path
      See Also:
      shardIdentifierFromRouting(org.elasticsearch.cluster.routing.ShardRouting)
    • ClusterInfo

      public ClusterInfo(StreamInput in) throws
      Throws:
  • Method Details

    • writeTo

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

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
    • getNodeLeastAvailableDiskUsages

      public ,​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 ,​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  getShardSize(ShardRouting shardRouting)
      Returns the shard size for the given shard routing or null it that metric is not available.
    • getDataPath

      public  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.
    • getShardDataSetSize

      public <> getShardDataSetSize(ShardId shardId)
    • getReservedSpace

      public  nodeId,  dataPath)
      Returns the reserved space for each shard on the given node/path pair
    • shardIdentifierFromRouting

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