MCPcopy
hub / github.com/restic/restic / OlderThan

Function OlderThan

internal/backend/cache/cache.go:207–225  ·  view source on GitHub ↗

OlderThan returns the list of cache directories older than max.

(basedir string, max time.Duration)

Source from the content-addressed store, hash-verified

205
206// OlderThan returns the list of cache directories older than max.
207func OlderThan(basedir string, max time.Duration) ([]os.FileInfo, error) {
208 entries, err := listCacheDirs(basedir)
209 if err != nil {
210 return nil, err
211 }
212
213 var oldCacheDirs []os.FileInfo
214 for _, fi := range entries {
215 if !IsOld(fi.ModTime(), max) {
216 continue
217 }
218
219 oldCacheDirs = append(oldCacheDirs, fi)
220 }
221
222 debug.Log("%d old cache dirs found", len(oldCacheDirs))
223
224 return oldCacheDirs, nil
225}
226
227// Old returns a list of cache directories with a modification time of more
228// than 30 days ago.

Callers 2

runCacheFunction · 0.92
OldFunction · 0.85

Calls 4

LogFunction · 0.92
listCacheDirsFunction · 0.85
IsOldFunction · 0.85
ModTimeMethod · 0.45

Tested by

no test coverage detected