Documentation ¶
Overview ¶
Package cleanup contains helpers for disk cleanup.
Index ¶
- Constants
- func CreateFilledUserHomedir(ctx context.Context, user, pass, dir string, size uint64) (string, error)
- func ForceAutomaticCleanup(ctx context.Context) error
- func RunAutomaticCleanup(ctx context.Context, ...) error
- func RunOnExistingUsers(ctx context.Context) error
- func UserHomeExists(ctx context.Context, user string) (bool, error)
Constants ¶
const ( // Location of user directories. UserHome = "/home/user" // Shadow directory ShadowDir = "/home/.shadow" MiB uint64 = 1024 * 1024 // 1 MiB GiB uint64 = 1024 * MiB // 1 GiB MinimalFreeSpace = 512 * MiB // hard-coded in cryptohomed CleanupTarget = 2 * GiB // Default value in cryptohomed, when to stop cleaning. NotificationThreshold = 1 * GiB // Default value in cryptohomed, threshold for sending the low-disk-space notification. )
Constants taken from cryptohome.
Variables ¶
This section is empty.
Functions ¶
func CreateFilledUserHomedir ¶
func CreateFilledUserHomedir(ctx context.Context, user, pass, dir string, size uint64) (string, error)
CreateFilledUserHomedir creates a user taking up size space by filling dir.
func ForceAutomaticCleanup ¶
ForceAutomaticCleanup sets the cleanup thresholds above the current free space, forcing a cleanup. Does not continue past cache cleanup. cleanupThreshold = freeSpace + MinimalFreeSpace others = freeSpace + 10*CleanupTarget
func RunAutomaticCleanup ¶
func RunAutomaticCleanup(ctx context.Context, cleanupThreshold, aggressiveCleanupThreshold, criticalCleanupThreshold, targetThreshold uint64) error
RunAutomaticCleanup triggers cleanup by restarting cryptohome and waits until it is done.
func RunOnExistingUsers ¶
RunOnExistingUsers cleans up existing users so they don't affect the test by: 1. Unmount all users. 2. Trigger cleanup to clear all users. 3. If any cleanup was performed repeat 2.
Types ¶
This section is empty.