Avoid using sleep as a way to measure whether gc has occurred.
Some systems may pause execution of the test and cause a failure if
the gc thread has not yet run after the sleep in the main thread.
Signed-off-by: Derek McGowan <derek@mcg.dev>
Provide a flag which configures a lease to only hold
reference to its given references and ignore label references
during garbage collection rooted from the lease.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This test seems to fall apart on a loaded system. In actuality it
doesn't seem to be testing for a threshold, but a "sane" range.
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Add garbage collection as a background process and policy
configuration for configuring when to run garbage collection.
By default garbage collection will run when deletion occurs
and no more than 20ms out of every second.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Marks and sweeps unreferenced objects.
Add snapshot cleanup to metadata.
Add content garbage collection
Add dirty flags for snapshotters and content store which
are set on deletion and used during the next garbage collection.
Cleanup content store backend when content metadata is removed.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
As a minimum, we would like to maintain generic garbage collection of
containerd resources. This includes images, bundles, containers and
arbitrary content.
The included implementation is just a textbook toy that we can use to
inform the requirements of gc. It implements a simple, stack-based
tricolor algorithm. Nothing special.
Mostly, this is to ensure we think about garbage collection from the
start, rather than as an afterthought or follow on feature.
Signed-off-by: Stephen J Day <stephen.day@docker.com>