server+healthcheck: rename function, add absolute disk space function

With this commit we rename the existing AvailableDiskSpace function to
its correct name AvailableDiskSpaceRatio as it only returns a ratio. We
then go ahead and add a new function that returns the actual number of
free bytes available on a file system.

This also fixes some comments and always returns an error instead of
panicking.
This commit is contained in:
Oliver Gugger committed 2020-11-13 10:19:50 +01:00
1 parent f8907fdb47
commit 35c1fad517
6 files changed
+83 -16

No files matched your search

+3 -1
View File
@@ -1302,7 +1302,9 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
diskCheck := healthcheck.NewObservation(
"disk space",
func() error {
free, err := healthcheck.AvailableDiskSpace(cfg.LndDir)
free, err := healthcheck.AvailableDiskSpaceRatio(
cfg.LndDir,
)
if err != nil {
return err
}