/
backup_common.go
42 lines (34 loc) · 1.06 KB
/
backup_common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package backup
import (
"time"
"github.com/lxc/lxd/lxd/state"
)
// WorkingDirPrefix is used when temporary working directories are needed.
const WorkingDirPrefix = "lxd_backup"
// CommonBackup represents a common backup.
type CommonBackup struct {
state *state.State
id int
name string
creationDate time.Time
expiryDate time.Time
optimizedStorage bool
compressionAlgorithm string
}
// Name returns the name of the backup.
func (b *CommonBackup) Name() string {
return b.name
}
// CompressionAlgorithm returns the compression used for the tarball.
func (b *CommonBackup) CompressionAlgorithm() string {
return b.compressionAlgorithm
}
// SetCompressionAlgorithm sets the tarball compression.
func (b *CommonBackup) SetCompressionAlgorithm(compression string) {
b.compressionAlgorithm = compression
}
// OptimizedStorage returns whether the backup is to be performed using
// optimization supported by the storage driver.
func (b *CommonBackup) OptimizedStorage() bool {
return b.optimizedStorage
}