@@ -8,6 +8,7 @@ package model
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/db"
|
||||
@@ -121,3 +122,36 @@ func createTmpDir() string {
|
||||
}
|
||||
return tmpDir
|
||||
}
|
||||
|
||||
type alwaysChangedKey struct {
|
||||
fs fs.Filesystem
|
||||
name string
|
||||
}
|
||||
|
||||
// alwaysChanges is an ignore.ChangeDetector that always returns true on Changed()
|
||||
type alwaysChanged struct {
|
||||
seen map[alwaysChangedKey]struct{}
|
||||
}
|
||||
|
||||
func newAlwaysChanged() *alwaysChanged {
|
||||
return &alwaysChanged{
|
||||
seen: make(map[alwaysChangedKey]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Remember(fs fs.Filesystem, name string, _ time.Time) {
|
||||
c.seen[alwaysChangedKey{fs, name}] = struct{}{}
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Reset() {
|
||||
c.seen = make(map[alwaysChangedKey]struct{})
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Seen(fs fs.Filesystem, name string) bool {
|
||||
_, ok := c.seen[alwaysChangedKey{fs, name}]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (c *alwaysChanged) Changed() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user