lib/ignore: Refactor out result type (#9343)
This commit is contained in:
+8
-4
@@ -6,7 +6,11 @@
|
||||
|
||||
package ignore
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/ignore/ignoreresult"
|
||||
)
|
||||
|
||||
type nower interface {
|
||||
Now() time.Time
|
||||
@@ -20,7 +24,7 @@ type cache struct {
|
||||
}
|
||||
|
||||
type cacheEntry struct {
|
||||
result Result
|
||||
result ignoreresult.R
|
||||
access int64 // Unix nanosecond count. Sufficient until the year 2262.
|
||||
}
|
||||
|
||||
@@ -39,7 +43,7 @@ func (c *cache) clean(d time.Duration) {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cache) get(key string) (Result, bool) {
|
||||
func (c *cache) get(key string) (ignoreresult.R, bool) {
|
||||
entry, ok := c.entries[key]
|
||||
if ok {
|
||||
entry.access = clock.Now().UnixNano()
|
||||
@@ -48,7 +52,7 @@ func (c *cache) get(key string) (Result, bool) {
|
||||
return entry.result, ok
|
||||
}
|
||||
|
||||
func (c *cache) set(key string, result Result) {
|
||||
func (c *cache) set(key string, result ignoreresult.R) {
|
||||
c.entries[key] = cacheEntry{result, time.Now().UnixNano()}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user