-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: add freeBytes gc policy entry
Signed-off-by: Justin Chadwell <me@jedevc.com>
- Loading branch information
Showing
18 changed files
with
358 additions
and
238 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
//go:build !windows && !openbsd | ||
// +build !windows,!openbsd | ||
|
||
package config | ||
|
||
import ( | ||
"syscall" | ||
) | ||
|
||
var DiskSpacePercentage int64 = 10 | ||
|
||
func getDiskSize(root string) (int64, error) { | ||
var st syscall.Statfs_t | ||
if err := syscall.Statfs(root, &st); err != nil { | ||
return 0, err | ||
} | ||
diskSize := int64(st.Bsize) * int64(st.Blocks) | ||
return diskSize, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,5 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package config | ||
|
||
import ( | ||
"golang.org/x/sys/windows" | ||
) | ||
|
||
// set as double that for Linux since | ||
// Windows images are generally larger. | ||
var DiskSpacePercentage int64 = 20 | ||
|
||
func getDiskSize(root string) (int64, error) { | ||
rootUTF16, err := windows.UTF16FromString(root) | ||
if err != nil { | ||
return 0, err | ||
} | ||
var freeAvailableBytes uint64 | ||
var totalBytes uint64 | ||
var totalFreeBytes uint64 | ||
|
||
if err := windows.GetDiskFreeSpaceEx( | ||
&rootUTF16[0], | ||
&freeAvailableBytes, | ||
&totalBytes, | ||
&totalFreeBytes); err != nil { | ||
return 0, err | ||
} | ||
return int64(totalBytes), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.