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>
This commit is contained in:
parent
f5db4b01c0
commit
f9a1846ca2
2 changed files with 6 additions and 8 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue