Skip to content

Refactoring: use PrefixedBucketClient in UserBucketClient #3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

pracucci
Copy link
Contributor

What this PR does:
This is just an internal refactoring PR to use PrefixedBucketClient in UserBucketClient.

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Marco Pracucci <marco@pracucci.com>
@@ -23,7 +22,7 @@ func NewPrefixedBucketClient(bucket objstore.Bucket, prefix string) *PrefixedBuc
}

func (b *PrefixedBucketClient) fullName(name string) string {
return path.Join(b.prefix, name)
return b.prefix + objstore.DirDelim + name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the same exact logic we had in UserBucketClient. If name is "", the delimiter must be added anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, sorry I made this change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my suggestion, so sorry about that :)

I'm not sure empty name should be a valid choice though and I wonder how do object stores work in that case.

Copy link
Contributor Author

@pracucci pracucci Feb 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure empty name should be a valid choice

It's used to list the root. Thanos does it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I misunderstood and was thinking about empty prefix.

@jtlisi jtlisi self-assigned this Feb 24, 2021
Copy link
Contributor

@jtlisi jtlisi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pracucci pracucci merged commit 78a6245 into cortexproject:master Feb 24, 2021
@pracucci pracucci deleted the use-prefixed-bucket-client-in-user-bucket-client branch February 24, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants