data

package
v0.0.0-...-66905c0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfEnoughSpaceToBackUp

func CheckIfEnoughSpaceToBackUp(storage string) error

CheckIfEnoughSpaceToBackUp performs a naive check if there is enough disk space on a filesystem holding the backups for another backup of MicroShift data. It does not accommodate for potential Copy-on-Write disk savings.

func CheckIfEnoughSpaceToRestore

func CheckIfEnoughSpaceToRestore(backupPath string) error

CheckIfEnoughSpaceToRestore performs a naive check if there is enough disk space on /var/lib filesystem to restore the backup. It does not accommodate for potential Copy-on-Write disk savings.

func GenerateUniqueTempPath

func GenerateUniqueTempPath(path string) (string, error)

GenerateUniqueTempPath returns a filepath from given path with extra suffix which doesn't exist.

func GetAvailableDiskSpace

func GetAvailableDiskSpace(path string) (uint64, error)

func GetSizeOfDir

func GetSizeOfDir(path string) (uint64, error)

func GetSizeOfMicroShiftData

func GetSizeOfMicroShiftData() (uint64, error)

func NewManager

func NewManager(storage StoragePath) (*manager, error)

Types

type AtomicDirCopy

type AtomicDirCopy struct {
	Source      string
	Destination string
	// contains filtered or unexported fields
}

AtomicDirCopy atomically copies directory. It performs a two operation: copies source path to a destination location with temporary name, then renames it to final name. On Unix systems, the rename operation is atomic. This ensures that the file is either fully renamed or not at all, which helps prevent issues like partial file copies in cases of power failure or unexpected program termination.

func (*AtomicDirCopy) CopyToIntermediate

func (c *AtomicDirCopy) CopyToIntermediate() error

func (*AtomicDirCopy) RenameToFinal

func (c *AtomicDirCopy) RenameToFinal() error

func (*AtomicDirCopy) RollbackIntermediate

func (c *AtomicDirCopy) RollbackIntermediate() error

type BackupName

type BackupName string

type EmptyArgErr

type EmptyArgErr struct {
	// contains filtered or unexported fields
}

func (*EmptyArgErr) Error

func (e *EmptyArgErr) Error() string

type Manager

type Manager interface {
	Backup(BackupName) (string, error)
	Restore(BackupName) error

	BackupExists(BackupName) (bool, error)
	GetBackupPath(BackupName) string
	GetBackupList() ([]BackupName, error)
	RemoveBackup(BackupName) error

	RemoveData() error
}

type StoragePath

type StoragePath string

func (StoragePath) GetBackupPath

func (sp StoragePath) GetBackupPath(backupName BackupName) string

func (StoragePath) SubStorage

func (sp StoragePath) SubStorage(subdir string) StoragePath

Jump to

Keyboard shortcuts

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