autobackup

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package autobackup generates an autobackup_meta.json from backups.

This is necessary because the UniFi Controller does not list the autobackup directory, it only reads the contents of the inventory file. A missing inventory results in UniFi stating no backups are available.

Non-auto backups are not handled. These will have been downloaded to the client machine, and backup files in the backup/ directory are not found by the controller. We could be missing an equivalent meta JSON file that the controller is looking for.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	ControllerVersion string
	Initiated         time.Time
	SizeBytes         int64
}

File represents a single autobackup .unf file.

func (File) MarshalJSON

func (f File) MarshalJSON() ([]byte, error)

func (File) Name

func (f File) Name() string

Name returns the name of the file, e.g. autobackup_7.1.66_20220702_2025_1656793500051.unf.

type MetaFile

type MetaFile []File

MetaFile represents the contents of the autobackup_meta.json file. Backups are ordered by time ascending.

func ParseBackups

func ParseBackups(backups []fs.FileInfo) (MetaFile, error)

ParseBackups turns a set of files into a representation of the meta file that can be serialised to autobackup_meta.json file. The set must only contain valid .unf backup files.

func (MetaFile) MarshalJSON

func (m MetaFile) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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