forked from wal-g/wal-g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tarball_makers.go
40 lines (35 loc) · 866 Bytes
/
tarball_makers.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
package testtools
import (
"bytes"
"github.com/wal-g/wal-g/internal"
)
// FileTarBallMaker creates a new FileTarBall
// with the directory that files should be
// extracted to.
type FileTarBallMaker struct {
number int
size int64
Out string
}
// Make creates a new FileTarBall.
func (tarBallMaker *FileTarBallMaker) Make(inheritState bool) internal.TarBall {
tarBallMaker.number++
return &FileTarBall{
number: tarBallMaker.number,
size: tarBallMaker.size,
out: tarBallMaker.Out,
}
}
type BufferTarBallMaker struct {
number int
size int64
BufferToWrite *bytes.Buffer
}
func (tarBallMaker *BufferTarBallMaker) Make(dedicatedUploader bool) internal.TarBall {
tarBallMaker.number++
return &BufferTarBall{
number: tarBallMaker.number,
size: tarBallMaker.size,
underlying: tarBallMaker.BufferToWrite,
}
}