domain

package
v0.0.0-...-3ddbc71 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package domain keeps shared structures, constants and functions.

Index

Constants

View Source
const (
	ScriptsDirectoryName = "scripts"
	SystemdDirectoryName = "systemd"
)

Scripts and systemd units path.

View Source
const DeloreanMountPoint = "/run/delorean"

DeloreanMountPoint is a mount point where subvolumes will be mount and where snapshots will be reachable.

View Source
const DeloreanPath = "/usr/local/delorean"

DeloreanPath is a path to delorean config and scripts.

View Source
const RWFileMode = 0o600
View Source
const SnapshotFormat = "2006-01-02_15:04:05"

SnapshotFormat is a format of snapshots names.

View Source
const SnapshotsDirName = ".snapshots"

SnapshotsDirName represents main snapsshots root directory name.

View Source
const Subvol5 = "subvol5"

Subvol5 represents subvolume with id = 5. A top level subvolume.

Variables

View Source
var ErrSnapshotIsNotChosen = errors.New("snapshot is not chosen")

Functions

func CheckDir

func CheckDir(ph string, fm fs.FileMode) error

CheckDir checks if directory exists and creates if it doesn't.

Types

type Device

type Device struct {
	UUID       string `json:"uuid"`
	Path       string `json:"path"`
	MountPoint string `json:"mount_point"`
}

Device represent LVM device.

type Schedule

type Schedule struct {
	Monthly int `json:"monthly"`
	Weekly  int `json:"weekly"`
	Daily   int `json:"daily"`
	Hourly  int `json:"hourly"`
	Boot    int `json:"boot"`
}

Schedule represents the settings of scheduled snapshots.

func (*Schedule) Decrease

func (s *Schedule) Decrease(schedType int) bool

Decrease decreases value of `schedType` for settings.

func (*Schedule) Increase

func (s *Schedule) Increase(schedType int) bool

Increase increases value of `schedType` for settings.

type Snapshot

type Snapshot struct {
	ID        uint64       `json:"id"`
	Path      string       `json:"path"`
	Label     string       `json:"label"`
	Type      SnapshotType `json:"type"` // manual, weekly, daily, etc.
	Timestamp int64        `json:"timestamp"`
	Kernel    string       `json:"kernel"`
	Volume    Volume       `json:"volume"`
}

Snapshot represents snapshot object, keeps all needed data.

func NewSnapshot

func NewSnapshot(phToSnapshots, kernel string, vol Volume, sType SnapshotType) Snapshot

NewSnapshot creates a new snapshot object.

type SnapshotType

type SnapshotType string
const (
	Monthly SnapshotType = "monthly"
	Weekly  SnapshotType = "weekly"
	Daily   SnapshotType = "daily"
	Hourly  SnapshotType = "hourly"
	Boot    SnapshotType = "boot"
	Manual  SnapshotType = "manual"
	Restore SnapshotType = "restore"
)

Snapshots types.

func (SnapshotType) String

func (s SnapshotType) String() string

type SortableSnapshots

type SortableSnapshots []Snapshot

func (SortableSnapshots) Len

func (ss SortableSnapshots) Len() int

func (SortableSnapshots) Less

func (ss SortableSnapshots) Less(i, j int) bool

func (SortableSnapshots) Swap

func (ss SortableSnapshots) Swap(i, j int)

type Volume

type Volume struct {
	ID            uint64 `json:"id"`
	Subvol        string `json:"subvol"`
	Label         string `json:"label"`
	SnapshotsPath string `json:"snapshots_path"`
	Active        bool   `json:"active"`
	Device        Device `json:"device"`
}

Volume represents btrfs volume.

Jump to

Keyboard shortcuts

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