From e908566825c113fbf8236744255e4d8a5e4deca1 Mon Sep 17 00:00:00 2001 From: Joao Marcal Date: Mon, 7 Oct 2024 11:23:32 +0100 Subject: [PATCH] fix: update interface to GetAttributes --- .../client/gcp/gcs_thanos_object_client.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pkg/storage/chunk/client/gcp/gcs_thanos_object_client.go b/pkg/storage/chunk/client/gcp/gcs_thanos_object_client.go index daf9c101a6ec7..a742f56da57b9 100644 --- a/pkg/storage/chunk/client/gcp/gcs_thanos_object_client.go +++ b/pkg/storage/chunk/client/gcp/gcs_thanos_object_client.go @@ -72,19 +72,16 @@ func (s *GCSThanosObjectClient) ObjectExists(ctx context.Context, objectKey stri return s.client.Exists(ctx, objectKey) } -// ObjectExistsWithSize checks if a given objectKey exists and it's size in the GCS bucket -func (s *GCSThanosObjectClient) ObjectExistsWithSize(ctx context.Context, objectKey string) (bool, int64, error) { - _, err := s.client.Get(ctx, objectKey) +// GetAttributes returns the attributes of the specified object key from the configured GCS bucket. +func (s *GCSThanosObjectClient) GetAttributes(ctx context.Context, objectKey string) (client.ObjectAttributes, error) { + attr := client.ObjectAttributes{} + thanosAttr, err := s.client.Attributes(ctx, objectKey) if err != nil { - return false, 0, err + return attr, err } + attr.Size = thanosAttr.Size - attr, err := s.client.Attributes(ctx, objectKey) - if err != nil { - return true, 0, nil - } - - return true, attr.Size, nil + return attr, nil } // PutObject puts the specified bytes into the configured GCS bucket at the provided key