Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBlobDigestMismatch could potentially be returned when PutBlob() is given a blob // with a digest-based name that doesn't match its contents. // Deprecated: PutBlob() doesn't do this any more (it just accepts the caller’s value), // and there is no known user of this error. ErrBlobDigestMismatch = errors.New("blob digest mismatch") // ErrBlobSizeMismatch is returned when PutBlob() is given a blob // with an expected size that doesn't match the reader. ErrBlobSizeMismatch = errors.New("blob size mismatch") )
var ( // Transport is an ImageTransport that uses either a default // storage.Store or one that's it's explicitly told to use. Transport StoreTransport = &storageTransport{} // ErrInvalidReference is returned when ParseReference() is passed an // empty reference. ErrInvalidReference = errors.New("invalid reference") // ErrPathNotAbsolute is returned when a graph root is not an absolute // path name. ErrPathNotAbsolute = errors.New("path name is not absolute") )
var ( // ErrNoSuchImage is returned when we attempt to access an image which // doesn't exist in the storage area. ErrNoSuchImage = storage.ErrNotAnImage )
Functions ¶
func ResolveReference ¶ added in v5.29.0
func ResolveReference(ref types.ImageReference) (types.ImageReference, *storage.Image, error)
ResolveReference finds the underlying storage image for a storage.Transport reference. It returns that image, and an updated reference which can be used to refer back to the _same_ image again.
This matters if the input reference contains a tagged name; the destination of the tag can move in local storage. The updated reference returned by this function contains the resolved image ID, so later uses of that updated reference will either continue to refer to the same image, or fail.
Note that it _is_ possible for the later uses to fail, either because the image was removed completely, or because the name used in the reference was untaged (even if the underlying image ID still exists in local storage).
Returns an error matching ErrNoSuchImage if an image matching ref was not found.
Types ¶
type StoreTransport ¶
type StoreTransport interface { types.ImageTransport // SetStore sets the default store for this transport. SetStore(storage.Store) // GetStoreIfSet returns the default store for this transport, or nil if not set/determined yet. GetStoreIfSet() storage.Store // GetImage retrieves the image from the transport's store that's named // by the reference. // Deprecated: Surprisingly, with a StoreTransport reference which contains an ID, // this ignores that ID; and repeated calls of GetStoreImage with the same named reference // can return different images, with no way for the caller to "freeze" the storage.Image identity // without discarding the name entirely. // // Use storage.ResolveReference instead; note that if the image is not found, ResolveReference returns // c/image/v5/storage.ErrNoSuchImage, not c/storage.ErrImageUnknown. GetImage(types.ImageReference) (*storage.Image, error) // GetStoreImage retrieves the image from a specified store that's named // by the reference. // // Deprecated: Surprisingly, with a StoreTransport reference which contains an ID, // this ignores that ID; and repeated calls of GetStoreImage with the same named reference // can return different images, with no way for the caller to "freeze" the storage.Image identity // without discarding the name entirely. // // Also, a StoreTransport reference already contains a store, so providing another one is redundant. // // Use storage.ResolveReference instead; note that if the image is not found, ResolveReference returns // c/image/v5/storage.ErrNoSuchImage, not c/storage.ErrImageUnknown. GetStoreImage(storage.Store, types.ImageReference) (*storage.Image, error) // ParseStoreReference parses a reference, overriding any store // specification that it may contain. ParseStoreReference(store storage.Store, reference string) (*storageReference, error) // NewStoreReference creates a reference for (named@ID) in store. // either of name or ID can be unset; named must not be a reference.IsNameOnly. NewStoreReference(store storage.Store, named reference.Named, id string) (*storageReference, error) // SetDefaultUIDMap sets the default UID map to use when opening stores. SetDefaultUIDMap(idmap []idtools.IDMap) // SetDefaultGIDMap sets the default GID map to use when opening stores. SetDefaultGIDMap(idmap []idtools.IDMap) // DefaultUIDMap returns the default UID map used when opening stores. DefaultUIDMap() []idtools.IDMap // DefaultGIDMap returns the default GID map used when opening stores. DefaultGIDMap() []idtools.IDMap }
StoreTransport is an ImageTransport that uses a storage.Store to parse references, either its own default or one that it's told to use.