java.lang.Object
org.elasticsearch.cluster.ClusterInfo
- All Implemented Interfaces:
Writeable
,ChunkedToXContent
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 ClassesModifier and TypeClassDescriptionstatic final record
Represents a data path on a nodestatic final record
static final record
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.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TransportVersion
static final TransportVersion
static final ClusterInfo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ClusterInfo
(Map<String, DiskUsage> leastAvailableSpaceUsage, Map<String, DiskUsage> mostAvailableSpaceUsage, Map<String, Long> shardSizes, Map<ShardId, Long> shardDataSetSizes, Map<ClusterInfo.NodeAndShard, String> dataPath, Map<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace> reservedSpace) Creates a new ClusterInfo instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getDataPath
(ClusterInfo.NodeAndShard nodeAndShard) getDataPath
(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
if 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.getShardSize
(ShardId shardId, boolean primary) Returns the shard size for the given shardId ornull
if that metric is not available.long
getShardSize
(ShardId shardId, boolean primary, long defaultValue) Returns the shard size for the given shard routing ordefaultValue
it that metric is not available.int
hashCode()
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.static String
shardIdentifierFromRouting
(ShardId shardId, boolean primary) toString()
Iterator
<? extends ToXContent> toXContentChunked
(ToXContent.Params params) Create an iterator ofToXContent
chunks for a REST response.void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunkedV7
-
Field Details
-
EMPTY
-
DATA_SET_SIZE_SIZE_VERSION
-
DATA_PATH_NEW_KEY_VERSION
-
-
Constructor Details
-
ClusterInfo
protected ClusterInfo() -
ClusterInfo
public ClusterInfo(Map<String, DiskUsage> leastAvailableSpaceUsage, Map<String, DiskUsage> mostAvailableSpaceUsage, Map<String, Long> shardSizes, Map<ShardId, Long> shardDataSetSizes, Map<ClusterInfo.NodeAndShard, String> dataPath, Map<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 sharddataPath
- the shard routing to datapath mappingreservedSpace
- reserved space per shard broken down by node and data path- See Also:
-
ClusterInfo
- Throws:
IOException
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContent
Create an iterator ofToXContent
chunks for a REST response. Each chunk is serialized with the sameXContentBuilder
andToXContent.Params
, which is also the same as theToXContent.Params
passed as theparams
argument. For best results, all chunks should beO(1)
size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelper
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 interfaceChunkedToXContent
- Returns:
- iterator over chunks of
ToXContent
-
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 shardId ornull
if that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ornull
if that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ordefaultValue
it that metric is not available. -
getShardSize
Returns the shard size for the given shard routing ordefaultValue
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. -
getDataPath
-
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. -
shardIdentifierFromRouting
-
equals
-
hashCode
public int hashCode() -
toString
-