-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garbage collector #29
Conversation
Thanks for the contribution! I agree we should have some kind of garbage collection to remove dangling layers. AFAIU, there is a small chance that there is a new manifest uploaded while the garbage collection is happening and new layers might be removed. I think this is just something we will have to accept for this in some way to keep the registry implementation simple. I am going to propose some things and let me know what you think (just throwing some stuff here for discussion):
IMO I'd go for the GC endpoint and just let anybody that needs GC to explicitly call it. If we are feeling fancy with DOs we could do these passes in there, but still with workers unbounded plans + ctx.waitUntil() we can extend computation time already by a bit. Hope you find this overall feedback fair! I am open to have GC just wanting to see your point of view on these 😄. |
Here are my 2 bits:
I agree with you on your concerns and I'm too a bit afraid of over-engineering :) I would prefer to keep the implementation simple and introduce complexity only when we really need it. |
I like the date change. I'd suggest we remove the asynchronous garbage collection if we have the endpoint. And in that case I do not think DO is necessary (trying to stay within R2 as much as possible here). |
Sure, let's keep it safe. Had to remove date checks since it's useless now. Let's keep users responsible for their own actions :) |
I think you will have to run the formatter on this PR and the other https://github.com/cloudflare/serverless-registry/pull/30/files |
Sure! |
upvote on this |
This PR introduces a garbage collector.
When we remove an image or tag from the repository, blobs referenced by deleted manifests are not removed from R2. With this new PR, we'll schedule garbage collecting after any modifying operations.
GC will wait 10 minutes after any modifications are done to the repository this ensures we'll not start garbage collecting of freshly uploaded blobs without parenting manifest.
We have 2 modes for the garbage collector, unreferenced and untagged:
Users can skip the GARBAGE_COLLECTOR_MODE variable which will disable GC.
Some considerations: