这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@fkorotkov
Copy link
Contributor

When pulling a new version of a tagged image (e.g., ghcr.io/cirruslabs/macos-runner:sonoma), set the access date of the previous SHA to epoch time (1970-01-01). This ensures that the old SHA will be prioritized for pruning, even if it was accessed more recently than other cached images.

This helps manage disk space more efficiently by automatically cleaning up superseded versions of frequently-updated tagged images.

🤖 Generated with Claude Code

When pulling a new version of a tagged image (e.g., ghcr.io/cirruslabs/macos-runner:sonoma),
set the access date of the previous SHA to epoch time (1970-01-01). This ensures that the
old SHA will be prioritized for pruning, even if it was accessed more recently than other
cached images.

This helps manage disk space more efficiently by automatically cleaning up superseded
versions of frequently-updated tagged images.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@fkorotkov fkorotkov requested a review from edigaryev as a code owner July 7, 2025 04:52
let tmpVMDir = try VMDirectory.temporaryDeterministic(key: name.description)

// Check if there's an existing symlink pointing to a different digest
if exists(name) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about simplifying this down to:

// Open an existing VM directory corresponding to this name, if any,
// marking it as outdated to speed up the garbage collection process
_ = try? open(name, Date(timeIntervalSince1970: 0))

The open() will need to be adjusted as follows:

diff --git a/Sources/tart/VMStorageOCI.swift b/Sources/tart/VMStorageOCI.swift
index 764eb1e..f71c547 100644
--- a/Sources/tart/VMStorageOCI.swift
+++ b/Sources/tart/VMStorageOCI.swift
@@ -27,12 +27,12 @@ class VMStorageOCI: PrunableStorage {
     return digest
   }
 
-  func open(_ name: RemoteName) throws -> VMDirectory {
+  func open(_ name: RemoteName, _ accessDate: Date = Date()) throws -> VMDirectory {
     let vmDir = VMDirectory(baseURL: vmURL(name))
 
     try vmDir.validate(userFriendlyName: name.description)
 
-    try vmDir.baseURL.updateAccessDate()
+    try vmDir.baseURL.updateAccessDate(accessDate)
 
     return vmDir
   }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edigaryev are you sure symlink will update access time of the original sha folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems so. Added in c1b0748

@fkorotkov fkorotkov enabled auto-merge (squash) July 7, 2025 08:43
@edigaryev edigaryev self-requested a review July 7, 2025 08:45
@fkorotkov fkorotkov merged commit a2972aa into main Jul 7, 2025
3 of 7 checks passed
@fkorotkov fkorotkov deleted the feat/prioritize-old-sha-pruning branch July 7, 2025 08:52
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