forked from wal-g/wal-g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.go
38 lines (35 loc) · 945 Bytes
/
make.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
package walg
// TarBallMaker is used to allow for
// flexible creation of different TarBalls.
type TarBallMaker interface {
Make(dedicatedUploader bool) TarBall
}
// S3TarBallMaker creates tarballs that are uploaded to S3.
type S3TarBallMaker struct {
number int
BaseDir string
Trim string
BkupName string
Tu *TarUploader
Lsn *uint64
IncrementFromLsn *uint64
IncrementFrom string
}
// Make returns a tarball with required S3 fields.
func (s *S3TarBallMaker) Make(dedicatedUploader bool) TarBall {
s.number++
uploader := s.Tu
if dedicatedUploader {
uploader = uploader.Clone()
}
return &S3TarBall{
number: s.number,
baseDir: s.BaseDir,
trim: s.Trim,
bkupName: s.BkupName,
tu: uploader,
Lsn: s.Lsn,
IncrementFromLsn: s.IncrementFromLsn,
IncrementFrom: s.IncrementFrom,
}
}