Skip to content

Commit

Permalink
Merge pull request #1878 from mtrmac/split-copy
Browse files Browse the repository at this point in the history
Split `copy/copy.go` into three files
  • Loading branch information
mtrmac authored Mar 9, 2023
2 parents 7900588 + 1ae83b2 commit bf25105
Show file tree
Hide file tree
Showing 5 changed files with 1,055 additions and 1,013 deletions.
19 changes: 19 additions & 0 deletions copy/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@ import (
"io"

internalblobinfocache "github.com/containers/image/v5/internal/blobinfocache"
"github.com/containers/image/v5/manifest"
"github.com/containers/image/v5/pkg/compression"
compressiontypes "github.com/containers/image/v5/pkg/compression/types"
"github.com/containers/image/v5/types"
imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
"golang.org/x/exp/maps"
)

var (
// defaultCompressionFormat is used if the destination transport requests
// compression, and the user does not explicitly instruct us to use an algorithm.
defaultCompressionFormat = &compression.Gzip

// compressionBufferSize is the buffer size used to compress a blob
compressionBufferSize = 1048576

// expectedCompressionFormats is used to check if a blob with a specified media type is compressed
// using the algorithm that the media type says it should be compressed with
expectedCompressionFormats = map[string]*compressiontypes.Algorithm{
imgspecv1.MediaTypeImageLayerGzip: &compression.Gzip,
imgspecv1.MediaTypeImageLayerZstd: &compression.Zstd,
manifest.DockerV2Schema2LayerMediaType: &compression.Gzip,
}
)

// bpDetectCompressionStepData contains data that the copy pipeline needs about the “detect compression” step.
type bpDetectCompressionStepData struct {
isCompressed bool
Expand Down
Loading

0 comments on commit bf25105

Please sign in to comment.