feat: make overlay sync removal configurable

Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
This commit is contained in:
Cardy.Tang 2023-05-19 16:32:10 +08:00
parent 878132923d
commit b9f2e48e37

View File

@ -31,6 +31,7 @@ type Config struct {
// Root directory for the plugin // Root directory for the plugin
RootPath string `toml:"root_path"` RootPath string `toml:"root_path"`
UpperdirLabel bool `toml:"upperdir_label"` UpperdirLabel bool `toml:"upperdir_label"`
SyncRemove bool `toml:"sync_remove"`
} }
func init() { func init() {
@ -55,9 +56,12 @@ func init() {
if config.UpperdirLabel { if config.UpperdirLabel {
oOpts = append(oOpts, overlay.WithUpperdirLabel) oOpts = append(oOpts, overlay.WithUpperdirLabel)
} }
if !config.SyncRemove {
oOpts = append(oOpts, overlay.AsynchronousRemove)
}
ic.Meta.Exports["root"] = root ic.Meta.Exports["root"] = root
return overlay.NewSnapshotter(root, append(oOpts, overlay.AsynchronousRemove)...) return overlay.NewSnapshotter(root, oOpts...)
}, },
}) })
} }