moby / moby/buildkit

Discussion: Add an API to consume Garbage Collector events

Open
#4,138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

Buildkit exposes the current state of the content store through the DiskUsage API, where we can get useful info:

ID:		10ofs9glhyl4hrwtlx4escdk4
Parent:		v0md6wbh37wzlamonp6llrpkh
Created at:	2023-07-24 14:17:46.648063672 +0000 UTC
Mutable:	false
Reclaimable:	true
Shared:		false
Size:		0B
Description:	pulled from docker.io/library/node:lts-buster@sha256:eed03f075a9127bfbe9997e5556cc70e6ddb7803483d252404b9c0c7a889513a
Usage count:	1
Last used:	2 weeks ago
Type:		regular

But it's only a picture in time, and it can be hard to compute diff between two DU calls and understand what has been collected by the GC and why (one might even totally miss a content that has been added after the last call and removed before the next call).

It would be interesting to add a new GC API to keep track of what has been added and removed to/from the content store.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the issue's description of BuildKit's DiskUsage API and how the content store records additions and removals. Define the intended GC event API and its observable event data before locating the relevant content-store implementation; done means consumers can track what GC collected without diffing separate snapshots.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.