Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1590 from mtrmac/private-src-impls
Implement private.ImageSource in all transports, improve transport helpers
- Loading branch information
Showing
36 changed files
with
2,029 additions
and
1,814 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package archive | ||
|
||
import "github.com/containers/image/v5/internal/private" | ||
|
||
var _ private.ImageSource = (*archiveImageSource)(nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package daemon | ||
|
||
import "github.com/containers/image/v5/internal/private" | ||
|
||
var _ private.ImageSource = (*daemonImageSource)(nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package impl | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/containers/image/v5/types" | ||
"github.com/opencontainers/go-digest" | ||
) | ||
|
||
// DoesNotAffectLayerInfosForCopy implements LayerInfosForCopy() that returns nothing. | ||
type DoesNotAffectLayerInfosForCopy struct{} | ||
|
||
// LayerInfosForCopy returns either nil (meaning the values in the manifest are fine), or updated values for the layer | ||
// blobsums that are listed in the image's manifest. If values are returned, they should be used when using GetBlob() | ||
// to read the image's layers. | ||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve BlobInfos for | ||
// (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list | ||
// (e.g. if the source never returns manifest lists). | ||
// The Digest field is guaranteed to be provided; Size may be -1. | ||
// WARNING: The list may contain duplicates, and they are semantically relevant. | ||
func (stub DoesNotAffectLayerInfosForCopy) LayerInfosForCopy(ctx context.Context, instanceDigest *digest.Digest) ([]types.BlobInfo, error) { | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package impl | ||
|
||
// Properties collects properties of an ImageSource that are constant throughout its lifetime | ||
// (but might differ across instances). | ||
type Properties struct { | ||
// HasThreadSafeGetBlob indicates whether GetBlob can be executed concurrently. | ||
HasThreadSafeGetBlob bool | ||
} | ||
|
||
// PropertyMethodsInitialize implements parts of private.ImageSource corresponding to Properties. | ||
type PropertyMethodsInitialize struct { | ||
// We need two separate structs, PropertyMethodsInitialize and Properties, because Go prohibits fields and methods with the same name. | ||
|
||
vals Properties | ||
} | ||
|
||
// PropertyMethods creates an PropertyMethodsInitialize for vals. | ||
func PropertyMethods(vals Properties) PropertyMethodsInitialize { | ||
return PropertyMethodsInitialize{ | ||
vals: vals, | ||
} | ||
} | ||
|
||
// HasThreadSafeGetBlob indicates whether GetBlob can be executed concurrently. | ||
func (o PropertyMethodsInitialize) HasThreadSafeGetBlob() bool { | ||
return o.vals.HasThreadSafeGetBlob | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package impl | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/opencontainers/go-digest" | ||
) | ||
|
||
// NoSignatures implements GetSignatures() that returns nothing. | ||
type NoSignatures struct{} | ||
|
||
// GetSignatures returns the image's signatures. It may use a remote (= slow) service. | ||
// If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve signatures for | ||
// (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list | ||
// (e.g. if the source never returns manifest lists). | ||
func (stub NoSignatures) GetSignatures(ctx context.Context, instanceDigest *digest.Digest) ([][]byte, error) { | ||
return nil, nil | ||
} |
Oops, something went wrong.