Documentation ¶
Overview ¶
Package toglacier have all the functions to manage your backups in the cloud.
Index ¶
- func ErrorEqual(first, second error) bool
- type EmailInfo
- type EmailSender
- type EmailSenderFunc
- type Error
- type ErrorCode
- type ToGlacier
- func (t ToGlacier) Backup(backupPaths []string, backupSecret string, modifyTolerance float64, ...) error
- func (t ToGlacier) ListBackups(remote bool) (storage.Backups, error)
- func (t ToGlacier) RemoveBackups(ids ...string) error
- func (t ToGlacier) RemoveOldBackups(keepBackups int) error
- func (t ToGlacier) RetrieveBackup(id, backupSecret string, skipUnmodified bool) error
- func (t ToGlacier) SendReport(emailInfo EmailInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorEqual ¶
ErrorEqual compares two Error objects. This is useful to compare down to the low level errors.
Types ¶
type EmailInfo ¶
type EmailInfo struct { Sender EmailSender Server string Port int Username string Password string From string To []string Format report.Format }
EmailInfo stores all necessary information to send an e-mail.
type EmailSender ¶
type EmailSender interface {
SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) error
}
EmailSender e-mail API to make it easy to mock the smtp.SendEmail function.
type EmailSenderFunc ¶
EmailSenderFunc helper function to create a fast implementation of the EmailSender interface.
type Error ¶
Error stores error details from a problem occurred while executing high level commands from toglacier.
type ErrorCode ¶
type ErrorCode string
ErrorCode stores the error type that occurred while processing commands from toglacier.
const ( // ErrorCodeModifyTolerance error when too many files were modified between // backups. This is an alert for ransomware infection. ErrorCodeModifyTolerance ErrorCode = "modify-tolerance" )
type ToGlacier ¶
type ToGlacier struct { Context context.Context Archive archive.Archive Envelop archive.Envelop Cloud cloud.Cloud Storage storage.Storage Logger log.Logger }
ToGlacier manages backups in the cloud.
func (ToGlacier) Backup ¶
func (t ToGlacier) Backup(backupPaths []string, backupSecret string, modifyTolerance float64, ignorePatterns []*regexp.Regexp) error
Backup create an archive and send it to the cloud. Optionally encrypt the backup with the backupSecret password, if you leave it blank no encryption will be performed. There's also an option to stop the backup if there're to many files modified (ransomware detection), the modifyTolerance is the percentage (0 - 100) of modified files that is tolerated. If there's no need to keep track of the modified files set modifyTolerance to 0 or 100. You could also ignore some files or directories in the backup paths using regular expressions in the ignorePatterns parameter.
func (ToGlacier) ListBackups ¶
ListBackups show the current backups. With the remote flag it is possible to list the backups tracked locally or retrieve the cloud inventory.
func (ToGlacier) RemoveBackups ¶
RemoveBackups delete a backups identified by ids from the cloud and from the local storage. It will also try to replace or remove the reference from the removed backup on other backups. When it is possible to replace the reference it will try to get the file version right before the removed backup date.
func (ToGlacier) RemoveOldBackups ¶
RemoveOldBackups delete old backups from the cloud. This will optimize the cloud space usage, as too old backups aren't used.
func (ToGlacier) RetrieveBackup ¶
RetrieveBackup recover a specific backup from the cloud. If the backup is encrypted it can be decrypted if the backupSecret is informed. Also, it is possible to avoid downloading backups that contain only unmodified files with the skipUnmodified flag.
func (ToGlacier) SendReport ¶
SendReport send information from the actions performed by this tool via e-mail to an administrator.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
archive
Package archive builds the backup archive.
|
Package archive builds the backup archive. |
cloud
Package cloud manages the backup in a specific cloud.
|
Package cloud manages the backup in a specific cloud. |
config
Package config store all necessary configuration parameters for the project.
|
Package config store all necessary configuration parameters for the project. |
log
Package log defines an interface for the library be able to log what is happening on each stage.
|
Package log defines an interface for the library be able to log what is happening on each stage. |
report
Package report build a text with all actions performed by the tool.
|
Package report build a text with all actions performed by the tool. |
storage
Package storage keep track of the uploaded backups.
|
Package storage keep track of the uploaded backups. |