overlay: add an optional label of upperdir location of each snapshot

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
ktock
2021-06-17 17:38:15 +09:00
committed by Kohei Tokunaga
parent ba70277fb7
commit 67406b3732
2 changed files with 68 additions and 14 deletions

View File

@@ -29,7 +29,8 @@ import (
// Config represents configuration for the overlay plugin.
type Config struct {
// Root directory for the plugin
RootPath string `toml:"root_path"`
RootPath string `toml:"root_path"`
UpperdirLabel bool `toml:"upperdir_label"`
}
func init() {
@@ -50,8 +51,13 @@ func init() {
root = config.RootPath
}
var oOpts []overlay.Opt
if config.UpperdirLabel {
oOpts = append(oOpts, overlay.WithUpperdirLabel)
}
ic.Meta.Exports["root"] = root
return overlay.NewSnapshotter(root, overlay.AsynchronousRemove)
return overlay.NewSnapshotter(root, append(oOpts, overlay.AsynchronousRemove)...)
},
})
}