snaputil

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: LGPL-3.0 Imports: 7 Imported by: 2

Documentation

Overview

Snaputil provides utility functions for working with snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSnapshotByName

func GetSnapshotByName(snapshots []*btrfs.RootInfo, name string) *btrfs.RootInfo

GetSnapshotByName will return the snapshot with the given name from the given slice of snapshots.

func ResolveSubvolumeDetails

func ResolveSubvolumeDetails(logger *log.Logger, verbosity int, subvolumePath, snapshotDirectory, snapshotName string) (*btrfs.RootInfo, error)

ResolveSubvolumeDetails will lookup the information for a subvolume and all its corresponding snapshots. Snapshots are filtered by the given snapshot directory and name.

func SnapshotSliceContains

func SnapshotSliceContains(ss []*btrfs.RootInfo, name string) bool

SnapshotSliceContains will return true if the given slice of snapshots contains the given snapshot.

func SnapshotUUIDExists

func SnapshotUUIDExists(snapshots []*btrfs.RootInfo, uu uuid.UUID) bool

SnapshotUUIDExists will return true if the given UUID exists in the given slice of snapshots.

func SortSnapshots

func SortSnapshots(snapshots []*btrfs.RootInfo, order SortOrder)

SortSnapshots will sort the given snapshots by their creation time in the given order.

Types

type IncrementalSnapshot

type IncrementalSnapshot struct {
	Snapshot *btrfs.RootInfo
	Parent   *btrfs.RootInfo
}

func MapParents

func MapParents(snapshots []*btrfs.RootInfo) []*IncrementalSnapshot

MapParents will map the given snapshots to their parent snapshots. This method assumes that parenthood corresponds to the order of the given snapshots and it will sort them in ascending order of creation time.

type SortOrder

type SortOrder int
const (
	SortAscending SortOrder = iota
	SortDescending
)

Jump to

Keyboard shortcuts

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