Cache NAR management (list/show/delete/stats) — fixes #260 - #263
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/v1/caches/{cache}/narslist / show / stats / available (optional-auth) and DELETE (owner-only).derivation_output.is_cachedis flipped to false.gradient cache nar list|show|delete|stats./caches/{name}/narswith filters, sort, stats card, and confirm-before-delete.(cache, path)fetch stats oncached_path_signature(last_fetched_at,fetch_count) plus two supporting indexes; wired into the existing NAR fetch hot path.cache.nar.deletewithref_counted_otherspayload.Closes #260. Upload from local store is tracked separately in #261.
Notable design choices
optional_apiso anonymous browsing of public caches keeps working; private caches return 404 to non-owners (matchesget_cacheandload_cache, avoids leaking cache names).is_cachedflip +cached_pathdrop. Blob deletion is fire-and-forget viastate.shutdown.spawn, mirroring the existingcleanup_nars_for_orgspattern after whole-cache deletion.cached_pathIDs before paginating the signature rows sototalhonours filters and pages stay consistent.Test plan
nar_storageKnown limitations
#[ignore]'d (the existing test harness uses SeaORMMockDatabase; real-DB verification is CI's job).packagesearch is unindexed by design — bounded by the cache scope;pg_trgmis left for a future PR if hot.