Class DiskUsageMonitor


  • public class DiskUsageMonitor
    extends java.lang.Object
    Schedule periodic task to monitor local disk usage and notify DiskUsageBroadcaster if local state changed.
    • 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()
      • 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)