mirror of
https://github.com/containers/skopeo.git
synced 2025-09-13 05:23:05 +00:00
Bump github.com/containers/storage from 1.20.2 to 1.21.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.20.2 to 1.21.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.20.2...v1.21.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
90
vendor/github.com/containers/storage/store.go
generated
vendored
90
vendor/github.com/containers/storage/store.go
generated
vendored
@@ -265,6 +265,15 @@ type Store interface {
|
||||
// Wipe removes all known layers, images, and containers.
|
||||
Wipe() error
|
||||
|
||||
// MountImage mounts an image to temp directory and returns the mount point.
|
||||
// MountImage allows caller to mount an image. Images will always
|
||||
// be mounted read/only
|
||||
MountImage(id string, mountOptions []string, mountLabel string) (string, error)
|
||||
|
||||
// Unmount attempts to unmount an image, given an ID.
|
||||
// Returns whether or not the layer is still mounted.
|
||||
UnmountImage(id string, force bool) (bool, error)
|
||||
|
||||
// Mount attempts to mount a layer, image, or container for access, and
|
||||
// returns the pathname if it succeeds.
|
||||
// Note if the mountLabel == "", the default label for the container
|
||||
@@ -346,6 +355,9 @@ type Store interface {
|
||||
// Names returns the list of names for a layer, image, or container.
|
||||
Names(id string) ([]string, error)
|
||||
|
||||
// Free removes the store from the list of stores
|
||||
Free()
|
||||
|
||||
// SetNames changes the list of names for a layer, image, or container.
|
||||
// Duplicate names are removed from the list automatically.
|
||||
SetNames(id string, names []string) error
|
||||
@@ -2591,25 +2603,11 @@ func (s *store) Version() ([][2]string, error) {
|
||||
return [][2]string{}, nil
|
||||
}
|
||||
|
||||
func (s *store) Mount(id, mountLabel string) (string, error) {
|
||||
container, err := s.Container(id)
|
||||
var (
|
||||
uidMap, gidMap []idtools.IDMap
|
||||
mountOpts []string
|
||||
)
|
||||
if err == nil {
|
||||
uidMap, gidMap = container.UIDMap, container.GIDMap
|
||||
id = container.LayerID
|
||||
mountOpts = container.MountOpts()
|
||||
}
|
||||
func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
|
||||
rlstore, err := s.LayerStore()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
s.graphLock.Lock()
|
||||
defer s.graphLock.Unlock()
|
||||
|
||||
rlstore.Lock()
|
||||
defer rlstore.Unlock()
|
||||
if modified, err := rlstore.Modified(); modified || err != nil {
|
||||
@@ -2630,17 +2628,49 @@ func (s *store) Mount(id, mountLabel string) (string, error) {
|
||||
}
|
||||
|
||||
if rlstore.Exists(id) {
|
||||
options := drivers.MountOpts{
|
||||
MountLabel: mountLabel,
|
||||
UidMaps: uidMap,
|
||||
GidMaps: gidMap,
|
||||
Options: mountOpts,
|
||||
}
|
||||
return rlstore.Mount(id, options)
|
||||
}
|
||||
return "", ErrLayerUnknown
|
||||
}
|
||||
|
||||
func (s *store) MountImage(id string, mountOpts []string, mountLabel string) (string, error) {
|
||||
// Append ReadOnly option to mountOptions
|
||||
img, err := s.Image(id)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err := validateMountOptions(mountOpts); err != nil {
|
||||
return "", err
|
||||
}
|
||||
options := drivers.MountOpts{
|
||||
MountLabel: mountLabel,
|
||||
Options: append(mountOpts, "ro"),
|
||||
}
|
||||
|
||||
return s.mount(img.TopLayer, options)
|
||||
}
|
||||
|
||||
func (s *store) Mount(id, mountLabel string) (string, error) {
|
||||
container, err := s.Container(id)
|
||||
var (
|
||||
uidMap, gidMap []idtools.IDMap
|
||||
mountOpts []string
|
||||
)
|
||||
if err == nil {
|
||||
uidMap, gidMap = container.UIDMap, container.GIDMap
|
||||
id = container.LayerID
|
||||
mountOpts = container.MountOpts()
|
||||
}
|
||||
options := drivers.MountOpts{
|
||||
MountLabel: mountLabel,
|
||||
UidMaps: uidMap,
|
||||
GidMaps: gidMap,
|
||||
Options: mountOpts,
|
||||
}
|
||||
return s.mount(id, options)
|
||||
}
|
||||
|
||||
func (s *store) Mounted(id string) (int, error) {
|
||||
if layerID, err := s.ContainerLayerID(id); err == nil {
|
||||
id = layerID
|
||||
@@ -2660,6 +2690,14 @@ func (s *store) Mounted(id string) (int, error) {
|
||||
return rlstore.Mounted(id)
|
||||
}
|
||||
|
||||
func (s *store) UnmountImage(id string, force bool) (bool, error) {
|
||||
img, err := s.Image(id)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return s.Unmount(img.TopLayer, force)
|
||||
}
|
||||
|
||||
func (s *store) Unmount(id string, force bool) (bool, error) {
|
||||
if layerID, err := s.ContainerLayerID(id); err == nil {
|
||||
id = layerID
|
||||
@@ -3601,3 +3639,13 @@ func GetMountOptions(driver string, graphDriverOptions []string) ([]string, erro
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Free removes the store from the list of stores
|
||||
func (s *store) Free() {
|
||||
for i := 0; i < len(stores); i++ {
|
||||
if stores[i] == s {
|
||||
stores = append(stores[:i], stores[i+1:]...)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user