Class DiskUsageMonitor
- java.lang.Object
-
- org.apache.cassandra.service.disk.usage.DiskUsageMonitor
-
public class DiskUsageMonitor extends java.lang.Object
Schedule periodic task to monitor local disk usage and notifyDiskUsageBroadcaster
if local state changed.
-
-
Field Summary
Fields Modifier and Type Field Description static DiskUsageMonitor
instance
-
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 long
getAllMemtableSize()
double
getDiskUsage()
DiskUsageState
getState(long usagePercentage)
void
start(java.util.function.Consumer<DiskUsageState> notifier)
Start monitoring local disk usage and call notifier when local disk usage state changed.DiskUsageState
state()
static long
totalDiskSpace()
static long
totalSpace(java.nio.file.FileStore store)
void
updateLocalState(double usageRatio, java.util.function.Consumer<DiskUsageState> notifier)
static long
usableSpace(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)
-
-