forked from wal-g/wal-g
/
tar_file_sets.go
42 lines (31 loc) · 1008 Bytes
/
tar_file_sets.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 internal
type TarFileSets interface {
AddFile(name string, file string)
AddFiles(name string, files []string)
Get() map[string][]string
}
type RegularTarFileSets map[string][]string
func NewRegularTarFileSets() *RegularTarFileSets {
return &RegularTarFileSets{}
}
func (tarFileSets *RegularTarFileSets) AddFile(name string, file string) {
(*tarFileSets)[name] = append((*tarFileSets)[name], file)
}
func (tarFileSets *RegularTarFileSets) AddFiles(name string, files []string) {
(*tarFileSets)[name] = append((*tarFileSets)[name], files...)
}
func (tarFileSets *RegularTarFileSets) Get() map[string][]string {
return *tarFileSets
}
type NopTarFileSets struct {
}
func NewNopTarFileSets() *NopTarFileSets {
return &NopTarFileSets{}
}
func (tarFileSets *NopTarFileSets) AddFile(name string, file string) {
}
func (tarFileSets *NopTarFileSets) AddFiles(name string, files []string) {
}
func (tarFileSets *NopTarFileSets) Get() map[string][]string {
return make(map[string][]string)
}