Skip to content

Commit

Permalink
*: use narrower content interfaces
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Feb 9, 2018
1 parent ee6ffdd commit ee70879
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion container_opts_unix.go
Expand Up @@ -115,7 +115,7 @@ func WithTaskCheckpoint(im Image) NewTaskOpts {
}
}

func decodeIndex(ctx context.Context, store content.Store, id digest.Digest) (*v1.Index, error) {
func decodeIndex(ctx context.Context, store content.Provider, id digest.Digest) (*v1.Index, error) {
var index v1.Index
p, err := content.ReadBlob(ctx, store, id)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions diff/apply/apply.go
Expand Up @@ -22,14 +22,14 @@ import (

// NewFileSystemApplier returns an applier which simply mounts
// and applies diff onto the mounted filesystem.
func NewFileSystemApplier(cs content.Store) diff.Applier {
func NewFileSystemApplier(cs content.Provider) diff.Applier {
return &fsApplier{
store: cs,
}
}

type fsApplier struct {
store content.Store
store content.Provider
}

var emptyDesc = ocispec.Descriptor{}
Expand Down
2 changes: 1 addition & 1 deletion images/importexport.go
Expand Up @@ -17,5 +17,5 @@ type Importer interface {
// Exporter is the interface for image exporter.
type Exporter interface {
// Export exports an image to a tar stream.
Export(ctx context.Context, store content.Store, desc ocispec.Descriptor, writer io.Writer) error
Export(ctx context.Context, store content.Provider, desc ocispec.Descriptor, writer io.Writer) error
}
4 changes: 2 additions & 2 deletions images/oci/exporter.go
Expand Up @@ -25,7 +25,7 @@ type V1Exporter struct {
}

// Export implements Exporter.
func (oe *V1Exporter) Export(ctx context.Context, store content.Store, desc ocispec.Descriptor, writer io.Writer) error {
func (oe *V1Exporter) Export(ctx context.Context, store content.Provider, desc ocispec.Descriptor, writer io.Writer) error {
tw := tar.NewWriter(writer)
defer tw.Close()

Expand Down Expand Up @@ -67,7 +67,7 @@ type tarRecord struct {
CopyTo func(context.Context, io.Writer) (int64, error)
}

func blobRecord(cs content.Store, desc ocispec.Descriptor) tarRecord {
func blobRecord(cs content.Provider, desc ocispec.Descriptor) tarRecord {
path := "blobs/" + desc.Digest.Algorithm().String() + "/" + desc.Digest.Hex()
return tarRecord{
Header: &tar.Header{
Expand Down
2 changes: 1 addition & 1 deletion images/oci/importer.go
Expand Up @@ -113,7 +113,7 @@ func normalizeImageRef(imageName string, manifest ocispec.Descriptor) (string, e
return imageName + ":" + ociRef, nil
}

func onUntarBlob(ctx context.Context, r io.Reader, store content.Store, name string, size int64) error {
func onUntarBlob(ctx context.Context, r io.Reader, store content.Ingester, name string, size int64) error {
// name is like "blobs/sha256/deadbeef"
split := strings.Split(name, "/")
if len(split) != 3 {
Expand Down
2 changes: 1 addition & 1 deletion task.go
Expand Up @@ -572,7 +572,7 @@ func (t *task) writeIndex(ctx context.Context, index *v1.Index) (d v1.Descriptor
return writeContent(ctx, t.client.ContentStore(), v1.MediaTypeImageIndex, t.id, buf, content.WithLabels(labels))
}

func writeContent(ctx context.Context, store content.Store, mediaType, ref string, r io.Reader, opts ...content.Opt) (d v1.Descriptor, err error) {
func writeContent(ctx context.Context, store content.Ingester, mediaType, ref string, r io.Reader, opts ...content.Opt) (d v1.Descriptor, err error) {
writer, err := store.Writer(ctx, ref, 0, "")
if err != nil {
return d, err
Expand Down

0 comments on commit ee70879

Please sign in to comment.