archiving

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackupFileNotFound = errors.New("the file was not found in the backup")

BackupFileNotFound defines the error that is raised when a file is not found in the backup archive.

View Source
var IndexDecryptionFailed = errors.New("decryption of the archive index failed")

IndexDecryptionFailed defines the error that is raised when the decryption of an archive's index failed, most likely due to a wrong crypto key.

View Source
var IndexNotFound = errors.New("the index was not found in the backup destination")

IndexNotFound defines the error that is raised when an existing archive index cannot be located.

View Source
var SettingsNotFound = errors.New("the settings were not found in the backup destination")

SettingsNotFound defines the error that is raised when an existing archive's settings cannot be located.

Functions

This section is empty.

Types

type Archive

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

func NewArchive

func NewArchive(password string, localContext LocalContext, storageProvider StorageProvider) Archive

NewArchive creates a new archive.

func (Archive) Backup

func (a Archive) Backup(entry domain.Entry) error

Backup backs up the given entry.

func (Archive) Close

func (a Archive) Close() error

Close closes the archive.

func (Archive) Delete

func (a Archive) Delete(entry domain.Entry) error

Delete deletes the given entry from the backup.

func (Archive) FindLocallyMissing

func (a Archive) FindLocallyMissing(fn func(entry domain.Entry))

FindLocallyMissing finds entries that are in the backup but not available locally.

func (Archive) GetEntry

func (a Archive) GetEntry(relPath string) *domain.Entry

GetEntry returns a pointer to domain.Entry describing the file in the backup archive or null if the file is not present in the backup archive.

func (Archive) NeedsBackup

func (a Archive) NeedsBackup(entry domain.Entry) bool

NeedsBackup determines if the given entry needs to be backed up.

func (Archive) Restore

func (a Archive) Restore(entry domain.Entry) error

Restore restores the given entry.

type EntryFlags

type EntryFlags uint32
const (
	EntryFlagsNone            EntryFlags = 0x0000_0000
	EntryFlagsPresentInBackup EntryFlags = 0x0000_0001
	EntryFlagsPresentInLocal  EntryFlags = 0x0000_0002
)

type Index

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

func (*Index) Close

func (i *Index) Close() error

func (*Index) Count

func (i *Index) Count() int

func (*Index) Dirty

func (i *Index) Dirty() bool

type LocalContext

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

func NewLocalContext

func NewLocalContext(rootDir string) LocalContext

type StorageProvider

type StorageProvider interface {
	// When the backup destination does not have settings yet, the error must
	// be archiving.SettingsNotFound{}.
	ReadSettings() (io.ReadCloser, error)
	// When the backup destination does not have an index yet, the error must
	// be archiving.IndexNotFound{}.
	ReadIndex() (io.ReadCloser, error)
	ReadBackupFile(entry domain.Entry) (io.ReadCloser, error)

	NewSettingsWriter() (io.WriteCloser, error)
	NewIndexWriter() (io.WriteCloser, error)
	WriteBackupFile(entry domain.Entry, file *os.File) error

	DeleteSettings() error
	DeleteIndex() error
	DeleteBackupFile(entry domain.Entry) error
}

Jump to

Keyboard shortcuts

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