-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
127 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package local | ||
Check failure on line 1 in pkg/v1/local/layer.go GitHub Actions / Go headers[Go headers] pkg/v1/local/layer.go#L1
Raw output
|
||
|
||
import ( | ||
"io" | ||
|
||
v1 "github.com/google/go-containerregistry/pkg/v1" | ||
"github.com/google/go-containerregistry/pkg/v1/layout" | ||
"github.com/google/go-containerregistry/pkg/v1/partial" | ||
"github.com/google/go-containerregistry/pkg/v1/types" | ||
) | ||
|
||
// remoteImagelayer implements partial.CompressedLayer | ||
type localLayer struct { | ||
path layout.Path | ||
digest v1.Hash | ||
} | ||
|
||
// Compressed implements partial.CompressedLayer. | ||
func (lp *localLayer) Compressed() (io.ReadCloser, error) { | ||
return lp.path.Blob(lp.digest) | ||
} | ||
|
||
// Digest implements partial.CompressedLayer. | ||
func (lp *localLayer) Digest() (v1.Hash, error) { | ||
return lp.digest, nil | ||
} | ||
|
||
// MediaType implements partial.CompressedLayer. | ||
func (*localLayer) MediaType() (types.MediaType, error) { | ||
// TODO | ||
return types.DockerLayer, nil | ||
} | ||
|
||
// Size implements partial.CompressedLayer. | ||
func (rl *localLayer) Size() (int64, error) { | ||
return rl.path.BlobSize(rl.digest) | ||
} | ||
|
||
// See partial.Exists. | ||
func (rl *localLayer) Exists() (bool, error) { | ||
return rl.path.BlobExists(rl.digest), nil | ||
} | ||
|
||
var _ partial.CompressedLayer = (*localLayer)(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