cleanup

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package cleanup contains helpers for disk cleanup.

Index

Constants

View Source
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

func ForceAutomaticCleanup(ctx context.Context) error

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

func RunOnExistingUsers(ctx context.Context) error

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.

func UserHomeExists

func UserHomeExists(ctx context.Context, user string) (bool, error)

UserHomeExists checks if a users home exists on disk.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL