1
0
mirror of https://github.com/rancher/os.git synced 2025-08-18 14:58:32 +00:00
os/vendor/github.com/docker/distribution/registry/storage/util.go
2015-12-04 20:19:31 +05:00

22 lines
505 B
Go

package storage
import (
"github.com/docker/distribution/context"
"github.com/docker/distribution/registry/storage/driver"
)
// Exists provides a utility method to test whether or not a path exists in
// the given driver.
func exists(ctx context.Context, drv driver.StorageDriver, path string) (bool, error) {
if _, err := drv.Stat(ctx, path); err != nil {
switch err := err.(type) {
case driver.PathNotFoundError:
return false, nil
default:
return false, err
}
}
return true, nil
}