Bump github.com/containers/storage from 1.24.5 to 1.25.0

Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.24.5 to 1.25.0.
- [Release notes](https://github.com/containers/storage/releases)
- [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md)
- [Commits](https://github.com/containers/storage/compare/v1.24.5...v1.25.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
dependabot-preview[bot]
2021-02-03 13:18:21 +00:00
committed by Daniel J Walsh
parent d1e0afdd47
commit ebc42f5086
34 changed files with 797 additions and 93 deletions

View File

@@ -122,6 +122,30 @@ type ContainerBigDataStore interface {
SetBigData(id, key string, data []byte) error
}
// A ROLayerBigDataStore wraps up how we store RO big-data associated with layers.
type ROLayerBigDataStore interface {
// SetBigData stores a (potentially large) piece of data associated
// with this ID.
BigData(id, key string) (io.ReadCloser, error)
// BigDataNames() returns a list of the names of previously-stored pieces of
// data.
BigDataNames(id string) ([]string, error)
}
// A RWLayerBigDataStore wraps up how we store big-data associated with layers.
type RWLayerBigDataStore interface {
// SetBigData stores a (potentially large) piece of data associated
// with this ID.
SetBigData(id, key string, data io.Reader) error
}
// A LayerBigDataStore wraps up how we store big-data associated with layers.
type LayerBigDataStore interface {
ROLayerBigDataStore
RWLayerBigDataStore
}
// A FlaggableStore can have flags set and cleared on items which it manages.
type FlaggableStore interface {
// ClearFlag removes a named flag from an item in the store.
@@ -385,6 +409,18 @@ type Store interface {
// allow ImagesByDigest to find images by their correct digests.
SetImageBigData(id, key string, data []byte, digestManifest func([]byte) (digest.Digest, error)) error
// ListLayerBigData retrieves a list of the (possibly large) chunks of
// named data associated with an layer.
ListLayerBigData(id string) ([]string, error)
// LayerBigData retrieves a (possibly large) chunk of named data
// associated with a layer.
LayerBigData(id, key string) (io.ReadCloser, error)
// SetLayerBigData stores a (possibly large) chunk of named data
// associated with a layer.
SetLayerBigData(id, key string, data io.Reader) error
// ImageSize computes the size of the image's layers and ancillary data.
ImageSize(id string) (int64, error)
@@ -1627,6 +1663,95 @@ func (s *store) ImageBigData(id, key string) ([]byte, error) {
return nil, errors.Wrapf(ErrImageUnknown, "error locating image with ID %q", id)
}
// ListLayerBigData retrieves a list of the (possibly large) chunks of
// named data associated with an layer.
func (s *store) ListLayerBigData(id string) ([]string, error) {
lstore, err := s.LayerStore()
if err != nil {
return nil, err
}
lstores, err := s.ROLayerStores()
if err != nil {
return nil, err
}
foundLayer := false
for _, s := range append([]ROLayerStore{lstore}, lstores...) {
store := s
store.RLock()
defer store.Unlock()
if modified, err := store.Modified(); modified || err != nil {
if err = store.Load(); err != nil {
return nil, err
}
}
data, err := store.BigDataNames(id)
if err == nil {
return data, nil
}
if store.Exists(id) {
foundLayer = true
}
}
if foundLayer {
return nil, errors.Wrapf(os.ErrNotExist, "error locating big data for layer with ID %q", id)
}
return nil, errors.Wrapf(ErrLayerUnknown, "error locating layer with ID %q", id)
}
// LayerBigData retrieves a (possibly large) chunk of named data
// associated with a layer.
func (s *store) LayerBigData(id, key string) (io.ReadCloser, error) {
lstore, err := s.LayerStore()
if err != nil {
return nil, err
}
lstores, err := s.ROLayerStores()
if err != nil {
return nil, err
}
foundLayer := false
for _, s := range append([]ROLayerStore{lstore}, lstores...) {
store := s
store.RLock()
defer store.Unlock()
if modified, err := store.Modified(); modified || err != nil {
if err = store.Load(); err != nil {
return nil, err
}
}
data, err := store.BigData(id, key)
if err == nil {
return data, nil
}
if store.Exists(id) {
foundLayer = true
}
}
if foundLayer {
return nil, errors.Wrapf(os.ErrNotExist, "error locating item named %q for layer with ID %q", key, id)
}
return nil, errors.Wrapf(ErrLayerUnknown, "error locating layer with ID %q", id)
}
// SetLayerBigData stores a (possibly large) chunk of named data
// associated with a layer.
func (s *store) SetLayerBigData(id, key string, data io.Reader) error {
store, err := s.LayerStore()
if err != nil {
return err
}
store.Lock()
defer store.Unlock()
if modified, err := store.Modified(); modified || err != nil {
if err = store.Load(); err != nil {
return nil
}
}
return store.SetBigData(id, key, data)
}
func (s *store) SetImageBigData(id, key string, data []byte, digestManifest func([]byte) (digest.Digest, error)) error {
ristore, err := s.ImageStore()
if err != nil {