Add config for allowing GC to clean unpacked layers up
This commit adds a flag through Pull API for allowing GC to clean layer contents up after unpacking these contents completed. This patch takes an approach to directly delete GC labels pointing to layers from the manifest blob. This will result in other snapshotters cannot reuse these contents on the next pull. But this patch mainly focuses on CRI use-cases where single snapshotter is usually used throughout the node lifecycle so this shouldn't be a matter. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
@@ -132,6 +132,14 @@ func WithPullUnpack(_ *Client, c *RemoteContext) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithDiscardContent is used to allow GC to clean layers up from
|
||||
// the content store after successfully unpacking these contents to
|
||||
// the snapshotter.
|
||||
func WithDiscardContent(_ *Client, c *RemoteContext) error {
|
||||
c.DiscardContent = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// WithUnpackOpts is used to add unpack options to the unpacker.
|
||||
func WithUnpackOpts(opts []UnpackOpt) RemoteOpt {
|
||||
return func(_ *Client, c *RemoteContext) error {
|
||||
|
||||
Reference in New Issue
Block a user