2020-04-19 06:26:23 +00:00
|
|
|
package backup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
type IncludedFiles struct {
|
|
|
|
sync.RWMutex
|
2020-08-25 03:45:54 +00:00
|
|
|
files []string
|
2020-04-19 06:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Pushes an additional file or folder onto the struct.
|
2020-08-25 03:45:54 +00:00
|
|
|
func (i *IncludedFiles) Push(p string) {
|
2020-04-19 06:26:23 +00:00
|
|
|
i.Lock()
|
2020-08-25 03:45:54 +00:00
|
|
|
i.files = append(i.files, p) // ~~
|
|
|
|
i.Unlock()
|
2020-04-19 06:26:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns all of the files that were marked as being included.
|
2020-08-25 03:45:54 +00:00
|
|
|
func (i *IncludedFiles) All() []string {
|
2020-04-19 06:26:23 +00:00
|
|
|
i.RLock()
|
|
|
|
defer i.RUnlock()
|
|
|
|
|
|
|
|
return i.files
|
|
|
|
}
|