Class DiskUsageMonitor
- java.lang.Object
-
- org.apache.cassandra.service.disk.usage.DiskUsageMonitor
-
public class DiskUsageMonitor extends java.lang.ObjectSchedule periodic task to monitor local disk usage and notifyDiskUsageBroadcasterif local state changed.
-
-
Field Summary
Fields Modifier and Type Field Description static DiskUsageMonitorinstance
-
Constructor Summary
Constructors Constructor Description DiskUsageMonitor()DiskUsageMonitor(java.util.function.Supplier<com.google.common.collect.Multimap<java.nio.file.FileStore,Directories.DataDirectory>> dataDirectoriesSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAllMemtableSize()doublegetDiskUsage()DiskUsageStategetState(long usagePercentage)voidstart(java.util.function.Consumer<DiskUsageState> notifier)Start monitoring local disk usage and call notifier when local disk usage state changed.DiskUsageStatestate()static longtotalDiskSpace()static longtotalSpace(java.nio.file.FileStore store)voidupdateLocalState(double usageRatio, java.util.function.Consumer<DiskUsageState> notifier)static longusableSpace(java.nio.file.FileStore store)
-
-
-
Field Detail
-
instance
public static DiskUsageMonitor instance
-
-
Constructor Detail
-
DiskUsageMonitor
public DiskUsageMonitor()
-
DiskUsageMonitor
public DiskUsageMonitor(java.util.function.Supplier<com.google.common.collect.Multimap<java.nio.file.FileStore,Directories.DataDirectory>> dataDirectoriesSupplier)
-
-
Method Detail
-
start
public void start(java.util.function.Consumer<DiskUsageState> notifier)
Start monitoring local disk usage and call notifier when local disk usage state changed.
-
updateLocalState
public void updateLocalState(double usageRatio, java.util.function.Consumer<DiskUsageState> notifier)
-
state
public DiskUsageState state()
- Returns:
- local node disk usage state
-
getDiskUsage
public double getDiskUsage()
- Returns:
- The current disk usage (including all memtable sizes) ratio. This is the ratio between the space taken by all the data directories and the addition of that same space and the free available space on disk. The space taken by the data directories is the addition of the actual space on disk plus the size of the memtables. Memtables are included in that calculation because they are expected to be eventually flushed to disk.
-
getAllMemtableSize
public long getAllMemtableSize()
-
getState
public DiskUsageState getState(long usagePercentage)
-
totalDiskSpace
public static long totalDiskSpace()
-
totalSpace
public static long totalSpace(java.nio.file.FileStore store)
-
usableSpace
public static long usableSpace(java.nio.file.FileStore store)
-
-