MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / NewProvider

Function NewProvider

src/cmd/linuxkit/cache/provider.go:26–39  ·  view source on GitHub ↗

NewProvider create a new CacheProvider based in the provided directory

(dir string)

Source from the content-addressed store, hash-verified

24
25// NewProvider create a new CacheProvider based in the provided directory
26func NewProvider(dir string) (*Provider, error) {
27 p := &Provider{dir: dir, lockMut: sync.Mutex{}}
28 layout, err := p.Get(dir)
29 if err != nil {
30 return nil, err
31 }
32 store, err := local.NewStore(dir)
33 if err != nil {
34 return nil, err
35 }
36 p.cache = layout
37 p.store = store
38 return p, nil
39}
40
41// Index returns the root image index for the cache.
42// All attempts to read the index *must* use this function, so that it will lock the cache to prevent concurrent access.

Callers 1

ListImagesFunction · 0.85

Calls 1

GetMethod · 0.95

Tested by

no test coverage detected