Documentation
¶
Overview ¶
Package snapmanager provides a simple snapshot manager for btrfs subvolumes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
FullSubvolumePath string
SnapshotDirectory string
SnapshotName string
SnapshotInterval time.Duration
SnapshotMinimumRetention time.Duration
SnapshotRetention time.Duration
SnapshotRetentionInterval time.Duration
TimeFormat string
Logger *log.Logger
Verbosity int
}
Config is the config for a snapshot manager.
type SnapManager ¶
type SnapManager struct {
// contains filtered or unexported fields
}
SnapManager is a manager for snapshots of a given subvolume.
func New ¶
func New(cfg *Config) (*SnapManager, error)
New prepares a new snapshot manager for the given subvolume path and config.
func (*SnapManager) EnsureMostRecentSnapshot ¶
func (sm *SnapManager) EnsureMostRecentSnapshot() error
EnsureMostRecentSnapshot ensures that a snapshot exists for the subvolume within the configured snapshot interval. If a snapshot does not exist, it will be created with the name and timestamp format provided in the configuration.
func (*SnapManager) GetMostRecentSnapshot ¶
func (sm *SnapManager) GetMostRecentSnapshot() (*btrfs.RootInfo, error)
GetMostRecentSnapshot returns the most recent snapshot of the subvolume.
func (*SnapManager) PruneSnapshots ¶
func (sm *SnapManager) PruneSnapshots() error
PruneSnapshots prunes snapshots that are older than the configured retention period and that are within the minimum retention period according to the configured intervals.