Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdapterType ¶ added in v1.2.0
type AdapterType string
const ( LocalBackupAdapter AdapterType = "wings" S3BackupAdapter AdapterType = "s3" )
type ArchiveDetails ¶
type ArchiveDetails struct { Checksum string `json:"checksum"` ChecksumType string `json:"checksum_type"` Size int64 `json:"size"` }
func (*ArchiveDetails) ToRequest ¶
func (ad *ArchiveDetails) ToRequest(successful bool) api.BackupRequest
Returns a request object.
type Backup ¶
type Backup struct { // The UUID of this backup object. This must line up with a backup from // the panel instance. Uuid string `json:"uuid"` // An array of files to ignore when generating this backup. This should be // compatible with a standard .gitignore structure. Ignore string `json:"ignore"` // contains filtered or unexported fields }
func (*Backup) Details ¶
func (b *Backup) Details() *ArchiveDetails
Returns details of the archive by utilizing two go-routines to get the checksum and the size of the archive.
func (*Backup) Identifier ¶
type BackupInterface ¶
type BackupInterface interface { // Returns the UUID of this backup as tracked by the panel instance. Identifier() string // Attaches additional context to the log output for this backup. WithLogContext(map[string]interface{}) // Generates a backup in whatever the configured source for the specific // implementation is. Generate(string, string) (*ArchiveDetails, error) // Returns the ignored files for this backup instance. Ignored() string // Returns a SHA1 checksum for the generated backup. Checksum() ([]byte, error) // Returns the size of the generated backup. Size() (int64, error) // Returns the path to the backup on the machine. This is not always the final // storage location of the backup, simply the location we're using to store // it until it is moved to the final spot. Path() string // Returns details about the archive. Details() *ArchiveDetails // Removes a backup file. Remove() error }
noinspection GoNameStartsWithPackageName
type LocalBackup ¶
type LocalBackup struct {
Backup
}
func LocateLocal ¶
func LocateLocal(uuid string) (*LocalBackup, os.FileInfo, error)
Locates the backup for a server and returns the local path. This will obviously only work if the backup was created as a local backup.
func (*LocalBackup) Generate ¶
func (b *LocalBackup) Generate(basePath, ignore string) (*ArchiveDetails, error)
Generates a backup of the selected files and pushes it to the defined location for this instance.
func (*LocalBackup) WithLogContext ¶ added in v1.2.0
func (b *LocalBackup) WithLogContext(c map[string]interface{})
Attaches additional context to the log output for this backup.
type Reader ¶ added in v1.1.0
Reader provides a wrapper around an existing io.Reader but implements io.Closer in order to satisfy an io.ReadCloser.
type Request ¶
type Request struct { Adapter AdapterType `json:"adapter"` Uuid string `json:"uuid"` Ignore string `json:"ignore"` }
func (*Request) NewLocalBackup ¶
func (r *Request) NewLocalBackup() (*LocalBackup, error)
Generates a new local backup struct.
func (*Request) NewS3Backup ¶
Generates a new S3 backup struct.
type S3Backup ¶
type S3Backup struct {
Backup
}
func (*S3Backup) Generate ¶
func (s *S3Backup) Generate(basePath, ignore string) (*ArchiveDetails, error)
Generates a new backup on the disk, moves it into the S3 bucket via the provided presigned URL, and then deletes the backup from the disk.
func (*S3Backup) WithLogContext ¶ added in v1.2.0
Attaches additional context to the log output for this backup.