-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for imgutil from recent refactor #267
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,7 +184,7 @@ var _ v1.Layer = &v1LayerFacade{} | |
type v1LayerFacade struct { | ||
diffID v1.Hash | ||
uncompressed func() (io.ReadCloser, error) | ||
size func() (int64, error) | ||
sentinelSize func() (int64, error) | ||
} | ||
|
||
func newEmptyLayer(diffID v1.Hash, store *Store) *v1LayerFacade { | ||
|
@@ -197,7 +197,7 @@ func newEmptyLayer(diffID v1.Hash, store *Store) *v1LayerFacade { | |
} | ||
return io.NopCloser(bytes.NewReader([]byte{})), nil | ||
}, | ||
size: func() (int64, error) { | ||
sentinelSize: func() (int64, error) { | ||
layer, err := store.LayerByDiffID(diffID) | ||
if err == nil { | ||
return layer.Size() | ||
|
@@ -224,19 +224,12 @@ func newDownloadableEmptyLayer(diffID v1.Hash, store *Store, imageID string) *v1 | |
} | ||
return nil, err | ||
}, | ||
size: func() (int64, error) { | ||
sentinelSize: func() (int64, error) { | ||
layer, err := store.LayerByDiffID(diffID) | ||
if err == nil { | ||
return layer.Size() | ||
} | ||
if err = store.downloadLayersFor(imageID); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! We may ask a layer for its size just to construct a (missing stuff but good enough for our purposes) manifest. I didn't catch this in my earlier performance testing because the tests for WithPreviousImage (where this is relevant) use a hard-coded image, not the "runnable base image". |
||
return -1, err | ||
} | ||
layer, err = store.LayerByDiffID(diffID) | ||
if err == nil { | ||
return layer.Size() | ||
} | ||
return -1, err | ||
return -1, nil | ||
}, | ||
} | ||
} | ||
|
@@ -251,7 +244,7 @@ func newPopulatedLayer(diffID v1.Hash, fromPath string, sentinelSize int64) *v1L | |
} | ||
return f, nil | ||
}, | ||
size: func() (int64, error) { | ||
sentinelSize: func() (int64, error) { | ||
return sentinelSize, nil | ||
}, | ||
} | ||
|
@@ -287,7 +280,7 @@ func (l *v1LayerFacade) Uncompressed() (io.ReadCloser, error) { | |
|
||
// Size returns a sentinel value indicating if the layer has data. | ||
func (l *v1LayerFacade) Size() (int64, error) { | ||
return l.size() | ||
return l.sentinelSize() | ||
} | ||
|
||
func (l *v1LayerFacade) MediaType() (v1types.MediaType, error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was causing the analyzer not to ever find the previous image