aboutsummaryrefslogtreecommitdiff
path: root/distribution
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2022-01-24 16:34:56 +0100
committerSebastiaan van Stijn <github@gone.nl>2022-01-24 18:45:51 +0100
commitf9a1846ca23f462b0e5d7e8f111c7ab322c53b44 (patch)
treeb6604278972bf25c22309d0d72035c04d8a627e6 /distribution
parentf5db4b01c097b02e787a9760d6da6ba7af58e061 (diff)
distribution: PushLayer.Size(): remove unused error return
None of the implementations returned an error for this function, so removing it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'distribution')
-rw-r--r--distribution/config.go6
-rw-r--r--distribution/push_v2.go8
2 files changed, 6 insertions, 8 deletions
diff --git a/distribution/config.go b/distribution/config.go
index 43cb674a87..3cd2f190ff 100644
--- a/distribution/config.go
+++ b/distribution/config.go
@@ -102,7 +102,7 @@ type PushLayer interface {
DiffID() layer.DiffID
Parent() PushLayer
Open() (io.ReadCloser, error)
- Size() (int64, error)
+ Size() int64
MediaType() string
Release()
}
@@ -229,8 +229,8 @@ func (l *storeLayer) Open() (io.ReadCloser, error) {
return l.Layer.TarStream()
}
-func (l *storeLayer) Size() (int64, error) {
- return l.Layer.DiffSize(), nil
+func (l *storeLayer) Size() int64 {
+ return l.Layer.DiffSize()
}
func (l *storeLayer) MediaType() string {
diff --git a/distribution/push_v2.go b/distribution/push_v2.go
index 60171de773..4a58527c8b 100644
--- a/distribution/push_v2.go
+++ b/distribution/push_v2.go
@@ -451,9 +451,7 @@ func (pd *v2PushDescriptor) uploadUsingSession(
return distribution.Descriptor{}, retryOnError(err)
}
- size, _ := pd.layer.Size()
-
- reader = progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, contentReader), progressOutput, size, pd.ID(), "Pushing")
+ reader = progress.NewProgressReader(ioutils.NewCancelReadCloser(ctx, contentReader), progressOutput, pd.layer.Size(), pd.ID(), "Pushing")
switch m := pd.layer.MediaType(); m {
case schema2.MediaTypeUncompressedLayer:
@@ -596,7 +594,7 @@ attempts:
// decision is based on layer size. The smaller the layer, the fewer attempts shall be made because the cost
// of upload does not outweigh a latency.
func getMaxMountAndExistenceCheckAttempts(layer PushLayer) (maxMountAttempts, maxExistenceCheckAttempts int, checkOtherRepositories bool) {
- size, err := layer.Size()
+ size := layer.Size()
switch {
// big blob
case size > middleLayerMaximumSize:
@@ -606,7 +604,7 @@ func getMaxMountAndExistenceCheckAttempts(layer PushLayer) (maxMountAttempts, ma
return 4, 3, true
// middle sized blobs; if we could not get the size, assume we deal with middle sized blob
- case size > smallLayerMaximumSize, err != nil:
+ case size > smallLayerMaximumSize:
// 1st attempt to mount blobs of average size few times
// 2nd try at most 1 existence check if there's an existing mapping to the target repository
// then fallback to upload