Skip to content

feat: add image-aware DeleteImage to dfdaemon and image to Download - #697

Merged
gaius-qi merged 1 commit into
mainfrom
feat/image-aware-delete
Nov 10, 2026
Merged

gaius-qi merged 1 commit into
mainfrom
feat/image-aware-delete

Conversation

@gaius-qi

Copy link
Copy Markdown
Member

Description

API for image-aware deletion. A peer records which OCI image each downloaded task belongs to. DeleteImage then deletes only the tasks that no other cached image on that peer still references.

  • common.v2: new Image { reference, platform } message. Download gains optional Image image = 36, the next free field after scheduling_policy = 35.
  • dfdaemon.v2: new DeleteImageRequest { Image image, optional remote_ip } and DeleteImageResponse { deleted_task_ids, retained_task_ids }. rpc DeleteImage is added to both DfdaemonUpload and DfdaemonDownload.
  • scheduler.v2: PreheatImageRequest gains optional common.v2.Image image = 21, so the scheduler can pass the image to the peers it preheats.
  • Go validation: reference needs min_len: 1, platform must match ^[a-z0-9]+/[a-z0-9]+$, and DeleteImageRequest.image is required.
  • Regenerated the Go (hack/protoc.sh), Rust (cargo build) and Python (hack/protoc-python.sh) bindings and the Go mocks (go generate), and bumped the version to 2.3.9.

All changes are additive. image is not part of the task ID calculation.

Related Issue

None.

Motivation and Context

Today DeleteImage in dragonfly-sdk resolves the image again from the registry and deletes every manifest and blob task. That also deletes blobs shared with other cached images, and when the tag has moved it deletes the wrong blobs. With this API, each dfdaemon keeps the image-to-task references locally and decides itself which tasks are safe to delete. The design follows containers/storage DeleteImage (reachability is checked at delete time) and containerd's content GC references.

Verified with go build ./..., go vet ./pkg/apis/..., cargo clippy --release -- -D warnings, and an import smoke test of the Python bindings. A throwaway Go test (not committed) checked the new validation rules on DeleteImageRequest, Image and Download. cargo fmt --check already fails on main for the generated src/*.rs, and this PR does not change that.

🤖 Generated with Claude Code

Introduce the `common.v2.Image` message (canonical reference and os/arch
platform) and the optional `image` field in `Download`, so a peer records
the tasks it downloads for an OCI image as referenced by that image.

Add `DeleteImage` to the `DfdaemonUpload` and `DfdaemonDownload` services.
It deletes the tasks of the image in the peer except the ones still
referenced by other images, and returns the deleted and retained task
ids. Add the optional `image` field to `PreheatImageRequest`, so the
scheduler passes the image to the peers it preheats.

Regenerate the Go, Rust and Python bindings and the Go mocks, and bump
the version to 2.3.9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Gaius <gaius.qi@gmail.com>
@CormickKneey
CormickKneey enabled auto-merge (squash) November 10, 2026 03:59
@gaius-qi
gaius-qi disabled auto-merge November 10, 2026 05:49
@gaius-qi
gaius-qi merged commit 4f18828 into main Nov 10, 2026
6 checks passed
@gaius-qi
gaius-qi deleted the feat/image-aware-delete branch November 10, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants