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

Method Index

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

Index returns the root image index for the cache. All attempts to read the index *must* use this function, so that it will lock the cache to prevent concurrent access. The underlying library writes modifications directly to the index, so not only must ensure that that only one process is writing at

()

Source from the content-addressed store, hash-verified

44// so not only must ensure that that only one process is writing at a time, but that no one is reading
45// while we are writing, to avoid corruption.
46func (p *Provider) Index() (v1.ImageIndex, error) {
47 if p.Lock() != nil {
48 return nil, fmt.Errorf("unable to lock cache %s", p.dir)
49 }
50 defer p.Unlock()
51 return p.cache.ImageIndex()
52}
53
54// Lock locks the cache directory to prevent concurrent access
55func (p *Provider) Lock() error {

Callers 4

FindRootMethod · 0.95
FindDescriptorMethod · 0.95
ListMethod · 0.95
IndexWriteMethod · 0.95

Implementers 11

ProviderCDROMpkg/metadata/provider_cdrom.go
ProviderGCPpkg/metadata/provider_gcp.go
ProviderVMwarepkg/metadata/provider_vmware_unsupport
ProviderEquinixMetalpkg/metadata/provider_equinixmetal.go
ProviderVultrpkg/metadata/provider_vultr.go
ProviderDigitalOceanpkg/metadata/provider_digitalocean.go
ProviderHetznerpkg/metadata/provider_hetzner.go
ProviderMetaldatapkg/metadata/provider_metaldata.go
ProviderOpenstackpkg/metadata/provider_openstack.go
ProviderScalewaypkg/metadata/provider_scaleway.go
ProviderAWSpkg/metadata/provider_aws.go

Calls 3

LockMethod · 0.95
UnlockMethod · 0.95
ImageIndexMethod · 0.65

Tested by

no test coverage detected