Documentation ¶
Index ¶
- Constants
- Variables
- func NormalizedImageRef(imgRef string) string
- type Info
- type Reference
- func (r *Reference) AddDigests(digests []string)
- func (r *Reference) AddTags(tags []string)
- func (r *Reference) Digests() []string
- func (r *Reference) MarshalJSON() ([]byte, error)
- func (r *Reference) RemoveDigest(digest string)
- func (r *Reference) RemoveTag(tag string)
- func (r *Reference) String() string
- func (r *Reference) Tags() []string
- func (r *Reference) URI() string
- func (r *Reference) UnmarshalJSON(data []byte) error
Constants ¶
const (
// IDLen reflects number of symbols in image unique ID.
IDLen = 64
)
Variables ¶
var ( // ErrIsUsed notifies that image is currently being used by someone. ErrIsUsed = fmt.Errorf("image is being used") // ErrNotFound notifies that image is not found thus cannot be pulled. ErrNotFound = fmt.Errorf("image is not found") // ErrNotLibrary is used when user tried to get library image metadata but // provided non library image reference. ErrNotLibrary = fmt.Errorf("not library image") )
Functions ¶
func NormalizedImageRef ¶
NormalizedImageRef appends tag 'latest' if the passed ref does not have any tag or digest already. It also trims default docker domain prefix if present.
Types ¶
type Info ¶
type Info struct { ID string `json:"id"` Sha256 string `json:"sha256"` Size uint64 `json:"size"` Path string `json:"path"` Ref *Reference `json:"ref"` OciConfig *specs.ImageConfig `json:"ociConfig,omitempty"` // contains filtered or unexported fields }
Info represents image stored on the host filesystem.
func LibraryInfo ¶
LibraryInfo queries remote library to get info about the image. If image is not found returns ErrNotFound. For references other than library returns ErrNotLibrary.
func Pull ¶
func Pull(ctx context.Context, location string, ref *Reference, auth *k8s.AuthConfig) (*Info, error)
Pull pulls image referenced by ref and saves it to the passed location.
func (*Info) Borrow ¶
Borrow notifies that image is used by some container and should not be removed until Return with the same parameters is called. This method is thread-safe to use.
func (*Info) Matches ¶
func (i *Info) Matches(filter *k8s.ImageFilter) bool
Matches tests image against passed filter and returns true if it matches.
func (*Info) Remove ¶
Remove removes image from the host filesystem. It makes sure no one relies on image file and if this check fails it returns ErrIsUsed error. Local SIF images that were not pulled by CRI are never actually removed.
func (*Info) Return ¶
Return notifies that image is no longer used by a container and may be safely removed if no one else needs it anymore. This method is thread-safe to use.
type Reference ¶
type Reference struct {
// contains filtered or unexported fields
}
Reference holds parsed content of image reference.
func (*Reference) AddDigests ¶
AddDigests adds digests to image reference making sure no duplicates appear.
func (*Reference) MarshalJSON ¶
MarshalJSON marshals Reference into a valid JSON.
func (*Reference) RemoveDigest ¶
RemoveDigest removes digest from reference.
func (*Reference) UnmarshalJSON ¶
UnmarshalJSON unmarshals a valid Reference JSON into an object.