2017-05-26 17:20:41 +00:00
|
|
|
package snapshot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/containerd/containerd/mount"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Mounter interface {
|
|
|
|
Mount() (string, error)
|
|
|
|
Unmount() error
|
|
|
|
}
|
|
|
|
|
2018-04-16 22:23:10 +00:00
|
|
|
// LocalMounter is a helper for mounting mountfactory to temporary path. In
|
|
|
|
// addition it can mount binds without privileges
|
|
|
|
func LocalMounter(mountable Mountable) Mounter {
|
|
|
|
return &localMounter{mountable: mountable}
|
|
|
|
}
|
|
|
|
|
|
|
|
// LocalMounterWithMounts is a helper for mounting to temporary path. In
|
|
|
|
// addition it can mount binds without privileges
|
|
|
|
func LocalMounterWithMounts(mounts []mount.Mount) Mounter {
|
|
|
|
return &localMounter{mounts: mounts}
|
2017-05-26 17:20:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type localMounter struct {
|
2018-04-16 22:23:10 +00:00
|
|
|
mu sync.Mutex
|
|
|
|
mounts []mount.Mount
|
|
|
|
mountable Mountable
|
|
|
|
target string
|
2019-08-15 22:42:03 +00:00
|
|
|
release func() error
|
2017-05-26 17:20:41 +00:00
|
|
|
}
|