mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Refactor RWLayer to use referenced object instead of string
RWLayer will now have more operations and be protected through a referenced type rather than always looked up by string in the layer store. Separates creation of RWLayer (write capture layer) from mounting of the layer. This allows mount labels to be applied after creation and allowing RWLayer objects to have the same lifespan as a container without performance regressions from requiring mount. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
This commit is contained in:
parent
577cf61afa
commit
d04fa49a0d
18 changed files with 427 additions and 275 deletions
|
|
@ -24,8 +24,7 @@ type graphIDRegistrar interface {
|
|||
}
|
||||
|
||||
type graphIDMounter interface {
|
||||
MountByGraphID(string, string, layer.ChainID) (layer.RWLayer, error)
|
||||
Unmount(string) error
|
||||
CreateRWLayerByGraphID(string, string, layer.ChainID) error
|
||||
}
|
||||
|
||||
const (
|
||||
|
|
@ -172,13 +171,7 @@ func migrateContainers(root string, ls graphIDMounter, is image.Store, imageMapp
|
|||
return err
|
||||
}
|
||||
|
||||
_, err = ls.MountByGraphID(id, id, img.RootFS.ChainID())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = ls.Unmount(id)
|
||||
if err != nil {
|
||||
if err := ls.CreateRWLayerByGraphID(id, id, img.RootFS.ChainID()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -338,10 +338,9 @@ type mockMounter struct {
|
|||
count int
|
||||
}
|
||||
|
||||
func (r *mockMounter) MountByGraphID(name string, graphID string, parent layer.ChainID) (layer.RWLayer, error) {
|
||||
func (r *mockMounter) CreateRWLayerByGraphID(name string, graphID string, parent layer.ChainID) error {
|
||||
r.mounts = append(r.mounts, mountInfo{name, graphID, string(parent)})
|
||||
r.count++
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
func (r *mockMounter) Unmount(string) error {
|
||||
r.count--
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue