feat: add ETag headers to KV read responses#21
Merged
Conversation
Expose the existing Blake3-256 content hash as an ETag header on KV read responses. The hash was already computed and stored during writes; this change threads it through InvocationOutcome::KvRead and sets ETag: "blake3-<hex>" in the HTTP response. Enables client-side caching for the TinyCloud CLI.
259360d to
af881bb
Compare
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
ETagheaders on KV read responsesChanges
HashthroughInvocationOutcome::KvRead(wasOption<(Metadata, Content)>, nowOption<(Metadata, Hash, Content)>)get_kv()extracts the content hash from thekv_writeentityKVResponseresponder setsETag: "blake3-<hex>"header on every KV GET responsehexto server binary dependencies (already a workspace dep)Details
The Blake3-256 hash was already computed and stored during KV writes (
kv_write.value). This change simply threads it through to the HTTP response. No new hashing is performed.ETag format:
"blake3-<64-char-hex-digest>"Not included
If-None-Match/ 304 Not Modified support (planned follow-up)Test plan
cargo checkpassesETagheader