oci/layout/oci_src.go
func (s *ociImageSource) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error) {
	if len(info.URLs) != 0 {
		return s.getExternalBlob(ctx, info.URLs)
	}

	path, err := s.ref.blobPath(info.Digest, s.sharedBlobDir)
	if err != nil {
		return nil, 0, err
	}

	r, err := os.Open(path)
	if err != nil {
		return nil, 0, err
	}
	fi, err := r.Stat()
	if err != nil {
		return nil, 0, err
	}
	return r, fi.Size(), nil
}
func (s *ociImageSource) GetBlob(ctx context.Context, info types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error) {
	if len(info.URLs) != 0 {
		return s.getExternalBlob(ctx, info.URLs)
	}

	path, err := s.ref.blobPath(info.Digest, s.sharedBlobDir)
	if err != nil {
		return nil, 0, err
	}

	r, err := os.Open(path)
	if err != nil {
		return nil, 0, err
	}
	fi, err := r.Stat()
	if err != nil {
		return nil, 0, err
	}
	return r, fi.Size(), nil
}
func ( s * ociImageSource ) GetBlob ( ctx context . Context , info types . BlobInfo , cache types . BlobInfoCache ) ( io . ReadCloser , int64 , error ) { if len ( info . URLs ) != 0 { return s . getExternalBlob ( ctx , info . URLs ) } path , err := s . ref . blobPath ( info . Digest , s . sharedBlobDir ) if err != nil { return nil , 0 , err } r , err := os . Open ( path ) if err != nil { return nil , 0 , err } fi , err := r . Stat ( ) if err != nil { return nil , 0 , err } return r , fi . Size ( ) , nil }
// GetBlob returns a stream for the specified blob, and the blob’s size (or -1 if unknown).
// The Digest field in BlobInfo is guaranteed to be provided, Size may be -1 and MediaType may be optionally provided.
// May update BlobInfoCache, preferably after it knows for certain that a blob truly exists at a specific location.
GetBlob returns a stream for the specified blob and the blob’s size ( or - 1 if unknown ) . The Digest field in BlobInfo is guaranteed to be provided Size may be - 1 and MediaType may be optionally provided . May update BlobInfoCache preferably after it knows for certain that a blob truly exists at a specific location .