Documentation ¶
Index ¶
- Variables
- type Archive
- func (a Archive) Backup(entry domain.Entry) error
- func (a Archive) Close() error
- func (a Archive) Delete(entry domain.Entry) error
- func (a Archive) FindLocallyMissing(fn func(entry domain.Entry))
- func (a Archive) GetEntry(relPath string) *domain.Entry
- func (a Archive) NeedsBackup(entry domain.Entry) bool
- func (a Archive) Restore(entry domain.Entry) error
- type EntryFlags
- type Index
- type LocalContext
- type StorageProvider
Constants ¶
This section is empty.
Variables ¶
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.
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.
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.
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) FindLocallyMissing ¶
FindLocallyMissing finds entries that are in the backup but not available locally.
func (Archive) GetEntry ¶
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 ¶
NeedsBackup determines if the given entry needs to be backed up.
type EntryFlags ¶
type EntryFlags uint32
const ( EntryFlagsNone EntryFlags = 0x0000_0000 EntryFlagsPresentInBackup EntryFlags = 0x0000_0001 EntryFlagsPresentInLocal EntryFlags = 0x0000_0002 )
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 }