Add support for ignoring directories/files; fix compression of archives

This commit is contained in:
Dane Everitt
2020-04-18 23:26:23 -07:00
parent 8eaf590f78
commit df6d98bbda
10 changed files with 211 additions and 41 deletions

31
server/backup/included.go Normal file
View File

@@ -0,0 +1,31 @@
package backup
import (
"os"
"sync"
)
type IncludedFiles struct {
sync.RWMutex
files map[string]*os.FileInfo
}
// Pushes an additional file or folder onto the struct.
func (i *IncludedFiles) Push(info *os.FileInfo, p string) {
i.Lock()
defer i.Unlock()
if i.files == nil {
i.files = make(map[string]*os.FileInfo)
}
i.files[p] = info
}
// Returns all of the files that were marked as being included.
func (i *IncludedFiles) All() map[string]*os.FileInfo {
i.RLock()
defer i.RUnlock()
return i.files
}