Description
Engineer a Fastify plugin that calculates deterministic SHA-1 hashes of historical JSON data to enable aggressive client-side ETag caching.
Architecture & Context
Historical vault performance metrics in tokenized-fractional never change once a ledger closes. However, clients continually re-fetch them. Generating deterministic ETags allows the server to return 304 Not Modified, saving immense bandwidth.
Technical Requirements
- Serialize outgoing JSON payloads using a strict, alphabetical key-sorting algorithm.
- Calculate and append the
ETag header before flushing the response stream.
- Intercept
If-None-Match headers to short-circuit the execution pipeline immediately.
Acceptance Criteria
Description
Engineer a Fastify plugin that calculates deterministic SHA-1 hashes of historical JSON data to enable aggressive client-side ETag caching.
Architecture & Context
Historical vault performance metrics in
tokenized-fractionalnever change once a ledger closes. However, clients continually re-fetch them. Generating deterministic ETags allows the server to return 304 Not Modified, saving immense bandwidth.Technical Requirements
ETagheader before flushing the response stream.If-None-Matchheaders to short-circuit the execution pipeline immediately.Acceptance Criteria