Open rtyley opened 1 year ago
As discussed at standup, I'm going to do a release of facia-scala-client
as it currently is (v4.0.6), and get that in use, before introducing this new update.
@rtyley has published a preview version of this PR with release workflow run #22, based on commit 1b68eb57ce932cb2635343b915bcfb930b609ff8:
8.0.1-PREVIEW.add-etag-caching-support.2024-07-24T1411.1b68eb57
@rtyley has published a preview version of this PR with release workflow run #26, based on commit 41d95456b8d17803abc294c48b22c2cf96f11cd6:
8.0.2-PREVIEW.add-etag-caching-support.2024-07-25T0748.41d95456
@rtyley has published a preview version of this PR with release workflow run #45, based on commit 23b11d9e959951e84a2c251a1af9c6150cb58895:
12.1.1-PREVIEW.add-etag-caching-support.2024-10-31T1659.23b11d9e
This change adds these improvements:
fapi-s3-sdk-v2
artifact (I think this can replace https://github.com/guardian/facia-scala-client/pull/286, @fredex42?)The ETag-caching library itself is also being used in DotCom PROD, introduced with https://github.com/guardian/frontend/pull/26338.
Usage
Example PR consuming this updated version of the FAPI client: https://github.com/guardian/ophan/pull/5506.
Updated FAPI artifact layout
To use FAPI with the new AWS SDK v2 support, users must now have a dependency on two FAPI artifacts:
fapi-s3-sdk-v2
fapi-client-playXX
Due to needing to support the matrix of:
...it's best not to try to produce an artifact that corresponds to every single possible combination! Consequently, this change provides artifacts that are specific to the different versions of AWS SDK (or at least, could do - if AWS SDK v1 was moved out of common code), and artifacts that are specific to the different versions of Play-JSON, and allow the user to combine them as needed. A similar approach was used with
guardian/play-secret-rotation
: https://github.com/guardian/play-secret-rotation/pull/8In order for the different artifacts to have interfaces they can use to join together and become a single useful Facia client, there is a
fapi-client-core
artifact. Any code that doesn't depend on either the actual AWS SDK version, or the JSON classes, (which isn't much!) can live in there. In particular, we have:com.gu.facia.client.ApiClient
, an existing type that is now a trait, with 2 implementations - one that uses the existingcom.gu.facia.client.S3Client
abstraction on S3 behaviour, and another with ETag-based caching.com.gu.facia.client.etagcaching.fetching.S3FetchBehaviour
, a new trait that exposes just enough interface to allow the conditional fetching used for ETag-based caching, but doesn't tie you to any specific version of the AWS SDK.This PR is still draft, but I wanted to put it on your radar @fredex42 !
Noisy logging associated with absent collection JSON
The
etag-caching
library has been updated with https://github.com/guardian/etag-caching/pull/56 to avoid excessive logging that would occur in the Facia client, due to it typically trying to access collections that aren't yet persisted: https://github.com/guardian/facia-scala-client/pull/32.