Implement the Referrers interface on Artifact

Signed-off-by: Bracken Dawson <abdawson@gmail.com>
This commit is contained in:
Bracken Dawson 2023-02-02 11:01:08 +00:00
parent 608a5708d5
commit cd0c26c33c
No known key found for this signature in database
GPG key ID: 7C6C7FA182101826
2 changed files with 16 additions and 0 deletions

View file

@ -115,3 +115,15 @@ func (m *DeserializedManifest) Payload() (string, []byte, error) {
func (m *DeserializedManifest) References() []distribution.Descriptor {
return m.Blobs
}
// Subject returns a pointer to the subject of this manifest or nil if there is
// none
func (m *DeserializedManifest) Subject() *distribution.Descriptor {
return m.Manifest.Subject
}
// Type returns the artifactType of this manifest if there is one, otherwise it
// returns empty string.
func (m *DeserializedManifest) Type() string {
return m.Manifest.ArtifactType
}

View file

@ -32,6 +32,10 @@ type Referrer interface {
// this manifest refers to or nil if this manifest does not refer to a
// subject.
Subject() *Descriptor
// Type returns the type of the referrer if there is one, otherwise it
// returns empty string
Type() string
}
// ManifestBuilder creates a manifest allowing one to include dependencies.