MCPcopy
hub / github.com/restic/restic / Stat

Method Stat

internal/backend/cache/backend.go:201–211  ·  view source on GitHub ↗

Stat tests whether the backend has a file. If it does not exist but still exists in the cache, it is removed from the cache.

(ctx context.Context, h backend.Handle)

Source from the content-addressed store, hash-verified

199// Stat tests whether the backend has a file. If it does not exist but still
200// exists in the cache, it is removed from the cache.
201func (b *Backend) Stat(ctx context.Context, h backend.Handle) (backend.FileInfo, error) {
202 debug.Log("cache Stat(%v)", h)
203
204 fi, err := b.Backend.Stat(ctx, h)
205 if err != nil && b.Backend.IsNotExist(err) {
206 // try to remove from the cache, ignore errors
207 _, _ = b.Cache.remove(h)
208 }
209
210 return fi, err
211}
212
213// IsNotExist returns true if the error is caused by a non-existing file.
214func (b *Backend) IsNotExist(err error) bool {

Callers

nothing calls this directly

Implementers 11

Backendinternal/backend/azure/azure.go
b2Backendinternal/backend/b2/b2.go
Backendinternal/backend/s3/s3.go
MemoryBackendinternal/backend/mem/mem_backend.go
Backendinternal/backend/dryrun/dry_backend.go
Localinternal/backend/local/local.go
Backendinternal/backend/gs/gs.go
Backendinternal/backend/mock/backend.go
Backendinternal/backend/rest/rest.go
beSwiftinternal/backend/swift/swift.go
SFTPinternal/backend/sftp/sftp.go

Calls 4

LogFunction · 0.92
removeMethod · 0.80
StatMethod · 0.65
IsNotExistMethod · 0.65

Tested by

no test coverage detected