distribution/registry/storage/driver
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
..
azure refactor: apply suggestions from code review 2023-12-13 09:22:48 +00:00
base Added Open Telemetry Tracing to Filesystem package 2024-03-04 13:31:22 +01:00
factory storage/driver: plumb contexts into factories 2023-10-27 17:48:57 -04:00
filesystem refactor: apply suggestions from code review 2023-12-13 09:22:48 +00:00
gcs update: support redirects in gcs storage with default credentials 2024-03-11 21:05:03 +01:00
inmemory refactor: apply suggestions from code review 2023-12-13 09:22:48 +00:00
middleware feat: implement 'rewrite' storage middleware 2024-07-04 18:49:25 +04:00
s3-aws S3 driver: Attempt HeadObject on Stat first, fail over to List 2024-07-17 10:16:54 +01:00
testsuites refactor: apply suggestions from code review 2023-12-13 09:22:48 +00:00
errors_test.go feat: add tparallel linter to improve handling parallel tests 2023-11-29 21:40:20 +00:00
fileinfo.go format code with gofumpt 2022-11-03 22:48:20 +01:00
storagedriver.go fix: update S3 storage driver writer 2023-12-13 09:22:48 +00:00
walk.go Pass the last paging flag to storage drivers 2023-08-29 11:27:42 +01:00
walk_test.go Pass the last paging flag to storage drivers 2023-08-29 11:27:42 +01:00