Class ClusterInfo

java.lang.Object
org.elasticsearch.cluster.ClusterInfo
All Implemented Interfaces:
Writeable, ChunkedToXContent

public class ClusterInfo extends Object implements ChunkedToXContent, 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
  • Field Details

    • EMPTY

      public static final ClusterInfo EMPTY
    • DATA_SET_SIZE_SIZE_VERSION

      public static final TransportVersion DATA_SET_SIZE_SIZE_VERSION
    • DATA_PATH_NEW_KEY_VERSION

      public static final TransportVersion DATA_PATH_NEW_KEY_VERSION
  • Constructor Details

  • Method Details

    • writeTo

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

      public Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params)
      Description copied from interface: ChunkedToXContent
      Create an iterator of ToXContent chunks for a REST response. Each chunk is serialized with the same XContentBuilder and ToXContent.Params, which is also the same as the ToXContent.Params passed as the params argument. For best results, all chunks should be O(1) size. The last chunk in the iterator must always yield at least one byte of output. See also ChunkedToXContentHelper for some handy utilities.

      Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.

      Specified by:
      toXContentChunked in interface ChunkedToXContent
      Returns:
      iterator over chunks of ToXContent
    • getNodeLeastAvailableDiskUsages

      public Map<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 Map<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 Long getShardSize(ShardId shardId, boolean primary)
      Returns the shard size for the given shardId or null if that metric is not available.
    • getShardSize

      public Long getShardSize(ShardRouting shardRouting)
      Returns the shard size for the given shard routing or null if that metric 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.
    • getShardSize

      public long getShardSize(ShardId shardId, boolean primary, long defaultValue)
      Returns the shard size for the given shard routing or defaultValue it that metric is not available.
    • getDataPath

      public String getDataPath(ShardRouting shardRouting)
      Returns the nodes absolute data-path the given shard is allocated on or null if the information is not available.
    • getDataPath

      public String getDataPath(ClusterInfo.NodeAndShard nodeAndShard)
    • getShardDataSetSize

      public Optional<Long> getShardDataSetSize(ShardId shardId)
    • getReservedSpace

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

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

      public static String shardIdentifierFromRouting(ShardId shardId, boolean primary)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object