storage: Add CDN cache-tag metadata on uploads#14075
Merged
Merged
Conversation
096c430 to
22cee7a
Compare
This comment has been minimized.
This comment has been minimized.
This returns the comma-separated CDN cache tag string for taggable
objects. Version-scoped objects (`.crate`, `.zip`, `.zip.json`, readme)
carry both a `crate:{name}` and a `release:{name}@{version}` tag.
Crate-scoped objects (OG image, per-crate feed) carry only `crate:{name}`.
Global objects stay untagged and rely on URL purge. Names and versions
are used verbatim, with no normalization.
This wires `cache_tags()` into `attributes()`, so every taggable upload carries an `x-amz-meta-cache-tags` entry. The S3 backend surfaces that header for the CDNs to read at cache-fill time, while the local-filesystem dev backend keeps no-oping attributes. Untagged global objects stay metadata-free.
22cee7a to
ccf5f33
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
ccf5f33 to
6d3f88a
Compare
Member
Author
|
I've added a feature flag so that we can test this out on staging without blocking production deploys in the meantime. |
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.
This PR adds CDN cache-tag metadata to newly uploaded
static.crates.ioobjects.StorageKey::cache_tags()returns the tag string for taggable objects:.crate,.zip,.zip.json, and readme objects carry bothcrate:{name}andrelease:{name}@{version}crate:{name}attributes()emits the tags as thex-amz-meta-cache-tagsuser-metadata header, which CloudFront and Fastly will read at cache-fill time to index each object under its tags (requires further changes in thesimpleinfrarepo).This is additive and changes no existing behavior. New objects gain the metadata and nothing consumes the tags yet. The local-filesystem dev backend continues to no-op attributes, so only S3 and the in-memory test backend carry it.