MCPcopy
hub / github.com/containerd/containerd / HostDirFromRoot

Function HostDirFromRoot

core/remotes/docker/config/hosts.go:293–304  ·  view source on GitHub ↗

HostDirFromRoot returns a function which finds a host directory based at the given root.

(root string)

Source from the content-addressed store, hash-verified

291// HostDirFromRoot returns a function which finds a host directory
292// based at the given root.
293func HostDirFromRoot(root string) func(string) (string, error) {
294 return func(host string) (string, error) {
295 for _, p := range hostPaths(root, host) {
296 if _, err := os.Stat(p); err == nil {
297 return p, nil
298 } else if !os.IsNotExist(err) {
299 return "", err
300 }
301 }
302 return "", errdefs.ErrNotFound
303 }
304}
305
306// hostDirectory converts ":port" to "_port_" in directory names
307func hostDirectory(host string) string {

Callers 4

NewOCIRegistryFunction · 0.92
UnmarshalAnyMethod · 0.92
GetResolverFunction · 0.92
testResolverWithHostsDirFunction · 0.85

Calls 2

hostPathsFunction · 0.70
StatMethod · 0.65

Tested by 1

testResolverWithHostsDirFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…