distribution/registry
Milos Gajdos a18cc8a656
S3 driver: Attempt HeadObject on Stat first, fail over to List
Stat always calls ListObjects when stat-ing S3 key.
Unfortauntely ListObjects is not a free call - both in terms of egress
and actual AWS costs (likely because of the egress).

This changes the behaviour of Stat such that we always attempt the
HeadObject call first and only ever fall through to ListObjects if the
HeadObject returns an AWS API error.

Note, that the official docs mention that the only error returned by
HEAD is NoSuchKey; experiments show that this is demonstrably wrong and
the AWS docs are simply outdated at the time of this commit.

HeadObject actually returns the following errors:
* NotFound: if the queried key does not exist
* NotFound: if the queried key contains subkeys i.e. it's a prefix
* BucketRegionError: if the bucket does not exist
* Forbidden: if Head operation is not allows via IAM/ACLs

Co-authored-by: Cory Snider <corhere@gmail.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2024-07-17 10:16:54 +01:00
..
api chore: fix some typos in comments 2024-04-23 17:48:53 +08:00
auth feature: Bump go-jose and require signing algorithms in auth 2024-05-30 20:44:35 +01:00
handlers Replace custom Redis config struct with go-redis UniversalOptions (adds sentinel & cluster support) (#4306) 2024-07-04 16:00:37 +01:00
listener feat(linter): enable errcheck linter in golangci-lint 2023-11-18 07:19:24 +00:00
middleware Merge pull request #2752 from davidswu/registry-driver-middleware 2023-06-21 10:06:13 -07:00
proxy Include headers when serving blob through proxy (#4273) 2024-05-14 14:27:09 +01:00
storage S3 driver: Attempt HeadObject on Stat first, fail over to List 2024-07-17 10:16:54 +01:00
doc.go Move initialization code from main.go to the registry package 2015-09-09 14:39:31 -07:00
registry.go Stop proxy scheduler on system exit 2024-05-13 17:01:35 +03:00
registry_test.go Add registry.Shutdown method for graceful shutdown of embedded registry 2024-04-29 20:18:58 +02:00
root.go feat(linter): enable errcheck linter in golangci-lint 2023-11-18 07:19:24 +00:00