java.lang.Object
java.lang.Record
org.elasticsearch.cluster.DiskUsage
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentFragment
public record DiskUsage(String nodeId, String nodeName, String path, long totalBytes, long freeBytes)
extends Record
implements ToXContentFragment, Writeable
Encapsulation class used to represent the amount of disk used on a node.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopyWithFreeBytes(long freeBytes) final booleanIndicates whether some other object is "equal to" this one.static DiskUsagefindLeastAvailablePath(NodeStats nodeStats) Finds the path with the least available disk space and returns its disk usage.static DiskUsagefindMostAvailable(NodeStats nodeStats) Finds the path with the most available disk space and returns its disk usage.longReturns the value of thefreeBytesrecord component.doublefinal inthashCode()Returns a hash code value for this object.nodeId()Returns the value of thenodeIdrecord component.nodeName()Returns the value of thenodeNamerecord component.path()Returns the value of thepathrecord component.toString()Returns a string representation of this record class.longReturns the value of thetotalBytesrecord component.toXContent(XContentBuilder builder, ToXContent.Params params) longdoublevoidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Constructor Details
-
DiskUsage
- Throws:
IOException
-
DiskUsage
Creates an instance of aDiskUsagerecord class.- Parameters:
nodeId- the value for thenodeIdrecord componentnodeName- the value for thenodeNamerecord componentpath- the value for thepathrecord componenttotalBytes- the value for thetotalBytesrecord componentfreeBytes- the value for thefreeBytesrecord component
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
freeDiskAsPercentage
public double freeDiskAsPercentage() -
usedDiskAsPercentage
public double usedDiskAsPercentage() -
usedBytes
public long usedBytes() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
copyWithFreeBytes
-
findLeastAvailablePath
Finds the path with the least available disk space and returns its disk usage. It returns null if there is no file system data in the NodeStats or if the total bytes are a negative number. -
findMostAvailable
Finds the path with the most available disk space and returns its disk usage. It returns null if there are no file system data in the node stats or if the total bytes are a negative number. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
nodeId
Returns the value of thenodeIdrecord component.- Returns:
- the value of the
nodeIdrecord component
-
nodeName
Returns the value of thenodeNamerecord component.- Returns:
- the value of the
nodeNamerecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
totalBytes
public long totalBytes()Returns the value of thetotalBytesrecord component.- Returns:
- the value of the
totalBytesrecord component
-
freeBytes
public long freeBytes()Returns the value of thefreeBytesrecord component.- Returns:
- the value of the
freeBytesrecord component
-