Skip to content

Commit 11f311f

Browse files
committed
Add minimal interface to CRI image store
Avoid requiring the whole image store interface for the image store cache which only needs Get. Signed-off-by: Derek McGowan <[email protected]>
1 parent 02a9a45 commit 11f311f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/cri/store/image/image.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,19 @@ type Image struct {
5555
Pinned bool
5656
}
5757

58+
// ImageGetter is used to get images but does not make changes
59+
type ImageGetter interface {
60+
Get(ctx context.Context, name string) (images.Image, error)
61+
}
62+
5863
// Store stores all images.
5964
type Store struct {
6065
lock sync.RWMutex
6166
// refCache is a containerd image reference to image id cache.
6267
refCache map[string]string
6368

6469
// images is the local image store
65-
images images.Store
70+
images ImageGetter
6671

6772
// content provider
6873
provider content.InfoReaderProvider
@@ -76,7 +81,7 @@ type Store struct {
7681
}
7782

7883
// NewStore creates an image store.
79-
func NewStore(img images.Store, provider content.InfoReaderProvider, platform platforms.MatchComparer) *Store {
84+
func NewStore(img ImageGetter, provider content.InfoReaderProvider, platform platforms.MatchComparer) *Store {
8085
return &Store{
8186
refCache: make(map[string]string),
8287
images: img,

0 commit comments

Comments
 (0)