repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
containers/image
copy/copy.go
compressGoroutine
func compressGoroutine(dest *io.PipeWriter, src io.Reader) { err := errors.New("Internal error: unexpected panic in compressGoroutine") defer func() { // Note that this is not the same as {defer dest.CloseWithError(err)}; we need err to be evaluated lazily. dest.CloseWithError(err) // CloseWithError(nil) is equival...
go
func compressGoroutine(dest *io.PipeWriter, src io.Reader) { err := errors.New("Internal error: unexpected panic in compressGoroutine") defer func() { // Note that this is not the same as {defer dest.CloseWithError(err)}; we need err to be evaluated lazily. dest.CloseWithError(err) // CloseWithError(nil) is equival...
[ "func", "compressGoroutine", "(", "dest", "*", "io", ".", "PipeWriter", ",", "src", "io", ".", "Reader", ")", "{", "err", ":=", "errors", ".", "New", "(", "\"Internal error: unexpected panic in compressGoroutine\"", ")", "\n", "defer", "func", "(", ")", "{", ...
// compressGoroutine reads all input from src and writes its compressed equivalent to dest.
[ "compressGoroutine", "reads", "all", "input", "from", "src", "and", "writes", "its", "compressed", "equivalent", "to", "dest", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/copy/copy.go#L893-L903
test
containers/image
docker/daemon/client.go
newDockerClient
func newDockerClient(sys *types.SystemContext) (*dockerclient.Client, error) { host := dockerclient.DefaultDockerHost if sys != nil && sys.DockerDaemonHost != "" { host = sys.DockerDaemonHost } // Sadly, unix:// sockets don't work transparently with dockerclient.NewClient. // They work fine with a nil httpClien...
go
func newDockerClient(sys *types.SystemContext) (*dockerclient.Client, error) { host := dockerclient.DefaultDockerHost if sys != nil && sys.DockerDaemonHost != "" { host = sys.DockerDaemonHost } // Sadly, unix:// sockets don't work transparently with dockerclient.NewClient. // They work fine with a nil httpClien...
[ "func", "newDockerClient", "(", "sys", "*", "types", ".", "SystemContext", ")", "(", "*", "dockerclient", ".", "Client", ",", "error", ")", "{", "host", ":=", "dockerclient", ".", "DefaultDockerHost", "\n", "if", "sys", "!=", "nil", "&&", "sys", ".", "Do...
// NewDockerClient initializes a new API client based on the passed SystemContext.
[ "NewDockerClient", "initializes", "a", "new", "API", "client", "based", "on", "the", "passed", "SystemContext", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/daemon/client.go#L18-L51
test
containers/image
signature/policy_config.go
defaultPolicyPath
func defaultPolicyPath(sys *types.SystemContext) string { if sys != nil { if sys.SignaturePolicyPath != "" { return sys.SignaturePolicyPath } if sys.RootForImplicitAbsolutePaths != "" { return filepath.Join(sys.RootForImplicitAbsolutePaths, systemDefaultPolicyPath) } } return systemDefaultPolicyPath }
go
func defaultPolicyPath(sys *types.SystemContext) string { if sys != nil { if sys.SignaturePolicyPath != "" { return sys.SignaturePolicyPath } if sys.RootForImplicitAbsolutePaths != "" { return filepath.Join(sys.RootForImplicitAbsolutePaths, systemDefaultPolicyPath) } } return systemDefaultPolicyPath }
[ "func", "defaultPolicyPath", "(", "sys", "*", "types", ".", "SystemContext", ")", "string", "{", "if", "sys", "!=", "nil", "{", "if", "sys", ".", "SignaturePolicyPath", "!=", "\"\"", "{", "return", "sys", ".", "SignaturePolicyPath", "\n", "}", "\n", "if", ...
// defaultPolicyPath returns a path to the default policy of the system.
[ "defaultPolicyPath", "returns", "a", "path", "to", "the", "default", "policy", "of", "the", "system", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L55-L65
test
containers/image
signature/policy_config.go
NewPolicyFromFile
func NewPolicyFromFile(fileName string) (*Policy, error) { contents, err := ioutil.ReadFile(fileName) if err != nil { return nil, err } policy, err := NewPolicyFromBytes(contents) if err != nil { return nil, errors.Wrapf(err, "invalid policy in %q", fileName) } return policy, nil }
go
func NewPolicyFromFile(fileName string) (*Policy, error) { contents, err := ioutil.ReadFile(fileName) if err != nil { return nil, err } policy, err := NewPolicyFromBytes(contents) if err != nil { return nil, errors.Wrapf(err, "invalid policy in %q", fileName) } return policy, nil }
[ "func", "NewPolicyFromFile", "(", "fileName", "string", ")", "(", "*", "Policy", ",", "error", ")", "{", "contents", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "fileName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// NewPolicyFromFile returns a policy configured in the specified file.
[ "NewPolicyFromFile", "returns", "a", "policy", "configured", "in", "the", "specified", "file", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L68-L78
test
containers/image
signature/policy_config.go
NewPolicyFromBytes
func NewPolicyFromBytes(data []byte) (*Policy, error) { p := Policy{} if err := json.Unmarshal(data, &p); err != nil { return nil, InvalidPolicyFormatError(err.Error()) } return &p, nil }
go
func NewPolicyFromBytes(data []byte) (*Policy, error) { p := Policy{} if err := json.Unmarshal(data, &p); err != nil { return nil, InvalidPolicyFormatError(err.Error()) } return &p, nil }
[ "func", "NewPolicyFromBytes", "(", "data", "[", "]", "byte", ")", "(", "*", "Policy", ",", "error", ")", "{", "p", ":=", "Policy", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "p", ")", ";", "err", "!=", "...
// NewPolicyFromBytes returns a policy parsed from the specified blob. // Use this function instead of calling json.Unmarshal directly.
[ "NewPolicyFromBytes", "returns", "a", "policy", "parsed", "from", "the", "specified", "blob", ".", "Use", "this", "function", "instead", "of", "calling", "json", ".", "Unmarshal", "directly", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L82-L88
test
containers/image
signature/policy_config.go
newPolicyRequirementFromJSON
func newPolicyRequirementFromJSON(data []byte) (PolicyRequirement, error) { var typeField prCommon if err := json.Unmarshal(data, &typeField); err != nil { return nil, err } var res PolicyRequirement switch typeField.Type { case prTypeInsecureAcceptAnything: res = &prInsecureAcceptAnything{} case prTypeRejec...
go
func newPolicyRequirementFromJSON(data []byte) (PolicyRequirement, error) { var typeField prCommon if err := json.Unmarshal(data, &typeField); err != nil { return nil, err } var res PolicyRequirement switch typeField.Type { case prTypeInsecureAcceptAnything: res = &prInsecureAcceptAnything{} case prTypeRejec...
[ "func", "newPolicyRequirementFromJSON", "(", "data", "[", "]", "byte", ")", "(", "PolicyRequirement", ",", "error", ")", "{", "var", "typeField", "prCommon", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "typeField", ")", ";", ...
// newPolicyRequirementFromJSON parses JSON data into a PolicyRequirement implementation.
[ "newPolicyRequirementFromJSON", "parses", "JSON", "data", "into", "a", "PolicyRequirement", "implementation", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L221-L243
test
containers/image
signature/policy_config.go
newPRSignedBy
func newPRSignedBy(keyType sbKeyType, keyPath string, keyData []byte, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { if !keyType.IsValid() { return nil, InvalidPolicyFormatError(fmt.Sprintf("invalid keyType \"%s\"", keyType)) } if len(keyPath) > 0 && len(keyData) > 0 { return nil, InvalidPolicyForma...
go
func newPRSignedBy(keyType sbKeyType, keyPath string, keyData []byte, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { if !keyType.IsValid() { return nil, InvalidPolicyFormatError(fmt.Sprintf("invalid keyType \"%s\"", keyType)) } if len(keyPath) > 0 && len(keyData) > 0 { return nil, InvalidPolicyForma...
[ "func", "newPRSignedBy", "(", "keyType", "sbKeyType", ",", "keyPath", "string", ",", "keyData", "[", "]", "byte", ",", "signedIdentity", "PolicyReferenceMatch", ")", "(", "*", "prSignedBy", ",", "error", ")", "{", "if", "!", "keyType", ".", "IsValid", "(", ...
// newPRSignedBy returns a new prSignedBy if parameters are valid.
[ "newPRSignedBy", "returns", "a", "new", "prSignedBy", "if", "parameters", "are", "valid", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L306-L323
test
containers/image
signature/policy_config.go
newPRSignedByKeyPath
func newPRSignedByKeyPath(keyType sbKeyType, keyPath string, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { return newPRSignedBy(keyType, keyPath, nil, signedIdentity) }
go
func newPRSignedByKeyPath(keyType sbKeyType, keyPath string, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { return newPRSignedBy(keyType, keyPath, nil, signedIdentity) }
[ "func", "newPRSignedByKeyPath", "(", "keyType", "sbKeyType", ",", "keyPath", "string", ",", "signedIdentity", "PolicyReferenceMatch", ")", "(", "*", "prSignedBy", ",", "error", ")", "{", "return", "newPRSignedBy", "(", "keyType", ",", "keyPath", ",", "nil", ",",...
// newPRSignedByKeyPath is NewPRSignedByKeyPath, except it returns the private type.
[ "newPRSignedByKeyPath", "is", "NewPRSignedByKeyPath", "except", "it", "returns", "the", "private", "type", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L326-L328
test
containers/image
signature/policy_config.go
NewPRSignedByKeyPath
func NewPRSignedByKeyPath(keyType sbKeyType, keyPath string, signedIdentity PolicyReferenceMatch) (PolicyRequirement, error) { return newPRSignedByKeyPath(keyType, keyPath, signedIdentity) }
go
func NewPRSignedByKeyPath(keyType sbKeyType, keyPath string, signedIdentity PolicyReferenceMatch) (PolicyRequirement, error) { return newPRSignedByKeyPath(keyType, keyPath, signedIdentity) }
[ "func", "NewPRSignedByKeyPath", "(", "keyType", "sbKeyType", ",", "keyPath", "string", ",", "signedIdentity", "PolicyReferenceMatch", ")", "(", "PolicyRequirement", ",", "error", ")", "{", "return", "newPRSignedByKeyPath", "(", "keyType", ",", "keyPath", ",", "signe...
// NewPRSignedByKeyPath returns a new "signedBy" PolicyRequirement using a KeyPath
[ "NewPRSignedByKeyPath", "returns", "a", "new", "signedBy", "PolicyRequirement", "using", "a", "KeyPath" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L331-L333
test
containers/image
signature/policy_config.go
newPRSignedByKeyData
func newPRSignedByKeyData(keyType sbKeyType, keyData []byte, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { return newPRSignedBy(keyType, "", keyData, signedIdentity) }
go
func newPRSignedByKeyData(keyType sbKeyType, keyData []byte, signedIdentity PolicyReferenceMatch) (*prSignedBy, error) { return newPRSignedBy(keyType, "", keyData, signedIdentity) }
[ "func", "newPRSignedByKeyData", "(", "keyType", "sbKeyType", ",", "keyData", "[", "]", "byte", ",", "signedIdentity", "PolicyReferenceMatch", ")", "(", "*", "prSignedBy", ",", "error", ")", "{", "return", "newPRSignedBy", "(", "keyType", ",", "\"\"", ",", "key...
// newPRSignedByKeyData is NewPRSignedByKeyData, except it returns the private type.
[ "newPRSignedByKeyData", "is", "NewPRSignedByKeyData", "except", "it", "returns", "the", "private", "type", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L336-L338
test
containers/image
signature/policy_config.go
NewPRSignedByKeyData
func NewPRSignedByKeyData(keyType sbKeyType, keyData []byte, signedIdentity PolicyReferenceMatch) (PolicyRequirement, error) { return newPRSignedByKeyData(keyType, keyData, signedIdentity) }
go
func NewPRSignedByKeyData(keyType sbKeyType, keyData []byte, signedIdentity PolicyReferenceMatch) (PolicyRequirement, error) { return newPRSignedByKeyData(keyType, keyData, signedIdentity) }
[ "func", "NewPRSignedByKeyData", "(", "keyType", "sbKeyType", ",", "keyData", "[", "]", "byte", ",", "signedIdentity", "PolicyReferenceMatch", ")", "(", "PolicyRequirement", ",", "error", ")", "{", "return", "newPRSignedByKeyData", "(", "keyType", ",", "keyData", "...
// NewPRSignedByKeyData returns a new "signedBy" PolicyRequirement using a KeyData
[ "NewPRSignedByKeyData", "returns", "a", "new", "signedBy", "PolicyRequirement", "using", "a", "KeyData" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L341-L343
test
containers/image
signature/policy_config.go
IsValid
func (kt sbKeyType) IsValid() bool { switch kt { case SBKeyTypeGPGKeys, SBKeyTypeSignedByGPGKeys, SBKeyTypeX509Certificates, SBKeyTypeSignedByX509CAs: return true default: return false } }
go
func (kt sbKeyType) IsValid() bool { switch kt { case SBKeyTypeGPGKeys, SBKeyTypeSignedByGPGKeys, SBKeyTypeX509Certificates, SBKeyTypeSignedByX509CAs: return true default: return false } }
[ "func", "(", "kt", "sbKeyType", ")", "IsValid", "(", ")", "bool", "{", "switch", "kt", "{", "case", "SBKeyTypeGPGKeys", ",", "SBKeyTypeSignedByGPGKeys", ",", "SBKeyTypeX509Certificates", ",", "SBKeyTypeSignedByX509CAs", ":", "return", "true", "\n", "default", ":",...
// IsValid returns true iff kt is a recognized value
[ "IsValid", "returns", "true", "iff", "kt", "is", "a", "recognized", "value" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L411-L419
test
containers/image
signature/policy_config.go
newPRSignedBaseLayer
func newPRSignedBaseLayer(baseLayerIdentity PolicyReferenceMatch) (*prSignedBaseLayer, error) { if baseLayerIdentity == nil { return nil, InvalidPolicyFormatError("baseLayerIdentity not specified") } return &prSignedBaseLayer{ prCommon: prCommon{Type: prTypeSignedBaseLayer}, BaseLayerIdentity: baseLay...
go
func newPRSignedBaseLayer(baseLayerIdentity PolicyReferenceMatch) (*prSignedBaseLayer, error) { if baseLayerIdentity == nil { return nil, InvalidPolicyFormatError("baseLayerIdentity not specified") } return &prSignedBaseLayer{ prCommon: prCommon{Type: prTypeSignedBaseLayer}, BaseLayerIdentity: baseLay...
[ "func", "newPRSignedBaseLayer", "(", "baseLayerIdentity", "PolicyReferenceMatch", ")", "(", "*", "prSignedBaseLayer", ",", "error", ")", "{", "if", "baseLayerIdentity", "==", "nil", "{", "return", "nil", ",", "InvalidPolicyFormatError", "(", "\"baseLayerIdentity not spe...
// newPRSignedBaseLayer is NewPRSignedBaseLayer, except it returns the private type.
[ "newPRSignedBaseLayer", "is", "NewPRSignedBaseLayer", "except", "it", "returns", "the", "private", "type", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L439-L447
test
containers/image
signature/policy_config.go
newPolicyReferenceMatchFromJSON
func newPolicyReferenceMatchFromJSON(data []byte) (PolicyReferenceMatch, error) { var typeField prmCommon if err := json.Unmarshal(data, &typeField); err != nil { return nil, err } var res PolicyReferenceMatch switch typeField.Type { case prmTypeMatchExact: res = &prmMatchExact{} case prmTypeMatchRepoDigestO...
go
func newPolicyReferenceMatchFromJSON(data []byte) (PolicyReferenceMatch, error) { var typeField prmCommon if err := json.Unmarshal(data, &typeField); err != nil { return nil, err } var res PolicyReferenceMatch switch typeField.Type { case prmTypeMatchExact: res = &prmMatchExact{} case prmTypeMatchRepoDigestO...
[ "func", "newPolicyReferenceMatchFromJSON", "(", "data", "[", "]", "byte", ")", "(", "PolicyReferenceMatch", ",", "error", ")", "{", "var", "typeField", "prmCommon", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "typeField", ")", ...
// newPolicyReferenceMatchFromJSON parses JSON data into a PolicyReferenceMatch implementation.
[ "newPolicyReferenceMatchFromJSON", "parses", "JSON", "data", "into", "a", "PolicyReferenceMatch", "implementation", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L486-L510
test
containers/image
signature/policy_config.go
newPRMExactReference
func newPRMExactReference(dockerReference string) (*prmExactReference, error) { ref, err := reference.ParseNormalizedNamed(dockerReference) if err != nil { return nil, InvalidPolicyFormatError(fmt.Sprintf("Invalid format of dockerReference %s: %s", dockerReference, err.Error())) } if reference.IsNameOnly(ref) { ...
go
func newPRMExactReference(dockerReference string) (*prmExactReference, error) { ref, err := reference.ParseNormalizedNamed(dockerReference) if err != nil { return nil, InvalidPolicyFormatError(fmt.Sprintf("Invalid format of dockerReference %s: %s", dockerReference, err.Error())) } if reference.IsNameOnly(ref) { ...
[ "func", "newPRMExactReference", "(", "dockerReference", "string", ")", "(", "*", "prmExactReference", ",", "error", ")", "{", "ref", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "dockerReference", ")", "\n", "if", "err", "!=", "nil", "{", ...
// newPRMExactReference is NewPRMExactReference, except it resturns the private type.
[ "newPRMExactReference", "is", "NewPRMExactReference", "except", "it", "resturns", "the", "private", "type", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L603-L615
test
containers/image
signature/policy_config.go
newPRMExactRepository
func newPRMExactRepository(dockerRepository string) (*prmExactRepository, error) { if _, err := reference.ParseNormalizedNamed(dockerRepository); err != nil { return nil, InvalidPolicyFormatError(fmt.Sprintf("Invalid format of dockerRepository %s: %s", dockerRepository, err.Error())) } return &prmExactRepository{ ...
go
func newPRMExactRepository(dockerRepository string) (*prmExactRepository, error) { if _, err := reference.ParseNormalizedNamed(dockerRepository); err != nil { return nil, InvalidPolicyFormatError(fmt.Sprintf("Invalid format of dockerRepository %s: %s", dockerRepository, err.Error())) } return &prmExactRepository{ ...
[ "func", "newPRMExactRepository", "(", "dockerRepository", "string", ")", "(", "*", "prmExactRepository", ",", "error", ")", "{", "if", "_", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "dockerRepository", ")", ";", "err", "!=", "nil", "{", ...
// newPRMExactRepository is NewPRMExactRepository, except it resturns the private type.
[ "newPRMExactRepository", "is", "NewPRMExactRepository", "except", "it", "resturns", "the", "private", "type", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_config.go#L649-L657
test
containers/image
storage/storage_image.go
newImageSource
func newImageSource(imageRef storageReference) (*storageImageSource, error) { // First, locate the image. img, err := imageRef.resolveImage() if err != nil { return nil, err } // Build the reader object. image := &storageImageSource{ imageRef: imageRef, image: img, layerPosition: make(map...
go
func newImageSource(imageRef storageReference) (*storageImageSource, error) { // First, locate the image. img, err := imageRef.resolveImage() if err != nil { return nil, err } // Build the reader object. image := &storageImageSource{ imageRef: imageRef, image: img, layerPosition: make(map...
[ "func", "newImageSource", "(", "imageRef", "storageReference", ")", "(", "*", "storageImageSource", ",", "error", ")", "{", "img", ",", "err", ":=", "imageRef", ".", "resolveImage", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "er...
// newImageSource sets up an image for reading.
[ "newImageSource", "sets", "up", "an", "image", "for", "reading", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L82-L102
test
containers/image
storage/storage_image.go
getBlobAndLayerID
func (s *storageImageSource) getBlobAndLayerID(info types.BlobInfo) (rc io.ReadCloser, n int64, layerID string, err error) { var layer storage.Layer var diffOptions *storage.DiffOptions // We need a valid digest value. err = info.Digest.Validate() if err != nil { return nil, -1, "", err } // Check if the blob ...
go
func (s *storageImageSource) getBlobAndLayerID(info types.BlobInfo) (rc io.ReadCloser, n int64, layerID string, err error) { var layer storage.Layer var diffOptions *storage.DiffOptions // We need a valid digest value. err = info.Digest.Validate() if err != nil { return nil, -1, "", err } // Check if the blob ...
[ "func", "(", "s", "*", "storageImageSource", ")", "getBlobAndLayerID", "(", "info", "types", ".", "BlobInfo", ")", "(", "rc", "io", ".", "ReadCloser", ",", "n", "int64", ",", "layerID", "string", ",", "err", "error", ")", "{", "var", "layer", "storage", ...
// getBlobAndLayer reads the data blob or filesystem layer which matches the digest and size, if given.
[ "getBlobAndLayer", "reads", "the", "data", "blob", "or", "filesystem", "layer", "which", "matches", "the", "digest", "and", "size", "if", "given", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L131-L180
test
containers/image
storage/storage_image.go
computeID
func (s *storageImageDestination) computeID(m manifest.Manifest) string { // Build the diffID list. We need the decompressed sums that we've been calculating to // fill in the DiffIDs. It's expected (but not enforced by us) that the number of // diffIDs corresponds to the number of non-EmptyLayer entries in the hi...
go
func (s *storageImageDestination) computeID(m manifest.Manifest) string { // Build the diffID list. We need the decompressed sums that we've been calculating to // fill in the DiffIDs. It's expected (but not enforced by us) that the number of // diffIDs corresponds to the number of non-EmptyLayer entries in the hi...
[ "func", "(", "s", "*", "storageImageDestination", ")", "computeID", "(", "m", "manifest", ".", "Manifest", ")", "string", "{", "var", "diffIDs", "[", "]", "digest", ".", "Digest", "\n", "switch", "m", ":=", "m", ".", "(", "type", ")", "{", "case", "*...
// computeID computes a recommended image ID based on information we have so far. If // the manifest is not of a type that we recognize, we return an empty value, indicating // that since we don't have a recommendation, a random ID should be used if one needs // to be allocated.
[ "computeID", "computes", "a", "recommended", "image", "ID", "based", "on", "information", "we", "have", "so", "far", ".", "If", "the", "manifest", "is", "not", "of", "a", "type", "that", "we", "recognize", "we", "return", "an", "empty", "value", "indicatin...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L520-L552
test
containers/image
storage/storage_image.go
PutManifest
func (s *storageImageDestination) PutManifest(ctx context.Context, manifestBlob []byte) error { if s.imageRef.named != nil { if digested, ok := s.imageRef.named.(reference.Digested); ok { matches, err := manifest.MatchesDigest(manifestBlob, digested.Digest()) if err != nil { return err } if !matches ...
go
func (s *storageImageDestination) PutManifest(ctx context.Context, manifestBlob []byte) error { if s.imageRef.named != nil { if digested, ok := s.imageRef.named.(reference.Digested); ok { matches, err := manifest.MatchesDigest(manifestBlob, digested.Digest()) if err != nil { return err } if !matches ...
[ "func", "(", "s", "*", "storageImageDestination", ")", "PutManifest", "(", "ctx", "context", ".", "Context", ",", "manifestBlob", "[", "]", "byte", ")", "error", "{", "if", "s", ".", "imageRef", ".", "named", "!=", "nil", "{", "if", "digested", ",", "o...
// PutManifest writes the manifest to the destination.
[ "PutManifest", "writes", "the", "manifest", "to", "the", "destination", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L826-L842
test
containers/image
storage/storage_image.go
PutSignatures
func (s *storageImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error { sizes := []int{} sigblob := []byte{} for _, sig := range signatures { sizes = append(sizes, len(sig)) newblob := make([]byte, len(sigblob)+len(sig)) copy(newblob, sigblob) copy(newblob[len(sigblob):], sig) sig...
go
func (s *storageImageDestination) PutSignatures(ctx context.Context, signatures [][]byte) error { sizes := []int{} sigblob := []byte{} for _, sig := range signatures { sizes = append(sizes, len(sig)) newblob := make([]byte, len(sigblob)+len(sig)) copy(newblob, sigblob) copy(newblob[len(sigblob):], sig) sig...
[ "func", "(", "s", "*", "storageImageDestination", ")", "PutSignatures", "(", "ctx", "context", ".", "Context", ",", "signatures", "[", "]", "[", "]", "byte", ")", "error", "{", "sizes", ":=", "[", "]", "int", "{", "}", "\n", "sigblob", ":=", "[", "]"...
// PutSignatures records the image's signatures for committing as a single data blob.
[ "PutSignatures", "records", "the", "image", "s", "signatures", "for", "committing", "as", "a", "single", "data", "blob", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L869-L882
test
containers/image
storage/storage_image.go
newImage
func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) { src, err := newImageSource(s) if err != nil { return nil, err } img, err := image.FromSource(ctx, sys, src) if err != nil { return nil, err } size, err := src.getSize() if err != nil { return nil,...
go
func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) { src, err := newImageSource(s) if err != nil { return nil, err } img, err := image.FromSource(ctx, sys, src) if err != nil { return nil, err } size, err := src.getSize() if err != nil { return nil,...
[ "func", "newImage", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ",", "s", "storageReference", ")", "(", "types", ".", "ImageCloser", ",", "error", ")", "{", "src", ",", "err", ":=", "newImageSource", "(", "s", ...
// newImage creates an image that also knows its size
[ "newImage", "creates", "an", "image", "that", "also", "knows", "its", "size" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_image.go#L935-L949
test
containers/image
oci/archive/oci_src.go
newImageSource
func newImageSource(ctx context.Context, sys *types.SystemContext, ref ociArchiveReference) (types.ImageSource, error) { tempDirRef, err := createUntarTempDir(ref) if err != nil { return nil, errors.Wrap(err, "error creating temp directory") } unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx, sy...
go
func newImageSource(ctx context.Context, sys *types.SystemContext, ref ociArchiveReference) (types.ImageSource, error) { tempDirRef, err := createUntarTempDir(ref) if err != nil { return nil, errors.Wrap(err, "error creating temp directory") } unpackedSrc, err := tempDirRef.ociRefExtracted.NewImageSource(ctx, sy...
[ "func", "newImageSource", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ",", "ref", "ociArchiveReference", ")", "(", "types", ".", "ImageSource", ",", "error", ")", "{", "tempDirRef", ",", "err", ":=", "createUntarTem...
// newImageSource returns an ImageSource for reading from an existing directory. // newImageSource untars the file and saves it in a temp directory
[ "newImageSource", "returns", "an", "ImageSource", "for", "reading", "from", "an", "existing", "directory", ".", "newImageSource", "untars", "the", "file", "and", "saves", "it", "in", "a", "temp", "directory" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_src.go#L22-L38
test
containers/image
oci/archive/oci_src.go
LoadManifestDescriptor
func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor, error) { ociArchRef, ok := imgRef.(ociArchiveReference) if !ok { return imgspecv1.Descriptor{}, errors.Errorf("error typecasting, need type ociArchiveReference") } tempDirRef, err := createUntarTempDir(ociArchRef) if err != nil { r...
go
func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor, error) { ociArchRef, ok := imgRef.(ociArchiveReference) if !ok { return imgspecv1.Descriptor{}, errors.Errorf("error typecasting, need type ociArchiveReference") } tempDirRef, err := createUntarTempDir(ociArchRef) if err != nil { r...
[ "func", "LoadManifestDescriptor", "(", "imgRef", "types", ".", "ImageReference", ")", "(", "imgspecv1", ".", "Descriptor", ",", "error", ")", "{", "ociArchRef", ",", "ok", ":=", "imgRef", ".", "(", "ociArchiveReference", ")", "\n", "if", "!", "ok", "{", "r...
// LoadManifestDescriptor loads the manifest
[ "LoadManifestDescriptor", "loads", "the", "manifest" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_src.go#L41-L57
test
containers/image
oci/archive/oci_src.go
Close
func (s *ociArchiveImageSource) Close() error { defer s.tempDirRef.deleteTempDir() return s.unpackedSrc.Close() }
go
func (s *ociArchiveImageSource) Close() error { defer s.tempDirRef.deleteTempDir() return s.unpackedSrc.Close() }
[ "func", "(", "s", "*", "ociArchiveImageSource", ")", "Close", "(", ")", "error", "{", "defer", "s", ".", "tempDirRef", ".", "deleteTempDir", "(", ")", "\n", "return", "s", ".", "unpackedSrc", ".", "Close", "(", ")", "\n", "}" ]
// Close removes resources associated with an initialized ImageSource, if any. // Close deletes the temporary directory at dst
[ "Close", "removes", "resources", "associated", "with", "an", "initialized", "ImageSource", "if", "any", ".", "Close", "deletes", "the", "temporary", "directory", "at", "dst" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_src.go#L66-L69
test
containers/image
copy/manifest.go
append
func (os *orderedSet) append(s string) { if _, ok := os.included[s]; !ok { os.list = append(os.list, s) os.included[s] = struct{}{} } }
go
func (os *orderedSet) append(s string) { if _, ok := os.included[s]; !ok { os.list = append(os.list, s) os.included[s] = struct{}{} } }
[ "func", "(", "os", "*", "orderedSet", ")", "append", "(", "s", "string", ")", "{", "if", "_", ",", "ok", ":=", "os", ".", "included", "[", "s", "]", ";", "!", "ok", "{", "os", ".", "list", "=", "append", "(", "os", ".", "list", ",", "s", ")...
// append adds s to the end of os, only if it is not included already.
[ "append", "adds", "s", "to", "the", "end", "of", "os", "only", "if", "it", "is", "not", "included", "already", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/copy/manifest.go#L34-L39
test
containers/image
copy/manifest.go
isMultiImage
func isMultiImage(ctx context.Context, img types.UnparsedImage) (bool, error) { _, mt, err := img.Manifest(ctx) if err != nil { return false, err } return manifest.MIMETypeIsMultiImage(mt), nil }
go
func isMultiImage(ctx context.Context, img types.UnparsedImage) (bool, error) { _, mt, err := img.Manifest(ctx) if err != nil { return false, err } return manifest.MIMETypeIsMultiImage(mt), nil }
[ "func", "isMultiImage", "(", "ctx", "context", ".", "Context", ",", "img", "types", ".", "UnparsedImage", ")", "(", "bool", ",", "error", ")", "{", "_", ",", "mt", ",", "err", ":=", "img", ".", "Manifest", "(", "ctx", ")", "\n", "if", "err", "!=", ...
// isMultiImage returns true if img is a list of images
[ "isMultiImage", "returns", "true", "if", "img", "is", "a", "list", "of", "images" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/copy/manifest.go#L115-L121
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
lockPath
func lockPath(path string) { pl := func() *pathLock { // A scope for defer pathLocksMutex.Lock() defer pathLocksMutex.Unlock() pl, ok := pathLocks[path] if ok { pl.refCount++ } else { pl = &pathLock{refCount: 1, mutex: sync.Mutex{}} pathLocks[path] = pl } return pl }() pl.mutex.Lock() }
go
func lockPath(path string) { pl := func() *pathLock { // A scope for defer pathLocksMutex.Lock() defer pathLocksMutex.Unlock() pl, ok := pathLocks[path] if ok { pl.refCount++ } else { pl = &pathLock{refCount: 1, mutex: sync.Mutex{}} pathLocks[path] = pl } return pl }() pl.mutex.Lock() }
[ "func", "lockPath", "(", "path", "string", ")", "{", "pl", ":=", "func", "(", ")", "*", "pathLock", "{", "pathLocksMutex", ".", "Lock", "(", ")", "\n", "defer", "pathLocksMutex", ".", "Unlock", "(", ")", "\n", "pl", ",", "ok", ":=", "pathLocks", "[",...
// lockPath obtains the pathLock for path. // The caller must call unlockPath eventually.
[ "lockPath", "obtains", "the", "pathLock", "for", "path", ".", "The", "caller", "must", "call", "unlockPath", "eventually", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L54-L68
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
unlockPath
func unlockPath(path string) { pathLocksMutex.Lock() defer pathLocksMutex.Unlock() pl, ok := pathLocks[path] if !ok { // Should this return an error instead? BlobInfoCache ultimately ignores errors… panic(fmt.Sprintf("Internal error: unlocking nonexistent lock for path %s", path)) } pl.mutex.Unlock() pl.refC...
go
func unlockPath(path string) { pathLocksMutex.Lock() defer pathLocksMutex.Unlock() pl, ok := pathLocks[path] if !ok { // Should this return an error instead? BlobInfoCache ultimately ignores errors… panic(fmt.Sprintf("Internal error: unlocking nonexistent lock for path %s", path)) } pl.mutex.Unlock() pl.refC...
[ "func", "unlockPath", "(", "path", "string", ")", "{", "pathLocksMutex", ".", "Lock", "(", ")", "\n", "defer", "pathLocksMutex", ".", "Unlock", "(", ")", "\n", "pl", ",", "ok", ":=", "pathLocks", "[", "path", "]", "\n", "if", "!", "ok", "{", "panic",...
// unlockPath releases the pathLock for path.
[ "unlockPath", "releases", "the", "pathLock", "for", "path", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L71-L84
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
view
func (bdc *cache) view(fn func(tx *bolt.Tx) error) (retErr error) { // bolt.Open(bdc.path, 0600, &bolt.Options{ReadOnly: true}) will, if the file does not exist, // nevertheless create it, but with an O_RDONLY file descriptor, try to initialize it, and fail — while holding // a read lock, blocking any future writes....
go
func (bdc *cache) view(fn func(tx *bolt.Tx) error) (retErr error) { // bolt.Open(bdc.path, 0600, &bolt.Options{ReadOnly: true}) will, if the file does not exist, // nevertheless create it, but with an O_RDONLY file descriptor, try to initialize it, and fail — while holding // a read lock, blocking any future writes....
[ "func", "(", "bdc", "*", "cache", ")", "view", "(", "fn", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", ")", "(", "retErr", "error", ")", "{", "if", "_", ",", "err", ":=", "os", ".", "Lstat", "(", "bdc", ".", "path", ")", ";", "e...
// view returns runs the specified fn within a read-only transaction on the database.
[ "view", "returns", "runs", "the", "specified", "fn", "within", "a", "read", "-", "only", "transaction", "on", "the", "database", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L102-L125
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
update
func (bdc *cache) update(fn func(tx *bolt.Tx) error) (retErr error) { lockPath(bdc.path) defer unlockPath(bdc.path) db, err := bolt.Open(bdc.path, 0600, nil) if err != nil { return err } defer func() { if err := db.Close(); retErr == nil && err != nil { retErr = err } }() return db.Update(fn) }
go
func (bdc *cache) update(fn func(tx *bolt.Tx) error) (retErr error) { lockPath(bdc.path) defer unlockPath(bdc.path) db, err := bolt.Open(bdc.path, 0600, nil) if err != nil { return err } defer func() { if err := db.Close(); retErr == nil && err != nil { retErr = err } }() return db.Update(fn) }
[ "func", "(", "bdc", "*", "cache", ")", "update", "(", "fn", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", ")", "(", "retErr", "error", ")", "{", "lockPath", "(", "bdc", ".", "path", ")", "\n", "defer", "unlockPath", "(", "bdc", ".", ...
// update returns runs the specified fn within a read-write transaction on the database.
[ "update", "returns", "runs", "the", "specified", "fn", "within", "a", "read", "-", "write", "transaction", "on", "the", "database", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L128-L142
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
uncompressedDigest
func (bdc *cache) uncompressedDigest(tx *bolt.Tx, anyDigest digest.Digest) digest.Digest { if b := tx.Bucket(uncompressedDigestBucket); b != nil { if uncompressedBytes := b.Get([]byte(anyDigest.String())); uncompressedBytes != nil { d, err := digest.Parse(string(uncompressedBytes)) if err == nil { return d...
go
func (bdc *cache) uncompressedDigest(tx *bolt.Tx, anyDigest digest.Digest) digest.Digest { if b := tx.Bucket(uncompressedDigestBucket); b != nil { if uncompressedBytes := b.Get([]byte(anyDigest.String())); uncompressedBytes != nil { d, err := digest.Parse(string(uncompressedBytes)) if err == nil { return d...
[ "func", "(", "bdc", "*", "cache", ")", "uncompressedDigest", "(", "tx", "*", "bolt", ".", "Tx", ",", "anyDigest", "digest", ".", "Digest", ")", "digest", ".", "Digest", "{", "if", "b", ":=", "tx", ".", "Bucket", "(", "uncompressedDigestBucket", ")", ";...
// uncompressedDigest implements BlobInfoCache.UncompressedDigest within the provided read-only transaction.
[ "uncompressedDigest", "implements", "BlobInfoCache", ".", "UncompressedDigest", "within", "the", "provided", "read", "-", "only", "transaction", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L145-L167
test
containers/image
pkg/blobinfocache/boltdb/boltdb.go
appendReplacementCandidates
func (bdc *cache) appendReplacementCandidates(candidates []prioritize.CandidateWithTime, scopeBucket *bolt.Bucket, digest digest.Digest) []prioritize.CandidateWithTime { b := scopeBucket.Bucket([]byte(digest.String())) if b == nil { return candidates } _ = b.ForEach(func(k, v []byte) error { t := time.Time{} ...
go
func (bdc *cache) appendReplacementCandidates(candidates []prioritize.CandidateWithTime, scopeBucket *bolt.Bucket, digest digest.Digest) []prioritize.CandidateWithTime { b := scopeBucket.Bucket([]byte(digest.String())) if b == nil { return candidates } _ = b.ForEach(func(k, v []byte) error { t := time.Time{} ...
[ "func", "(", "bdc", "*", "cache", ")", "appendReplacementCandidates", "(", "candidates", "[", "]", "prioritize", ".", "CandidateWithTime", ",", "scopeBucket", "*", "bolt", ".", "Bucket", ",", "digest", "digest", ".", "Digest", ")", "[", "]", "prioritize", "....
// appendReplacementCandiates creates prioritize.CandidateWithTime values for digest in scopeBucket, and returns the result of appending them to candidates.
[ "appendReplacementCandiates", "creates", "prioritize", ".", "CandidateWithTime", "values", "for", "digest", "in", "scopeBucket", "and", "returns", "the", "result", "of", "appending", "them", "to", "candidates", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/boltdb/boltdb.go#L255-L275
test
containers/image
oci/layout/oci_dest.go
indexExists
func indexExists(ref ociReference) bool { _, err := os.Stat(ref.indexPath()) if err == nil { return true } if os.IsNotExist(err) { return false } return true }
go
func indexExists(ref ociReference) bool { _, err := os.Stat(ref.indexPath()) if err == nil { return true } if os.IsNotExist(err) { return false } return true }
[ "func", "indexExists", "(", "ref", "ociReference", ")", "bool", "{", "_", ",", "err", ":=", "os", ".", "Stat", "(", "ref", ".", "indexPath", "(", ")", ")", "\n", "if", "err", "==", "nil", "{", "return", "true", "\n", "}", "\n", "if", "os", ".", ...
// indexExists checks whether the index location specified in the OCI reference exists. // The implementation is opinionated, since in case of unexpected errors false is returned
[ "indexExists", "checks", "whether", "the", "index", "location", "specified", "in", "the", "OCI", "reference", "exists", ".", "The", "implementation", "is", "opinionated", "since", "in", "case", "of", "unexpected", "errors", "false", "is", "returned" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_dest.go#L297-L306
test
containers/image
copy/sign.go
createSignature
func (c *copier) createSignature(manifest []byte, keyIdentity string) ([]byte, error) { mech, err := signature.NewGPGSigningMechanism() if err != nil { return nil, errors.Wrap(err, "Error initializing GPG") } defer mech.Close() if err := mech.SupportsSigning(); err != nil { return nil, errors.Wrap(err, "Signin...
go
func (c *copier) createSignature(manifest []byte, keyIdentity string) ([]byte, error) { mech, err := signature.NewGPGSigningMechanism() if err != nil { return nil, errors.Wrap(err, "Error initializing GPG") } defer mech.Close() if err := mech.SupportsSigning(); err != nil { return nil, errors.Wrap(err, "Signin...
[ "func", "(", "c", "*", "copier", ")", "createSignature", "(", "manifest", "[", "]", "byte", ",", "keyIdentity", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "mech", ",", "err", ":=", "signature", ".", "NewGPGSigningMechanism", "(", ")"...
// createSignature creates a new signature of manifest using keyIdentity.
[ "createSignature", "creates", "a", "new", "signature", "of", "manifest", "using", "keyIdentity", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/copy/sign.go#L10-L31
test
containers/image
oci/layout/oci_transport.go
ParseReference
func ParseReference(reference string) (types.ImageReference, error) { dir, image := internal.SplitPathAndImage(reference) return NewReference(dir, image) }
go
func ParseReference(reference string) (types.ImageReference, error) { dir, image := internal.SplitPathAndImage(reference) return NewReference(dir, image) }
[ "func", "ParseReference", "(", "reference", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "dir", ",", "image", ":=", "internal", ".", "SplitPathAndImage", "(", "reference", ")", "\n", "return", "NewReference", "(", "dir", ",", ...
// ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an OCI ImageReference.
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "OCI", "ImageReference", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_transport.go#L70-L73
test
containers/image
oci/layout/oci_transport.go
NewReference
func NewReference(dir, image string) (types.ImageReference, error) { resolved, err := explicitfilepath.ResolvePathToFullyExplicit(dir) if err != nil { return nil, err } if err := internal.ValidateOCIPath(dir); err != nil { return nil, err } if err = internal.ValidateImageName(image); err != nil { return n...
go
func NewReference(dir, image string) (types.ImageReference, error) { resolved, err := explicitfilepath.ResolvePathToFullyExplicit(dir) if err != nil { return nil, err } if err := internal.ValidateOCIPath(dir); err != nil { return nil, err } if err = internal.ValidateImageName(image); err != nil { return n...
[ "func", "NewReference", "(", "dir", ",", "image", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "resolved", ",", "err", ":=", "explicitfilepath", ".", "ResolvePathToFullyExplicit", "(", "dir", ")", "\n", "if", "err", "!=", "ni...
// NewReference returns an OCI reference for a directory and a image. // // We do not expose an API supplying the resolvedDir; we could, but recomputing it // is generally cheap enough that we prefer being confident about the properties of resolvedDir.
[ "NewReference", "returns", "an", "OCI", "reference", "for", "a", "directory", "and", "a", "image", ".", "We", "do", "not", "expose", "an", "API", "supplying", "the", "resolvedDir", ";", "we", "could", "but", "recomputing", "it", "is", "generally", "cheap", ...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_transport.go#L79-L94
test
containers/image
oci/layout/oci_transport.go
getIndex
func (ref ociReference) getIndex() (*imgspecv1.Index, error) { indexJSON, err := os.Open(ref.indexPath()) if err != nil { return nil, err } defer indexJSON.Close() index := &imgspecv1.Index{} if err := json.NewDecoder(indexJSON).Decode(index); err != nil { return nil, err } return index, nil }
go
func (ref ociReference) getIndex() (*imgspecv1.Index, error) { indexJSON, err := os.Open(ref.indexPath()) if err != nil { return nil, err } defer indexJSON.Close() index := &imgspecv1.Index{} if err := json.NewDecoder(indexJSON).Decode(index); err != nil { return nil, err } return index, nil }
[ "func", "(", "ref", "ociReference", ")", "getIndex", "(", ")", "(", "*", "imgspecv1", ".", "Index", ",", "error", ")", "{", "indexJSON", ",", "err", ":=", "os", ".", "Open", "(", "ref", ".", "indexPath", "(", ")", ")", "\n", "if", "err", "!=", "n...
// getIndex returns a pointer to the index references by this ociReference. If an error occurs opening an index nil is returned together // with an error.
[ "getIndex", "returns", "a", "pointer", "to", "the", "index", "references", "by", "this", "ociReference", ".", "If", "an", "error", "occurs", "opening", "an", "index", "nil", "is", "returned", "together", "with", "an", "error", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_transport.go#L166-L178
test
containers/image
oci/layout/oci_transport.go
LoadManifestDescriptor
func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor, error) { ociRef, ok := imgRef.(ociReference) if !ok { return imgspecv1.Descriptor{}, errors.Errorf("error typecasting, need type ociRef") } return ociRef.getManifestDescriptor() }
go
func LoadManifestDescriptor(imgRef types.ImageReference) (imgspecv1.Descriptor, error) { ociRef, ok := imgRef.(ociReference) if !ok { return imgspecv1.Descriptor{}, errors.Errorf("error typecasting, need type ociRef") } return ociRef.getManifestDescriptor() }
[ "func", "LoadManifestDescriptor", "(", "imgRef", "types", ".", "ImageReference", ")", "(", "imgspecv1", ".", "Descriptor", ",", "error", ")", "{", "ociRef", ",", "ok", ":=", "imgRef", ".", "(", "ociReference", ")", "\n", "if", "!", "ok", "{", "return", "...
// LoadManifestDescriptor loads the manifest descriptor to be used to retrieve the image name // when pulling an image
[ "LoadManifestDescriptor", "loads", "the", "manifest", "descriptor", "to", "be", "used", "to", "retrieve", "the", "image", "name", "when", "pulling", "an", "image" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_transport.go#L219-L225
test
containers/image
oci/layout/oci_transport.go
blobPath
func (ref ociReference) blobPath(digest digest.Digest, sharedBlobDir string) (string, error) { if err := digest.Validate(); err != nil { return "", errors.Wrapf(err, "unexpected digest reference %s", digest) } blobDir := filepath.Join(ref.dir, "blobs") if sharedBlobDir != "" { blobDir = sharedBlobDir } return...
go
func (ref ociReference) blobPath(digest digest.Digest, sharedBlobDir string) (string, error) { if err := digest.Validate(); err != nil { return "", errors.Wrapf(err, "unexpected digest reference %s", digest) } blobDir := filepath.Join(ref.dir, "blobs") if sharedBlobDir != "" { blobDir = sharedBlobDir } return...
[ "func", "(", "ref", "ociReference", ")", "blobPath", "(", "digest", "digest", ".", "Digest", ",", "sharedBlobDir", "string", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "digest", ".", "Validate", "(", ")", ";", "err", "!=", "nil", ...
// blobPath returns a path for a blob within a directory using OCI image-layout conventions.
[ "blobPath", "returns", "a", "path", "for", "a", "blob", "within", "a", "directory", "using", "OCI", "image", "-", "layout", "conventions", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/layout/oci_transport.go#L255-L264
test
containers/image
signature/docker.go
SignDockerManifest
func SignDockerManifest(m []byte, dockerReference string, mech SigningMechanism, keyIdentity string) ([]byte, error) { manifestDigest, err := manifest.Digest(m) if err != nil { return nil, err } sig := newUntrustedSignature(manifestDigest, dockerReference) return sig.sign(mech, keyIdentity) }
go
func SignDockerManifest(m []byte, dockerReference string, mech SigningMechanism, keyIdentity string) ([]byte, error) { manifestDigest, err := manifest.Digest(m) if err != nil { return nil, err } sig := newUntrustedSignature(manifestDigest, dockerReference) return sig.sign(mech, keyIdentity) }
[ "func", "SignDockerManifest", "(", "m", "[", "]", "byte", ",", "dockerReference", "string", ",", "mech", "SigningMechanism", ",", "keyIdentity", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "manifestDigest", ",", "err", ":=", "manifest", "...
// SignDockerManifest returns a signature for manifest as the specified dockerReference, // using mech and keyIdentity.
[ "SignDockerManifest", "returns", "a", "signature", "for", "manifest", "as", "the", "specified", "dockerReference", "using", "mech", "and", "keyIdentity", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/docker.go#L15-L22
test
containers/image
signature/docker.go
VerifyDockerManifestSignature
func VerifyDockerManifestSignature(unverifiedSignature, unverifiedManifest []byte, expectedDockerReference string, mech SigningMechanism, expectedKeyIdentity string) (*Signature, error) { expectedRef, err := reference.ParseNormalizedNamed(expectedDockerReference) if err != nil { return nil, err } sig, err := ver...
go
func VerifyDockerManifestSignature(unverifiedSignature, unverifiedManifest []byte, expectedDockerReference string, mech SigningMechanism, expectedKeyIdentity string) (*Signature, error) { expectedRef, err := reference.ParseNormalizedNamed(expectedDockerReference) if err != nil { return nil, err } sig, err := ver...
[ "func", "VerifyDockerManifestSignature", "(", "unverifiedSignature", ",", "unverifiedManifest", "[", "]", "byte", ",", "expectedDockerReference", "string", ",", "mech", "SigningMechanism", ",", "expectedKeyIdentity", "string", ")", "(", "*", "Signature", ",", "error", ...
// VerifyDockerManifestSignature checks that unverifiedSignature uses expectedKeyIdentity to sign unverifiedManifest as expectedDockerReference, // using mech.
[ "VerifyDockerManifestSignature", "checks", "that", "unverifiedSignature", "uses", "expectedKeyIdentity", "to", "sign", "unverifiedManifest", "as", "expectedDockerReference", "using", "mech", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/docker.go#L26-L65
test
containers/image
openshift/openshift.go
newOpenshiftClient
func newOpenshiftClient(ref openshiftReference) (*openshiftClient, error) { // We have already done this parsing in ParseReference, but thrown away // httpClient. So, parse again. // (We could also rework/split restClientFor to "get base URL" to be done // in ParseReference, and "get httpClient" to be done here. B...
go
func newOpenshiftClient(ref openshiftReference) (*openshiftClient, error) { // We have already done this parsing in ParseReference, but thrown away // httpClient. So, parse again. // (We could also rework/split restClientFor to "get base URL" to be done // in ParseReference, and "get httpClient" to be done here. B...
[ "func", "newOpenshiftClient", "(", "ref", "openshiftReference", ")", "(", "*", "openshiftClient", ",", "error", ")", "{", "cmdConfig", ":=", "defaultClientConfig", "(", ")", "\n", "logrus", ".", "Debugf", "(", "\"cmdConfig: %#v\"", ",", "cmdConfig", ")", "\n", ...
// newOpenshiftClient creates a new openshiftClient for the specified reference.
[ "newOpenshiftClient", "creates", "a", "new", "openshiftClient", "for", "the", "specified", "reference", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L37-L71
test
containers/image
openshift/openshift.go
doRequest
func (c *openshiftClient) doRequest(ctx context.Context, method, path string, requestBody []byte) ([]byte, error) { url := *c.baseURL url.Path = path var requestBodyReader io.Reader if requestBody != nil { logrus.Debugf("Will send body: %s", requestBody) requestBodyReader = bytes.NewReader(requestBody) } req,...
go
func (c *openshiftClient) doRequest(ctx context.Context, method, path string, requestBody []byte) ([]byte, error) { url := *c.baseURL url.Path = path var requestBodyReader io.Reader if requestBody != nil { logrus.Debugf("Will send body: %s", requestBody) requestBodyReader = bytes.NewReader(requestBody) } req,...
[ "func", "(", "c", "*", "openshiftClient", ")", "doRequest", "(", "ctx", "context", ".", "Context", ",", "method", ",", "path", "string", ",", "requestBody", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "url", ":=", "*", "c"...
// doRequest performs a correctly authenticated request to a specified path, and returns response body or an error object.
[ "doRequest", "performs", "a", "correctly", "authenticated", "request", "to", "a", "specified", "path", "and", "returns", "response", "body", "or", "an", "error", "object", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L74-L134
test
containers/image
openshift/openshift.go
getImage
func (c *openshiftClient) getImage(ctx context.Context, imageStreamImageName string) (*image, error) { // FIXME: validate components per validation.IsValidPathSegmentName? path := fmt.Sprintf("/oapi/v1/namespaces/%s/imagestreamimages/%s@%s", c.ref.namespace, c.ref.stream, imageStreamImageName) body, err := c.doReque...
go
func (c *openshiftClient) getImage(ctx context.Context, imageStreamImageName string) (*image, error) { // FIXME: validate components per validation.IsValidPathSegmentName? path := fmt.Sprintf("/oapi/v1/namespaces/%s/imagestreamimages/%s@%s", c.ref.namespace, c.ref.stream, imageStreamImageName) body, err := c.doReque...
[ "func", "(", "c", "*", "openshiftClient", ")", "getImage", "(", "ctx", "context", ".", "Context", ",", "imageStreamImageName", "string", ")", "(", "*", "image", ",", "error", ")", "{", "path", ":=", "fmt", ".", "Sprintf", "(", "\"/oapi/v1/namespaces/%s/image...
// getImage loads the specified image object.
[ "getImage", "loads", "the", "specified", "image", "object", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L137-L150
test
containers/image
openshift/openshift.go
convertDockerImageReference
func (c *openshiftClient) convertDockerImageReference(ref string) (string, error) { parts := strings.SplitN(ref, "/", 2) if len(parts) != 2 { return "", errors.Errorf("Invalid format of docker reference %s: missing '/'", ref) } return reference.Domain(c.ref.dockerReference) + "/" + parts[1], nil }
go
func (c *openshiftClient) convertDockerImageReference(ref string) (string, error) { parts := strings.SplitN(ref, "/", 2) if len(parts) != 2 { return "", errors.Errorf("Invalid format of docker reference %s: missing '/'", ref) } return reference.Domain(c.ref.dockerReference) + "/" + parts[1], nil }
[ "func", "(", "c", "*", "openshiftClient", ")", "convertDockerImageReference", "(", "ref", "string", ")", "(", "string", ",", "error", ")", "{", "parts", ":=", "strings", ".", "SplitN", "(", "ref", ",", "\"/\"", ",", "2", ")", "\n", "if", "len", "(", ...
// convertDockerImageReference takes an image API DockerImageReference value and returns a reference we can actually use; // currently OpenShift stores the cluster-internal service IPs here, which are unusable from the outside.
[ "convertDockerImageReference", "takes", "an", "image", "API", "DockerImageReference", "value", "and", "returns", "a", "reference", "we", "can", "actually", "use", ";", "currently", "OpenShift", "stores", "the", "cluster", "-", "internal", "service", "IPs", "here", ...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L154-L160
test
containers/image
openshift/openshift.go
ensureImageIsResolved
func (s *openshiftImageSource) ensureImageIsResolved(ctx context.Context) error { if s.docker != nil { return nil } // FIXME: validate components per validation.IsValidPathSegmentName? path := fmt.Sprintf("/oapi/v1/namespaces/%s/imagestreams/%s", s.client.ref.namespace, s.client.ref.stream) body, err := s.clien...
go
func (s *openshiftImageSource) ensureImageIsResolved(ctx context.Context) error { if s.docker != nil { return nil } // FIXME: validate components per validation.IsValidPathSegmentName? path := fmt.Sprintf("/oapi/v1/namespaces/%s/imagestreams/%s", s.client.ref.namespace, s.client.ref.stream) body, err := s.clien...
[ "func", "(", "s", "*", "openshiftImageSource", ")", "ensureImageIsResolved", "(", "ctx", "context", ".", "Context", ")", "error", "{", "if", "s", ".", "docker", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "path", ":=", "fmt", ".", "Sprintf", "(...
// ensureImageIsResolved sets up s.docker and s.imageStreamImageName
[ "ensureImageIsResolved", "sets", "up", "s", ".", "docker", "and", "s", ".", "imageStreamImageName" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L262-L308
test
containers/image
openshift/openshift.go
newImageDestination
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref openshiftReference) (types.ImageDestination, error) { client, err := newOpenshiftClient(ref) if err != nil { return nil, err } // FIXME: Should this always use a digest, not a tag? Uploading to Docker by tag requires the tag _inside_ the...
go
func newImageDestination(ctx context.Context, sys *types.SystemContext, ref openshiftReference) (types.ImageDestination, error) { client, err := newOpenshiftClient(ref) if err != nil { return nil, err } // FIXME: Should this always use a digest, not a tag? Uploading to Docker by tag requires the tag _inside_ the...
[ "func", "newImageDestination", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ",", "ref", "openshiftReference", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "client", ",", "err", ":=", "newOpensh...
// newImageDestination creates a new ImageDestination for the specified reference.
[ "newImageDestination", "creates", "a", "new", "ImageDestination", "for", "the", "specified", "reference", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/openshift/openshift.go#L318-L341
test
containers/image
signature/signature.go
newUntrustedSignature
func newUntrustedSignature(dockerManifestDigest digest.Digest, dockerReference string) untrustedSignature { // Use intermediate variables for these values so that we can take their addresses. // Golang guarantees that they will have a new address on every execution. creatorID := "atomic " + version.Version timestam...
go
func newUntrustedSignature(dockerManifestDigest digest.Digest, dockerReference string) untrustedSignature { // Use intermediate variables for these values so that we can take their addresses. // Golang guarantees that they will have a new address on every execution. creatorID := "atomic " + version.Version timestam...
[ "func", "newUntrustedSignature", "(", "dockerManifestDigest", "digest", ".", "Digest", ",", "dockerReference", "string", ")", "untrustedSignature", "{", "creatorID", ":=", "\"atomic \"", "+", "version", ".", "Version", "\n", "timestamp", ":=", "time", ".", "Now", ...
// newUntrustedSignature returns an untrustedSignature object with // the specified primary contents and appropriate metadata.
[ "newUntrustedSignature", "returns", "an", "untrustedSignature", "object", "with", "the", "specified", "primary", "contents", "and", "appropriate", "metadata", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/signature.go#L68-L79
test
containers/image
signature/signature.go
MarshalJSON
func (s untrustedSignature) MarshalJSON() ([]byte, error) { if s.UntrustedDockerManifestDigest == "" || s.UntrustedDockerReference == "" { return nil, errors.New("Unexpected empty signature content") } critical := map[string]interface{}{ "type": signatureType, "image": map[string]string{"docker-manifest...
go
func (s untrustedSignature) MarshalJSON() ([]byte, error) { if s.UntrustedDockerManifestDigest == "" || s.UntrustedDockerReference == "" { return nil, errors.New("Unexpected empty signature content") } critical := map[string]interface{}{ "type": signatureType, "image": map[string]string{"docker-manifest...
[ "func", "(", "s", "untrustedSignature", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "if", "s", ".", "UntrustedDockerManifestDigest", "==", "\"\"", "||", "s", ".", "UntrustedDockerReference", "==", "\"\"", "{", "return", "ni...
// MarshalJSON implements the json.Marshaler interface.
[ "MarshalJSON", "implements", "the", "json", ".", "Marshaler", "interface", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/signature.go#L85-L106
test
containers/image
signature/signature.go
UnmarshalJSON
func (s *untrustedSignature) UnmarshalJSON(data []byte) error { err := s.strictUnmarshalJSON(data) if err != nil { if _, ok := err.(jsonFormatError); ok { err = InvalidSignatureError{msg: err.Error()} } } return err }
go
func (s *untrustedSignature) UnmarshalJSON(data []byte) error { err := s.strictUnmarshalJSON(data) if err != nil { if _, ok := err.(jsonFormatError); ok { err = InvalidSignatureError{msg: err.Error()} } } return err }
[ "func", "(", "s", "*", "untrustedSignature", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "err", ":=", "s", ".", "strictUnmarshalJSON", "(", "data", ")", "\n", "if", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "e...
// UnmarshalJSON implements the json.Unmarshaler interface
[ "UnmarshalJSON", "implements", "the", "json", ".", "Unmarshaler", "interface" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/signature.go#L112-L120
test
containers/image
signature/signature.go
verifyAndExtractSignature
func verifyAndExtractSignature(mech SigningMechanism, unverifiedSignature []byte, rules signatureAcceptanceRules) (*Signature, error) { signed, keyIdentity, err := mech.Verify(unverifiedSignature) if err != nil { return nil, err } if err := rules.validateKeyIdentity(keyIdentity); err != nil { return nil, err }...
go
func verifyAndExtractSignature(mech SigningMechanism, unverifiedSignature []byte, rules signatureAcceptanceRules) (*Signature, error) { signed, keyIdentity, err := mech.Verify(unverifiedSignature) if err != nil { return nil, err } if err := rules.validateKeyIdentity(keyIdentity); err != nil { return nil, err }...
[ "func", "verifyAndExtractSignature", "(", "mech", "SigningMechanism", ",", "unverifiedSignature", "[", "]", "byte", ",", "rules", "signatureAcceptanceRules", ")", "(", "*", "Signature", ",", "error", ")", "{", "signed", ",", "keyIdentity", ",", "err", ":=", "mec...
// verifyAndExtractSignature verifies that unverifiedSignature has been signed, and that its principial components // match expected values, both as specified by rules, and returns it
[ "verifyAndExtractSignature", "verifies", "that", "unverifiedSignature", "has", "been", "signed", "and", "that", "its", "principial", "components", "match", "expected", "values", "both", "as", "specified", "by", "rules", "and", "returns", "it" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/signature.go#L216-L240
test
containers/image
pkg/sysregistriesv2/system_registries_v2.go
RewriteReference
func (e *Endpoint) RewriteReference(ref reference.Named, prefix string) (reference.Named, error) { if ref == nil { return nil, fmt.Errorf("provided reference is nil") } if prefix == "" { return ref, nil } refString := ref.String() if refMatchesPrefix(refString, prefix) { newNamedRef := strings.Replace(refSt...
go
func (e *Endpoint) RewriteReference(ref reference.Named, prefix string) (reference.Named, error) { if ref == nil { return nil, fmt.Errorf("provided reference is nil") } if prefix == "" { return ref, nil } refString := ref.String() if refMatchesPrefix(refString, prefix) { newNamedRef := strings.Replace(refSt...
[ "func", "(", "e", "*", "Endpoint", ")", "RewriteReference", "(", "ref", "reference", ".", "Named", ",", "prefix", "string", ")", "(", "reference", ".", "Named", ",", "error", ")", "{", "if", "ref", "==", "nil", "{", "return", "nil", ",", "fmt", ".", ...
// RewriteReference will substitute the provided reference `prefix` to the // endpoints `location` from the `ref` and creates a new named reference from it. // The function errors if the newly created reference is not parsable.
[ "RewriteReference", "will", "substitute", "the", "provided", "reference", "prefix", "to", "the", "endpoints", "location", "from", "the", "ref", "and", "creates", "a", "new", "named", "reference", "from", "it", ".", "The", "function", "errors", "if", "the", "ne...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/sysregistriesv2/system_registries_v2.go#L41-L62
test
containers/image
pkg/sysregistriesv2/system_registries_v2.go
getV1Registries
func getV1Registries(config *tomlConfig) ([]Registry, error) { regMap := make(map[string]*Registry) // We must preserve the order of config.V1Registries.Search.Registries at least. The order of the // other registries is not really important, but make it deterministic (the same for the same config file) // to mini...
go
func getV1Registries(config *tomlConfig) ([]Registry, error) { regMap := make(map[string]*Registry) // We must preserve the order of config.V1Registries.Search.Registries at least. The order of the // other registries is not really important, but make it deterministic (the same for the same config file) // to mini...
[ "func", "getV1Registries", "(", "config", "*", "tomlConfig", ")", "(", "[", "]", "Registry", ",", "error", ")", "{", "regMap", ":=", "make", "(", "map", "[", "string", "]", "*", "Registry", ")", "\n", "registryOrder", ":=", "[", "]", "string", "{", "...
// getV1Registries transforms v1 registries in the config into an array of v2 // registries of type Registry.
[ "getV1Registries", "transforms", "v1", "registries", "in", "the", "config", "into", "an", "array", "of", "v2", "registries", "of", "type", "Registry", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/sysregistriesv2/system_registries_v2.go#L133-L189
test
containers/image
pkg/sysregistriesv2/system_registries_v2.go
getConfigPath
func getConfigPath(ctx *types.SystemContext) string { confPath := systemRegistriesConfPath if ctx != nil { if ctx.SystemRegistriesConfPath != "" { confPath = ctx.SystemRegistriesConfPath } else if ctx.RootForImplicitAbsolutePaths != "" { confPath = filepath.Join(ctx.RootForImplicitAbsolutePaths, systemRegis...
go
func getConfigPath(ctx *types.SystemContext) string { confPath := systemRegistriesConfPath if ctx != nil { if ctx.SystemRegistriesConfPath != "" { confPath = ctx.SystemRegistriesConfPath } else if ctx.RootForImplicitAbsolutePaths != "" { confPath = filepath.Join(ctx.RootForImplicitAbsolutePaths, systemRegis...
[ "func", "getConfigPath", "(", "ctx", "*", "types", ".", "SystemContext", ")", "string", "{", "confPath", ":=", "systemRegistriesConfPath", "\n", "if", "ctx", "!=", "nil", "{", "if", "ctx", ".", "SystemRegistriesConfPath", "!=", "\"\"", "{", "confPath", "=", ...
// getConfigPath returns the system-registries config path if specified. // Otherwise, systemRegistriesConfPath is returned.
[ "getConfigPath", "returns", "the", "system", "-", "registries", "config", "path", "if", "specified", ".", "Otherwise", "systemRegistriesConfPath", "is", "returned", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/sysregistriesv2/system_registries_v2.go#L253-L263
test
containers/image
pkg/sysregistriesv2/system_registries_v2.go
GetRegistries
func GetRegistries(ctx *types.SystemContext) ([]Registry, error) { configPath := getConfigPath(ctx) configMutex.Lock() defer configMutex.Unlock() // if the config has already been loaded, return the cached registries if registries, inCache := configCache[configPath]; inCache { return registries, nil } // loa...
go
func GetRegistries(ctx *types.SystemContext) ([]Registry, error) { configPath := getConfigPath(ctx) configMutex.Lock() defer configMutex.Unlock() // if the config has already been loaded, return the cached registries if registries, inCache := configCache[configPath]; inCache { return registries, nil } // loa...
[ "func", "GetRegistries", "(", "ctx", "*", "types", ".", "SystemContext", ")", "(", "[", "]", "Registry", ",", "error", ")", "{", "configPath", ":=", "getConfigPath", "(", "ctx", ")", "\n", "configMutex", ".", "Lock", "(", ")", "\n", "defer", "configMutex...
// GetRegistries loads and returns the registries specified in the config. // Note the parsed content of registry config files is cached. For reloading, // use `InvalidateCache` and re-call `GetRegistries`.
[ "GetRegistries", "loads", "and", "returns", "the", "registries", "specified", "in", "the", "config", ".", "Note", "the", "parsed", "content", "of", "registry", "config", "files", "is", "cached", ".", "For", "reloading", "use", "InvalidateCache", "and", "re", "...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/sysregistriesv2/system_registries_v2.go#L285-L331
test
containers/image
pkg/sysregistriesv2/system_registries_v2.go
readRegistryConf
func readRegistryConf(configPath string) ([]byte, error) { configBytes, err := ioutil.ReadFile(configPath) return configBytes, err }
go
func readRegistryConf(configPath string) ([]byte, error) { configBytes, err := ioutil.ReadFile(configPath) return configBytes, err }
[ "func", "readRegistryConf", "(", "configPath", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "configBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "configPath", ")", "\n", "return", "configBytes", ",", "err", "\n", "}" ]
// Reads the global registry file from the filesystem. Returns a byte array.
[ "Reads", "the", "global", "registry", "file", "from", "the", "filesystem", ".", "Returns", "a", "byte", "array", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/sysregistriesv2/system_registries_v2.go#L405-L408
test
containers/image
image/sourced.go
Manifest
func (i *sourcedImage) Manifest(ctx context.Context) ([]byte, string, error) { return i.manifestBlob, i.manifestMIMEType, nil }
go
func (i *sourcedImage) Manifest(ctx context.Context) ([]byte, string, error) { return i.manifestBlob, i.manifestMIMEType, nil }
[ "func", "(", "i", "*", "sourcedImage", ")", "Manifest", "(", "ctx", "context", ".", "Context", ")", "(", "[", "]", "byte", ",", "string", ",", "error", ")", "{", "return", "i", ".", "manifestBlob", ",", "i", ".", "manifestMIMEType", ",", "nil", "\n",...
// Manifest overrides the UnparsedImage.Manifest to always use the fields which we have already fetched.
[ "Manifest", "overrides", "the", "UnparsedImage", ".", "Manifest", "to", "always", "use", "the", "fields", "which", "we", "have", "already", "fetched", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/image/sourced.go#L97-L99
test
containers/image
tarball/tarball_reference.go
ConfigUpdate
func (r *tarballReference) ConfigUpdate(config imgspecv1.Image, annotations map[string]string) error { r.config = config if r.annotations == nil { r.annotations = make(map[string]string) } for k, v := range annotations { r.annotations[k] = v } return nil }
go
func (r *tarballReference) ConfigUpdate(config imgspecv1.Image, annotations map[string]string) error { r.config = config if r.annotations == nil { r.annotations = make(map[string]string) } for k, v := range annotations { r.annotations[k] = v } return nil }
[ "func", "(", "r", "*", "tarballReference", ")", "ConfigUpdate", "(", "config", "imgspecv1", ".", "Image", ",", "annotations", "map", "[", "string", "]", "string", ")", "error", "{", "r", ".", "config", "=", "config", "\n", "if", "r", ".", "annotations", ...
// ConfigUpdate updates the image's default configuration and adds annotations // which will be visible in source images created using this reference.
[ "ConfigUpdate", "updates", "the", "image", "s", "default", "configuration", "and", "adds", "annotations", "which", "will", "be", "visible", "in", "source", "images", "created", "using", "this", "reference", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/tarball/tarball_reference.go#L34-L43
test
containers/image
signature/policy_reference_match.go
parseImageAndDockerReference
func parseImageAndDockerReference(image types.UnparsedImage, s2 string) (reference.Named, reference.Named, error) { r1 := image.Reference().DockerReference() if r1 == nil { return nil, nil, PolicyRequirementError(fmt.Sprintf("Docker reference match attempted on image %s with no known Docker reference identity", ...
go
func parseImageAndDockerReference(image types.UnparsedImage, s2 string) (reference.Named, reference.Named, error) { r1 := image.Reference().DockerReference() if r1 == nil { return nil, nil, PolicyRequirementError(fmt.Sprintf("Docker reference match attempted on image %s with no known Docker reference identity", ...
[ "func", "parseImageAndDockerReference", "(", "image", "types", ".", "UnparsedImage", ",", "s2", "string", ")", "(", "reference", ".", "Named", ",", "reference", ".", "Named", ",", "error", ")", "{", "r1", ":=", "image", ".", "Reference", "(", ")", ".", "...
// parseImageAndDockerReference converts an image and a reference string into two parsed entities, failing on any error and handling unidentified images.
[ "parseImageAndDockerReference", "converts", "an", "image", "and", "a", "reference", "string", "into", "two", "parsed", "entities", "failing", "on", "any", "error", "and", "handling", "unidentified", "images", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_reference_match.go#L14-L25
test
containers/image
signature/policy_reference_match.go
parseDockerReferences
func parseDockerReferences(s1, s2 string) (reference.Named, reference.Named, error) { r1, err := reference.ParseNormalizedNamed(s1) if err != nil { return nil, nil, err } r2, err := reference.ParseNormalizedNamed(s2) if err != nil { return nil, nil, err } return r1, r2, nil }
go
func parseDockerReferences(s1, s2 string) (reference.Named, reference.Named, error) { r1, err := reference.ParseNormalizedNamed(s1) if err != nil { return nil, nil, err } r2, err := reference.ParseNormalizedNamed(s2) if err != nil { return nil, nil, err } return r1, r2, nil }
[ "func", "parseDockerReferences", "(", "s1", ",", "s2", "string", ")", "(", "reference", ".", "Named", ",", "reference", ".", "Named", ",", "error", ")", "{", "r1", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "s1", ")", "\n", "if", ...
// parseDockerReferences converts two reference strings into parsed entities, failing on any error
[ "parseDockerReferences", "converts", "two", "reference", "strings", "into", "parsed", "entities", "failing", "on", "any", "error" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/signature/policy_reference_match.go#L71-L81
test
containers/image
transports/transports.go
ListNames
func ListNames() []string { kt.mu.Lock() defer kt.mu.Unlock() deprecated := map[string]bool{ "atomic": true, } var names []string for _, transport := range kt.transports { if !deprecated[transport.Name()] { names = append(names, transport.Name()) } } sort.Strings(names) return names }
go
func ListNames() []string { kt.mu.Lock() defer kt.mu.Unlock() deprecated := map[string]bool{ "atomic": true, } var names []string for _, transport := range kt.transports { if !deprecated[transport.Name()] { names = append(names, transport.Name()) } } sort.Strings(names) return names }
[ "func", "ListNames", "(", ")", "[", "]", "string", "{", "kt", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "kt", ".", "mu", ".", "Unlock", "(", ")", "\n", "deprecated", ":=", "map", "[", "string", "]", "bool", "{", "\"atomic\"", ":", "true", ...
// ListNames returns a list of non deprecated transport names. // Deprecated transports can be used, but are not presented to users.
[ "ListNames", "returns", "a", "list", "of", "non", "deprecated", "transport", "names", ".", "Deprecated", "transports", "can", "be", "used", "but", "are", "not", "presented", "to", "users", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/transports/transports.go#L76-L90
test
containers/image
ostree/ostree_transport.go
NewReference
func NewReference(image string, repo string) (types.ImageReference, error) { // image is not _really_ in a containers/image/docker/reference format; // as far as the libOSTree ociimage/* namespace is concerned, it is more or // less an arbitrary string with an implied tag. // Parse the image using reference.ParseNo...
go
func NewReference(image string, repo string) (types.ImageReference, error) { // image is not _really_ in a containers/image/docker/reference format; // as far as the libOSTree ociimage/* namespace is concerned, it is more or // less an arbitrary string with an implied tag. // Parse the image using reference.ParseNo...
[ "func", "NewReference", "(", "image", "string", ",", "repo", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "ostreeImage", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "image", ")", "\n", "if", "err", "!=", ...
// NewReference returns an OSTree reference for a specified repo and image.
[ "NewReference", "returns", "an", "OSTree", "reference", "for", "a", "specified", "repo", "and", "image", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/ostree/ostree_transport.go#L89-L127
test
containers/image
ostree/ostree_transport.go
signaturePath
func (ref ostreeReference) signaturePath(index int) string { return filepath.Join("manifest", fmt.Sprintf("signature-%d", index+1)) }
go
func (ref ostreeReference) signaturePath(index int) string { return filepath.Join("manifest", fmt.Sprintf("signature-%d", index+1)) }
[ "func", "(", "ref", "ostreeReference", ")", "signaturePath", "(", "index", "int", ")", "string", "{", "return", "filepath", ".", "Join", "(", "\"manifest\"", ",", "fmt", ".", "Sprintf", "(", "\"signature-%d\"", ",", "index", "+", "1", ")", ")", "\n", "}"...
// signaturePath returns a path for a signature within a ostree using our conventions.
[ "signaturePath", "returns", "a", "path", "for", "a", "signature", "within", "a", "ostree", "using", "our", "conventions", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/ostree/ostree_transport.go#L250-L252
test
containers/image
oci/internal/oci_util.go
ValidateImageName
func ValidateImageName(image string) error { if len(image) == 0 { return nil } var err error if !refRegexp.MatchString(image) { err = errors.Errorf("Invalid image %s", image) } return err }
go
func ValidateImageName(image string) error { if len(image) == 0 { return nil } var err error if !refRegexp.MatchString(image) { err = errors.Errorf("Invalid image %s", image) } return err }
[ "func", "ValidateImageName", "(", "image", "string", ")", "error", "{", "if", "len", "(", "image", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "var", "err", "error", "\n", "if", "!", "refRegexp", ".", "MatchString", "(", "image", ")", "{",...
// ValidateImageName returns nil if the image name is empty or matches the open-containers image name specs. // In any other case an error is returned.
[ "ValidateImageName", "returns", "nil", "if", "the", "image", "name", "is", "empty", "or", "matches", "the", "open", "-", "containers", "image", "name", "specs", ".", "In", "any", "other", "case", "an", "error", "is", "returned", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/internal/oci_util.go#L23-L33
test
containers/image
oci/internal/oci_util.go
SplitPathAndImage
func SplitPathAndImage(reference string) (string, string) { if runtime.GOOS == "windows" { return splitPathAndImageWindows(reference) } return splitPathAndImageNonWindows(reference) }
go
func SplitPathAndImage(reference string) (string, string) { if runtime.GOOS == "windows" { return splitPathAndImageWindows(reference) } return splitPathAndImageNonWindows(reference) }
[ "func", "SplitPathAndImage", "(", "reference", "string", ")", "(", "string", ",", "string", ")", "{", "if", "runtime", ".", "GOOS", "==", "\"windows\"", "{", "return", "splitPathAndImageWindows", "(", "reference", ")", "\n", "}", "\n", "return", "splitPathAndI...
// SplitPathAndImage tries to split the provided OCI reference into the OCI path and image. // Neither path nor image parts are validated at this stage.
[ "SplitPathAndImage", "tries", "to", "split", "the", "provided", "OCI", "reference", "into", "the", "OCI", "path", "and", "image", ".", "Neither", "path", "nor", "image", "parts", "are", "validated", "at", "this", "stage", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/internal/oci_util.go#L37-L42
test
containers/image
oci/internal/oci_util.go
ValidateOCIPath
func ValidateOCIPath(path string) error { if runtime.GOOS == "windows" { // On Windows we must allow for a ':' as part of the path if strings.Count(path, ":") > 1 { return errors.Errorf("Invalid OCI reference: path %s contains more than one colon", path) } } else { if strings.Contains(path, ":") { retur...
go
func ValidateOCIPath(path string) error { if runtime.GOOS == "windows" { // On Windows we must allow for a ':' as part of the path if strings.Count(path, ":") > 1 { return errors.Errorf("Invalid OCI reference: path %s contains more than one colon", path) } } else { if strings.Contains(path, ":") { retur...
[ "func", "ValidateOCIPath", "(", "path", "string", ")", "error", "{", "if", "runtime", ".", "GOOS", "==", "\"windows\"", "{", "if", "strings", ".", "Count", "(", "path", ",", "\":\"", ")", ">", "1", "{", "return", "errors", ".", "Errorf", "(", "\"Invali...
// ValidateOCIPath takes the OCI path and validates it.
[ "ValidateOCIPath", "takes", "the", "OCI", "path", "and", "validates", "it", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/internal/oci_util.go#L71-L83
test
containers/image
oci/internal/oci_util.go
ValidateScope
func ValidateScope(scope string) error { var err error if runtime.GOOS == "windows" { err = validateScopeWindows(scope) } else { err = validateScopeNonWindows(scope) } if err != nil { return err } cleaned := filepath.Clean(scope) if cleaned != scope { return errors.Errorf(`Invalid scope %s: Uses non-ca...
go
func ValidateScope(scope string) error { var err error if runtime.GOOS == "windows" { err = validateScopeWindows(scope) } else { err = validateScopeNonWindows(scope) } if err != nil { return err } cleaned := filepath.Clean(scope) if cleaned != scope { return errors.Errorf(`Invalid scope %s: Uses non-ca...
[ "func", "ValidateScope", "(", "scope", "string", ")", "error", "{", "var", "err", "error", "\n", "if", "runtime", ".", "GOOS", "==", "\"windows\"", "{", "err", "=", "validateScopeWindows", "(", "scope", ")", "\n", "}", "else", "{", "err", "=", "validateS...
// ValidateScope validates a policy configuration scope for an OCI transport.
[ "ValidateScope", "validates", "a", "policy", "configuration", "scope", "for", "an", "OCI", "transport", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/internal/oci_util.go#L86-L103
test
containers/image
manifest/docker_schema2.go
BlobInfoFromSchema2Descriptor
func BlobInfoFromSchema2Descriptor(desc Schema2Descriptor) types.BlobInfo { return types.BlobInfo{ Digest: desc.Digest, Size: desc.Size, URLs: desc.URLs, MediaType: desc.MediaType, } }
go
func BlobInfoFromSchema2Descriptor(desc Schema2Descriptor) types.BlobInfo { return types.BlobInfo{ Digest: desc.Digest, Size: desc.Size, URLs: desc.URLs, MediaType: desc.MediaType, } }
[ "func", "BlobInfoFromSchema2Descriptor", "(", "desc", "Schema2Descriptor", ")", "types", ".", "BlobInfo", "{", "return", "types", ".", "BlobInfo", "{", "Digest", ":", "desc", ".", "Digest", ",", "Size", ":", "desc", ".", "Size", ",", "URLs", ":", "desc", "...
// BlobInfoFromSchema2Descriptor returns a types.BlobInfo based on the input schema 2 descriptor.
[ "BlobInfoFromSchema2Descriptor", "returns", "a", "types", ".", "BlobInfo", "based", "on", "the", "input", "schema", "2", "descriptor", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema2.go#L22-L29
test
containers/image
manifest/docker_schema2.go
Schema2FromManifest
func Schema2FromManifest(manifest []byte) (*Schema2, error) { s2 := Schema2{} if err := json.Unmarshal(manifest, &s2); err != nil { return nil, err } return &s2, nil }
go
func Schema2FromManifest(manifest []byte) (*Schema2, error) { s2 := Schema2{} if err := json.Unmarshal(manifest, &s2); err != nil { return nil, err } return &s2, nil }
[ "func", "Schema2FromManifest", "(", "manifest", "[", "]", "byte", ")", "(", "*", "Schema2", ",", "error", ")", "{", "s2", ":=", "Schema2", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "manifest", ",", "&", "s2", ")", ";", "err"...
// Schema2FromManifest creates a Schema2 manifest instance from a manifest blob.
[ "Schema2FromManifest", "creates", "a", "Schema2", "manifest", "instance", "from", "a", "manifest", "blob", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema2.go#L159-L165
test
containers/image
manifest/docker_schema2.go
Schema2FromComponents
func Schema2FromComponents(config Schema2Descriptor, layers []Schema2Descriptor) *Schema2 { return &Schema2{ SchemaVersion: 2, MediaType: DockerV2Schema2MediaType, ConfigDescriptor: config, LayersDescriptors: layers, } }
go
func Schema2FromComponents(config Schema2Descriptor, layers []Schema2Descriptor) *Schema2 { return &Schema2{ SchemaVersion: 2, MediaType: DockerV2Schema2MediaType, ConfigDescriptor: config, LayersDescriptors: layers, } }
[ "func", "Schema2FromComponents", "(", "config", "Schema2Descriptor", ",", "layers", "[", "]", "Schema2Descriptor", ")", "*", "Schema2", "{", "return", "&", "Schema2", "{", "SchemaVersion", ":", "2", ",", "MediaType", ":", "DockerV2Schema2MediaType", ",", "ConfigDe...
// Schema2FromComponents creates an Schema2 manifest instance from the supplied data.
[ "Schema2FromComponents", "creates", "an", "Schema2", "manifest", "instance", "from", "the", "supplied", "data", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema2.go#L168-L175
test
containers/image
pkg/docker/config/config.go
SetAuthentication
func SetAuthentication(sys *types.SystemContext, registry, username, password string) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { if ch, exists := auths.CredHelpers[registry]; exists { return false, setAuthToCredHelper(ch, registry, username, password) } creds := base64.StdEn...
go
func SetAuthentication(sys *types.SystemContext, registry, username, password string) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { if ch, exists := auths.CredHelpers[registry]; exists { return false, setAuthToCredHelper(ch, registry, username, password) } creds := base64.StdEn...
[ "func", "SetAuthentication", "(", "sys", "*", "types", ".", "SystemContext", ",", "registry", ",", "username", ",", "password", "string", ")", "error", "{", "return", "modifyJSON", "(", "sys", ",", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "...
// SetAuthentication stores the username and password in the auth.json file
[ "SetAuthentication", "stores", "the", "username", "and", "password", "in", "the", "auth", ".", "json", "file" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L41-L52
test
containers/image
pkg/docker/config/config.go
RemoveAuthentication
func RemoveAuthentication(sys *types.SystemContext, registry string) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { // First try cred helpers. if ch, exists := auths.CredHelpers[registry]; exists { return false, deleteAuthFromCredHelper(ch, registry) } if _, ok := auths.AuthCo...
go
func RemoveAuthentication(sys *types.SystemContext, registry string) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { // First try cred helpers. if ch, exists := auths.CredHelpers[registry]; exists { return false, deleteAuthFromCredHelper(ch, registry) } if _, ok := auths.AuthCo...
[ "func", "RemoveAuthentication", "(", "sys", "*", "types", ".", "SystemContext", ",", "registry", "string", ")", "error", "{", "return", "modifyJSON", "(", "sys", ",", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "bool", ",", "error", ")", "{", ...
// RemoveAuthentication deletes the credentials stored in auth.json
[ "RemoveAuthentication", "deletes", "the", "credentials", "stored", "in", "auth", ".", "json" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L89-L105
test
containers/image
pkg/docker/config/config.go
RemoveAllAuthentication
func RemoveAllAuthentication(sys *types.SystemContext) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { auths.CredHelpers = make(map[string]string) auths.AuthConfigs = make(map[string]dockerAuthConfig) return true, nil }) }
go
func RemoveAllAuthentication(sys *types.SystemContext) error { return modifyJSON(sys, func(auths *dockerConfigFile) (bool, error) { auths.CredHelpers = make(map[string]string) auths.AuthConfigs = make(map[string]dockerAuthConfig) return true, nil }) }
[ "func", "RemoveAllAuthentication", "(", "sys", "*", "types", ".", "SystemContext", ")", "error", "{", "return", "modifyJSON", "(", "sys", ",", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "bool", ",", "error", ")", "{", "auths", ".", "CredHelpe...
// RemoveAllAuthentication deletes all the credentials stored in auth.json
[ "RemoveAllAuthentication", "deletes", "all", "the", "credentials", "stored", "in", "auth", ".", "json" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L108-L114
test
containers/image
pkg/docker/config/config.go
readJSONFile
func readJSONFile(path string, legacyFormat bool) (dockerConfigFile, error) { var auths dockerConfigFile raw, err := ioutil.ReadFile(path) if err != nil { if os.IsNotExist(err) { auths.AuthConfigs = map[string]dockerAuthConfig{} return auths, nil } return dockerConfigFile{}, err } if legacyFormat { ...
go
func readJSONFile(path string, legacyFormat bool) (dockerConfigFile, error) { var auths dockerConfigFile raw, err := ioutil.ReadFile(path) if err != nil { if os.IsNotExist(err) { auths.AuthConfigs = map[string]dockerAuthConfig{} return auths, nil } return dockerConfigFile{}, err } if legacyFormat { ...
[ "func", "readJSONFile", "(", "path", "string", ",", "legacyFormat", "bool", ")", "(", "dockerConfigFile", ",", "error", ")", "{", "var", "auths", "dockerConfigFile", "\n", "raw", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", ...
// readJSONFile unmarshals the authentications stored in the auth.json file and returns it // or returns an empty dockerConfigFile data structure if auth.json does not exist // if the file exists and is empty, readJSONFile returns an error
[ "readJSONFile", "unmarshals", "the", "authentications", "stored", "in", "the", "auth", ".", "json", "file", "and", "returns", "it", "or", "returns", "an", "empty", "dockerConfigFile", "data", "structure", "if", "auth", ".", "json", "does", "not", "exist", "if"...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L149-L173
test
containers/image
pkg/docker/config/config.go
modifyJSON
func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) error { path, err := getPathToAuth(sys) if err != nil { return err } dir := filepath.Dir(path) if _, err := os.Stat(dir); os.IsNotExist(err) { if err = os.MkdirAll(dir, 0700); err != nil { return errors.Wrapf(err,...
go
func modifyJSON(sys *types.SystemContext, editor func(auths *dockerConfigFile) (bool, error)) error { path, err := getPathToAuth(sys) if err != nil { return err } dir := filepath.Dir(path) if _, err := os.Stat(dir); os.IsNotExist(err) { if err = os.MkdirAll(dir, 0700); err != nil { return errors.Wrapf(err,...
[ "func", "modifyJSON", "(", "sys", "*", "types", ".", "SystemContext", ",", "editor", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "bool", ",", "error", ")", ")", "error", "{", "path", ",", "err", ":=", "getPathToAuth", "(", "sys", ")", "\n"...
// modifyJSON writes to auth.json if the dockerConfigFile has been updated
[ "modifyJSON", "writes", "to", "auth", ".", "json", "if", "the", "dockerConfigFile", "has", "been", "updated" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L176-L210
test
containers/image
pkg/docker/config/config.go
findAuthentication
func findAuthentication(registry, path string, legacyFormat bool) (string, string, error) { auths, err := readJSONFile(path, legacyFormat) if err != nil { return "", "", errors.Wrapf(err, "error reading JSON file %q", path) } // First try cred helpers. They should always be normalized. if ch, exists := auths.Cr...
go
func findAuthentication(registry, path string, legacyFormat bool) (string, string, error) { auths, err := readJSONFile(path, legacyFormat) if err != nil { return "", "", errors.Wrapf(err, "error reading JSON file %q", path) } // First try cred helpers. They should always be normalized. if ch, exists := auths.Cr...
[ "func", "findAuthentication", "(", "registry", ",", "path", "string", ",", "legacyFormat", "bool", ")", "(", "string", ",", "string", ",", "error", ")", "{", "auths", ",", "err", ":=", "readJSONFile", "(", "path", ",", "legacyFormat", ")", "\n", "if", "e...
// findAuthentication looks for auth of registry in path
[ "findAuthentication", "looks", "for", "auth", "of", "registry", "in", "path" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/docker/config/config.go#L240-L266
test
containers/image
docker/tarfile/dest.go
NewDestination
func NewDestination(dest io.Writer, ref reference.NamedTagged) *Destination { repoTags := []reference.NamedTagged{} if ref != nil { repoTags = append(repoTags, ref) } return &Destination{ writer: dest, tar: tar.NewWriter(dest), repoTags: repoTags, blobs: make(map[digest.Digest]types.BlobInfo), ...
go
func NewDestination(dest io.Writer, ref reference.NamedTagged) *Destination { repoTags := []reference.NamedTagged{} if ref != nil { repoTags = append(repoTags, ref) } return &Destination{ writer: dest, tar: tar.NewWriter(dest), repoTags: repoTags, blobs: make(map[digest.Digest]types.BlobInfo), ...
[ "func", "NewDestination", "(", "dest", "io", ".", "Writer", ",", "ref", "reference", ".", "NamedTagged", ")", "*", "Destination", "{", "repoTags", ":=", "[", "]", "reference", ".", "NamedTagged", "{", "}", "\n", "if", "ref", "!=", "nil", "{", "repoTags",...
// NewDestination returns a tarfile.Destination for the specified io.Writer.
[ "NewDestination", "returns", "a", "tarfile", ".", "Destination", "for", "the", "specified", "io", ".", "Writer", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L35-L46
test
containers/image
docker/tarfile/dest.go
AddRepoTags
func (d *Destination) AddRepoTags(tags []reference.NamedTagged) { d.repoTags = append(d.repoTags, tags...) }
go
func (d *Destination) AddRepoTags(tags []reference.NamedTagged) { d.repoTags = append(d.repoTags, tags...) }
[ "func", "(", "d", "*", "Destination", ")", "AddRepoTags", "(", "tags", "[", "]", "reference", ".", "NamedTagged", ")", "{", "d", ".", "repoTags", "=", "append", "(", "d", ".", "repoTags", ",", "tags", "...", ")", "\n", "}" ]
// AddRepoTags adds the specified tags to the destination's repoTags.
[ "AddRepoTags", "adds", "the", "specified", "tags", "to", "the", "destination", "s", "repoTags", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L49-L51
test
containers/image
docker/tarfile/dest.go
writeLegacyLayerMetadata
func (d *Destination) writeLegacyLayerMetadata(layerDescriptors []manifest.Schema2Descriptor) (layerPaths []string, lastLayerID string, err error) { var chainID digest.Digest lastLayerID = "" for i, l := range layerDescriptors { // This chainID value matches the computation in docker/docker/layer.CreateChainID … ...
go
func (d *Destination) writeLegacyLayerMetadata(layerDescriptors []manifest.Schema2Descriptor) (layerPaths []string, lastLayerID string, err error) { var chainID digest.Digest lastLayerID = "" for i, l := range layerDescriptors { // This chainID value matches the computation in docker/docker/layer.CreateChainID … ...
[ "func", "(", "d", "*", "Destination", ")", "writeLegacyLayerMetadata", "(", "layerDescriptors", "[", "]", "manifest", ".", "Schema2Descriptor", ")", "(", "layerPaths", "[", "]", "string", ",", "lastLayerID", "string", ",", "err", "error", ")", "{", "var", "c...
// writeLegacyLayerMetadata writes legacy VERSION and configuration files for all layers
[ "writeLegacyLayerMetadata", "writes", "legacy", "VERSION", "and", "configuration", "files", "for", "all", "layers" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L262-L327
test
containers/image
docker/tarfile/dest.go
sendSymlink
func (d *Destination) sendSymlink(path string, target string) error { hdr, err := tar.FileInfoHeader(&tarFI{path: path, size: 0, isSymlink: true}, target) if err != nil { return nil } logrus.Debugf("Sending as tar link %s -> %s", path, target) return d.tar.WriteHeader(hdr) }
go
func (d *Destination) sendSymlink(path string, target string) error { hdr, err := tar.FileInfoHeader(&tarFI{path: path, size: 0, isSymlink: true}, target) if err != nil { return nil } logrus.Debugf("Sending as tar link %s -> %s", path, target) return d.tar.WriteHeader(hdr) }
[ "func", "(", "d", "*", "Destination", ")", "sendSymlink", "(", "path", "string", ",", "target", "string", ")", "error", "{", "hdr", ",", "err", ":=", "tar", ".", "FileInfoHeader", "(", "&", "tarFI", "{", "path", ":", "path", ",", "size", ":", "0", ...
// sendSymlink sends a symlink into the tar stream.
[ "sendSymlink", "sends", "a", "symlink", "into", "the", "tar", "stream", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L358-L365
test
containers/image
docker/tarfile/dest.go
sendBytes
func (d *Destination) sendBytes(path string, b []byte) error { return d.sendFile(path, int64(len(b)), bytes.NewReader(b)) }
go
func (d *Destination) sendBytes(path string, b []byte) error { return d.sendFile(path, int64(len(b)), bytes.NewReader(b)) }
[ "func", "(", "d", "*", "Destination", ")", "sendBytes", "(", "path", "string", ",", "b", "[", "]", "byte", ")", "error", "{", "return", "d", ".", "sendFile", "(", "path", ",", "int64", "(", "len", "(", "b", ")", ")", ",", "bytes", ".", "NewReader...
// sendBytes sends a path into the tar stream.
[ "sendBytes", "sends", "a", "path", "into", "the", "tar", "stream", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L368-L370
test
containers/image
docker/tarfile/dest.go
sendFile
func (d *Destination) sendFile(path string, expectedSize int64, stream io.Reader) error { hdr, err := tar.FileInfoHeader(&tarFI{path: path, size: expectedSize}, "") if err != nil { return nil } logrus.Debugf("Sending as tar file %s", path) if err := d.tar.WriteHeader(hdr); err != nil { return err } // TODO: ...
go
func (d *Destination) sendFile(path string, expectedSize int64, stream io.Reader) error { hdr, err := tar.FileInfoHeader(&tarFI{path: path, size: expectedSize}, "") if err != nil { return nil } logrus.Debugf("Sending as tar file %s", path) if err := d.tar.WriteHeader(hdr); err != nil { return err } // TODO: ...
[ "func", "(", "d", "*", "Destination", ")", "sendFile", "(", "path", "string", ",", "expectedSize", "int64", ",", "stream", "io", ".", "Reader", ")", "error", "{", "hdr", ",", "err", ":=", "tar", ".", "FileInfoHeader", "(", "&", "tarFI", "{", "path", ...
// sendFile sends a file into the tar stream.
[ "sendFile", "sends", "a", "file", "into", "the", "tar", "stream", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L373-L391
test
containers/image
docker/tarfile/dest.go
Commit
func (d *Destination) Commit(ctx context.Context) error { return d.tar.Close() }
go
func (d *Destination) Commit(ctx context.Context) error { return d.tar.Close() }
[ "func", "(", "d", "*", "Destination", ")", "Commit", "(", "ctx", "context", ".", "Context", ")", "error", "{", "return", "d", ".", "tar", ".", "Close", "(", ")", "\n", "}" ]
// Commit finishes writing data to the underlying io.Writer. // It is the caller's responsibility to close it, if necessary.
[ "Commit", "finishes", "writing", "data", "to", "the", "underlying", "io", ".", "Writer", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "close", "it", "if", "necessary", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/dest.go#L405-L407
test
containers/image
storage/storage_reference.go
imageMatchesRepo
func imageMatchesRepo(image *storage.Image, ref reference.Named) bool { repo := ref.Name() for _, name := range image.Names { if named, err := reference.ParseNormalizedNamed(name); err == nil { if named.Name() == repo { return true } } } return false }
go
func imageMatchesRepo(image *storage.Image, ref reference.Named) bool { repo := ref.Name() for _, name := range image.Names { if named, err := reference.ParseNormalizedNamed(name); err == nil { if named.Name() == repo { return true } } } return false }
[ "func", "imageMatchesRepo", "(", "image", "*", "storage", ".", "Image", ",", "ref", "reference", ".", "Named", ")", "bool", "{", "repo", ":=", "ref", ".", "Name", "(", ")", "\n", "for", "_", ",", "name", ":=", "range", "image", ".", "Names", "{", "...
// imageMatchesRepo returns true iff image.Names contains an element with the same repo as ref
[ "imageMatchesRepo", "returns", "true", "iff", "image", ".", "Names", "contains", "an", "element", "with", "the", "same", "repo", "as", "ref" ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_reference.go#L42-L52
test
containers/image
storage/storage_reference.go
resolveImage
func (s *storageReference) resolveImage() (*storage.Image, error) { var loadedImage *storage.Image if s.id == "" && s.named != nil { // Look for an image that has the expanded reference name as an explicit Name value. image, err := s.transport.store.Image(s.named.String()) if image != nil && err == nil { loa...
go
func (s *storageReference) resolveImage() (*storage.Image, error) { var loadedImage *storage.Image if s.id == "" && s.named != nil { // Look for an image that has the expanded reference name as an explicit Name value. image, err := s.transport.store.Image(s.named.String()) if image != nil && err == nil { loa...
[ "func", "(", "s", "*", "storageReference", ")", "resolveImage", "(", ")", "(", "*", "storage", ".", "Image", ",", "error", ")", "{", "var", "loadedImage", "*", "storage", ".", "Image", "\n", "if", "s", ".", "id", "==", "\"\"", "&&", "s", ".", "name...
// Resolve the reference's name to an image ID in the store, if there's already // one present with the same name or ID, and return the image.
[ "Resolve", "the", "reference", "s", "name", "to", "an", "image", "ID", "in", "the", "store", "if", "there", "s", "already", "one", "present", "with", "the", "same", "name", "or", "ID", "and", "return", "the", "image", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_reference.go#L56-L119
test
containers/image
storage/storage_reference.go
Transport
func (s storageReference) Transport() types.ImageTransport { return &storageTransport{ store: s.transport.store, defaultUIDMap: s.transport.defaultUIDMap, defaultGIDMap: s.transport.defaultGIDMap, } }
go
func (s storageReference) Transport() types.ImageTransport { return &storageTransport{ store: s.transport.store, defaultUIDMap: s.transport.defaultUIDMap, defaultGIDMap: s.transport.defaultGIDMap, } }
[ "func", "(", "s", "storageReference", ")", "Transport", "(", ")", "types", ".", "ImageTransport", "{", "return", "&", "storageTransport", "{", "store", ":", "s", ".", "transport", ".", "store", ",", "defaultUIDMap", ":", "s", ".", "transport", ".", "defaul...
// Return a Transport object that defaults to using the same store that we used // to build this reference object.
[ "Return", "a", "Transport", "object", "that", "defaults", "to", "using", "the", "same", "store", "that", "we", "used", "to", "build", "this", "reference", "object", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_reference.go#L123-L129
test
containers/image
storage/storage_reference.go
StringWithinTransport
func (s storageReference) StringWithinTransport() string { optionsList := "" options := s.transport.store.GraphOptions() if len(options) > 0 { optionsList = ":" + strings.Join(options, ",") } res := "[" + s.transport.store.GraphDriverName() + "@" + s.transport.store.GraphRoot() + "+" + s.transport.store.RunRoot(...
go
func (s storageReference) StringWithinTransport() string { optionsList := "" options := s.transport.store.GraphOptions() if len(options) > 0 { optionsList = ":" + strings.Join(options, ",") } res := "[" + s.transport.store.GraphDriverName() + "@" + s.transport.store.GraphRoot() + "+" + s.transport.store.RunRoot(...
[ "func", "(", "s", "storageReference", ")", "StringWithinTransport", "(", ")", "string", "{", "optionsList", ":=", "\"\"", "\n", "options", ":=", "s", ".", "transport", ".", "store", ".", "GraphOptions", "(", ")", "\n", "if", "len", "(", "options", ")", "...
// Return a name with a tag, prefixed with the graph root and driver name, to // disambiguate between images which may be present in multiple stores and // share only their names.
[ "Return", "a", "name", "with", "a", "tag", "prefixed", "with", "the", "graph", "root", "and", "driver", "name", "to", "disambiguate", "between", "images", "which", "may", "be", "present", "in", "multiple", "stores", "and", "share", "only", "their", "names", ...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_reference.go#L139-L153
test
containers/image
storage/storage_reference.go
PolicyConfigurationNamespaces
func (s storageReference) PolicyConfigurationNamespaces() []string { storeSpec := "[" + s.transport.store.GraphDriverName() + "@" + s.transport.store.GraphRoot() + "]" driverlessStoreSpec := "[" + s.transport.store.GraphRoot() + "]" namespaces := []string{} if s.named != nil { if s.id != "" { // The reference ...
go
func (s storageReference) PolicyConfigurationNamespaces() []string { storeSpec := "[" + s.transport.store.GraphDriverName() + "@" + s.transport.store.GraphRoot() + "]" driverlessStoreSpec := "[" + s.transport.store.GraphRoot() + "]" namespaces := []string{} if s.named != nil { if s.id != "" { // The reference ...
[ "func", "(", "s", "storageReference", ")", "PolicyConfigurationNamespaces", "(", ")", "[", "]", "string", "{", "storeSpec", ":=", "\"[\"", "+", "s", ".", "transport", ".", "store", ".", "GraphDriverName", "(", ")", "+", "\"@\"", "+", "s", ".", "transport",...
// Also accept policy that's tied to the combination of the graph root and // driver name, to apply to all images stored in the Store, and to just the // graph root, in case we're using multiple drivers in the same directory for // some reason.
[ "Also", "accept", "policy", "that", "s", "tied", "to", "the", "combination", "of", "the", "graph", "root", "and", "driver", "name", "to", "apply", "to", "all", "images", "stored", "in", "the", "Store", "and", "to", "just", "the", "graph", "root", "in", ...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_reference.go#L170-L193
test
containers/image
pkg/compression/compression.go
GzipDecompressor
func GzipDecompressor(r io.Reader) (io.ReadCloser, error) { return pgzip.NewReader(r) }
go
func GzipDecompressor(r io.Reader) (io.ReadCloser, error) { return pgzip.NewReader(r) }
[ "func", "GzipDecompressor", "(", "r", "io", ".", "Reader", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "return", "pgzip", ".", "NewReader", "(", "r", ")", "\n", "}" ]
// GzipDecompressor is a DecompressorFunc for the gzip compression algorithm.
[ "GzipDecompressor", "is", "a", "DecompressorFunc", "for", "the", "gzip", "compression", "algorithm", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/compression/compression.go#L20-L22
test
containers/image
pkg/compression/compression.go
Bzip2Decompressor
func Bzip2Decompressor(r io.Reader) (io.ReadCloser, error) { return ioutil.NopCloser(bzip2.NewReader(r)), nil }
go
func Bzip2Decompressor(r io.Reader) (io.ReadCloser, error) { return ioutil.NopCloser(bzip2.NewReader(r)), nil }
[ "func", "Bzip2Decompressor", "(", "r", "io", ".", "Reader", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "return", "ioutil", ".", "NopCloser", "(", "bzip2", ".", "NewReader", "(", "r", ")", ")", ",", "nil", "\n", "}" ]
// Bzip2Decompressor is a DecompressorFunc for the bzip2 compression algorithm.
[ "Bzip2Decompressor", "is", "a", "DecompressorFunc", "for", "the", "bzip2", "compression", "algorithm", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/compression/compression.go#L25-L27
test
containers/image
pkg/compression/compression.go
XzDecompressor
func XzDecompressor(r io.Reader) (io.ReadCloser, error) { r, err := xz.NewReader(r) if err != nil { return nil, err } return ioutil.NopCloser(r), nil }
go
func XzDecompressor(r io.Reader) (io.ReadCloser, error) { r, err := xz.NewReader(r) if err != nil { return nil, err } return ioutil.NopCloser(r), nil }
[ "func", "XzDecompressor", "(", "r", "io", ".", "Reader", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "r", ",", "err", ":=", "xz", ".", "NewReader", "(", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", ...
// XzDecompressor is a DecompressorFunc for the xz compression algorithm.
[ "XzDecompressor", "is", "a", "DecompressorFunc", "for", "the", "xz", "compression", "algorithm", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/compression/compression.go#L30-L36
test
containers/image
pkg/compression/compression.go
DetectCompression
func DetectCompression(input io.Reader) (DecompressorFunc, io.Reader, error) { buffer := [8]byte{} n, err := io.ReadAtLeast(input, buffer[:], len(buffer)) if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF { // This is a “real” error. We could just ignore it this time, process the data we have, and hope...
go
func DetectCompression(input io.Reader) (DecompressorFunc, io.Reader, error) { buffer := [8]byte{} n, err := io.ReadAtLeast(input, buffer[:], len(buffer)) if err != nil && err != io.EOF && err != io.ErrUnexpectedEOF { // This is a “real” error. We could just ignore it this time, process the data we have, and hope...
[ "func", "DetectCompression", "(", "input", "io", ".", "Reader", ")", "(", "DecompressorFunc", ",", "io", ".", "Reader", ",", "error", ")", "{", "buffer", ":=", "[", "8", "]", "byte", "{", "}", "\n", "n", ",", "err", ":=", "io", ".", "ReadAtLeast", ...
// DetectCompression returns a DecompressorFunc if the input is recognized as a compressed format, nil otherwise. // Because it consumes the start of input, other consumers must use the returned io.Reader instead to also read from the beginning.
[ "DetectCompression", "returns", "a", "DecompressorFunc", "if", "the", "input", "is", "recognized", "as", "a", "compressed", "format", "nil", "otherwise", ".", "Because", "it", "consumes", "the", "start", "of", "input", "other", "consumers", "must", "use", "the",...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/compression/compression.go#L50-L73
test
containers/image
docker/docker_image_dest.go
newImageDestination
func newImageDestination(sys *types.SystemContext, ref dockerReference) (types.ImageDestination, error) { c, err := newDockerClientFromRef(sys, ref, true, "pull,push") if err != nil { return nil, err } return &dockerImageDestination{ ref: ref, c: c, }, nil }
go
func newImageDestination(sys *types.SystemContext, ref dockerReference) (types.ImageDestination, error) { c, err := newDockerClientFromRef(sys, ref, true, "pull,push") if err != nil { return nil, err } return &dockerImageDestination{ ref: ref, c: c, }, nil }
[ "func", "newImageDestination", "(", "sys", "*", "types", ".", "SystemContext", ",", "ref", "dockerReference", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "c", ",", "err", ":=", "newDockerClientFromRef", "(", "sys", ",", "ref", ",", ...
// newImageDestination creates a new ImageDestination for the specified image reference.
[ "newImageDestination", "creates", "a", "new", "ImageDestination", "for", "the", "specified", "image", "reference", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/docker_image_dest.go#L38-L47
test
containers/image
docker/docker_image_dest.go
mountBlob
func (d *dockerImageDestination) mountBlob(ctx context.Context, srcRepo reference.Named, srcDigest digest.Digest, extraScope *authScope) error { u := url.URL{ Path: fmt.Sprintf(blobUploadPath, reference.Path(d.ref.ref)), RawQuery: url.Values{ "mount": {srcDigest.String()}, "from": {reference.Path(srcRepo)},...
go
func (d *dockerImageDestination) mountBlob(ctx context.Context, srcRepo reference.Named, srcDigest digest.Digest, extraScope *authScope) error { u := url.URL{ Path: fmt.Sprintf(blobUploadPath, reference.Path(d.ref.ref)), RawQuery: url.Values{ "mount": {srcDigest.String()}, "from": {reference.Path(srcRepo)},...
[ "func", "(", "d", "*", "dockerImageDestination", ")", "mountBlob", "(", "ctx", "context", ".", "Context", ",", "srcRepo", "reference", ".", "Named", ",", "srcDigest", "digest", ".", "Digest", ",", "extraScope", "*", "authScope", ")", "error", "{", "u", ":=...
// mountBlob tries to mount blob srcDigest from srcRepo to the current destination.
[ "mountBlob", "tries", "to", "mount", "blob", "srcDigest", "from", "srcRepo", "to", "the", "current", "destination", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/docker_image_dest.go#L222-L265
test
containers/image
docker/cache.go
bicTransportScope
func bicTransportScope(ref dockerReference) types.BICTransportScope { // Blobs can be reused across the whole registry. return types.BICTransportScope{Opaque: reference.Domain(ref.ref)} }
go
func bicTransportScope(ref dockerReference) types.BICTransportScope { // Blobs can be reused across the whole registry. return types.BICTransportScope{Opaque: reference.Domain(ref.ref)} }
[ "func", "bicTransportScope", "(", "ref", "dockerReference", ")", "types", ".", "BICTransportScope", "{", "return", "types", ".", "BICTransportScope", "{", "Opaque", ":", "reference", ".", "Domain", "(", "ref", ".", "ref", ")", "}", "\n", "}" ]
// bicTransportScope returns a BICTransportScope appropriate for ref.
[ "bicTransportScope", "returns", "a", "BICTransportScope", "appropriate", "for", "ref", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/cache.go#L9-L12
test
containers/image
docker/cache.go
newBICLocationReference
func newBICLocationReference(ref dockerReference) types.BICLocationReference { // Blobs are scoped to repositories (the tag/digest are not necessary to reuse a blob). return types.BICLocationReference{Opaque: ref.ref.Name()} }
go
func newBICLocationReference(ref dockerReference) types.BICLocationReference { // Blobs are scoped to repositories (the tag/digest are not necessary to reuse a blob). return types.BICLocationReference{Opaque: ref.ref.Name()} }
[ "func", "newBICLocationReference", "(", "ref", "dockerReference", ")", "types", ".", "BICLocationReference", "{", "return", "types", ".", "BICLocationReference", "{", "Opaque", ":", "ref", ".", "ref", ".", "Name", "(", ")", "}", "\n", "}" ]
// newBICLocationReference returns a BICLocationReference appropriate for ref.
[ "newBICLocationReference", "returns", "a", "BICLocationReference", "appropriate", "for", "ref", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/cache.go#L15-L18
test
containers/image
docker/cache.go
parseBICLocationReference
func parseBICLocationReference(lr types.BICLocationReference) (reference.Named, error) { return reference.ParseNormalizedNamed(lr.Opaque) }
go
func parseBICLocationReference(lr types.BICLocationReference) (reference.Named, error) { return reference.ParseNormalizedNamed(lr.Opaque) }
[ "func", "parseBICLocationReference", "(", "lr", "types", ".", "BICLocationReference", ")", "(", "reference", ".", "Named", ",", "error", ")", "{", "return", "reference", ".", "ParseNormalizedNamed", "(", "lr", ".", "Opaque", ")", "\n", "}" ]
// parseBICLocationReference returns a repository for encoded lr.
[ "parseBICLocationReference", "returns", "a", "repository", "for", "encoded", "lr", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/cache.go#L21-L23
test
containers/image
docker/tarfile/src.go
NewSourceFromStream
func NewSourceFromStream(inputStream io.Reader) (*Source, error) { // FIXME: use SystemContext here. // Save inputStream to a temporary file tarCopyFile, err := ioutil.TempFile(tmpdir.TemporaryDirectoryForBigFiles(), "docker-tar") if err != nil { return nil, errors.Wrap(err, "error creating temporary file") } d...
go
func NewSourceFromStream(inputStream io.Reader) (*Source, error) { // FIXME: use SystemContext here. // Save inputStream to a temporary file tarCopyFile, err := ioutil.TempFile(tmpdir.TemporaryDirectoryForBigFiles(), "docker-tar") if err != nil { return nil, errors.Wrap(err, "error creating temporary file") } d...
[ "func", "NewSourceFromStream", "(", "inputStream", "io", ".", "Reader", ")", "(", "*", "Source", ",", "error", ")", "{", "tarCopyFile", ",", "err", ":=", "ioutil", ".", "TempFile", "(", "tmpdir", ".", "TemporaryDirectoryForBigFiles", "(", ")", ",", "\"docker...
// NewSourceFromStream returns a tarfile.Source for the specified inputStream, // which can be either compressed or uncompressed. The caller can close the // inputStream immediately after NewSourceFromFile returns.
[ "NewSourceFromStream", "returns", "a", "tarfile", ".", "Source", "for", "the", "specified", "inputStream", "which", "can", "be", "either", "compressed", "or", "uncompressed", ".", "The", "caller", "can", "close", "the", "inputStream", "immediately", "after", "NewS...
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/src.go#L74-L112
test
containers/image
docker/tarfile/src.go
readTarComponent
func (s *Source) readTarComponent(path string) ([]byte, error) { file, err := s.openTarComponent(path) if err != nil { return nil, errors.Wrapf(err, "Error loading tar component %s", path) } defer file.Close() bytes, err := ioutil.ReadAll(file) if err != nil { return nil, err } return bytes, nil }
go
func (s *Source) readTarComponent(path string) ([]byte, error) { file, err := s.openTarComponent(path) if err != nil { return nil, errors.Wrapf(err, "Error loading tar component %s", path) } defer file.Close() bytes, err := ioutil.ReadAll(file) if err != nil { return nil, err } return bytes, nil }
[ "func", "(", "s", "*", "Source", ")", "readTarComponent", "(", "path", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "file", ",", "err", ":=", "s", ".", "openTarComponent", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "r...
// readTarComponent returns full contents of componentPath.
[ "readTarComponent", "returns", "full", "contents", "of", "componentPath", "." ]
da9ab3561ad2031aeb5e036b7cf2755d4e246fec
https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/src.go#L190-L201
test