mirror of
https://github.com/restic/restic.git
synced 2025-08-26 09:28:01 +00:00
archiver: move helper functions to combine rejects
This commit is contained in:
@@ -24,6 +24,28 @@ type RejectByNameFunc func(path string) bool
|
||||
// should be excluded (rejected) from the backup.
|
||||
type RejectFunc func(path string, fi os.FileInfo, fs fs.FS) bool
|
||||
|
||||
func CombineRejectByNames(funcs []RejectByNameFunc) SelectByNameFunc {
|
||||
return func(item string) bool {
|
||||
for _, reject := range funcs {
|
||||
if reject(item) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func CombineRejects(funcs []RejectFunc) SelectFunc {
|
||||
return func(item string, fi os.FileInfo, fs fs.FS) bool {
|
||||
for _, reject := range funcs {
|
||||
if reject(item, fi, fs) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
type rejectionCache struct {
|
||||
m map[string]bool
|
||||
mtx sync.Mutex
|
||||
|
Reference in New Issue
Block a user