Skip to content

Commit

Permalink
Revert thanos-io#143
Browse files Browse the repository at this point in the history
Signed-off-by: Suraj Patil <[email protected]>
  • Loading branch information
patilsuraj767 committed Oct 1, 2024
1 parent 6eb7db9 commit 8cf87fa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions providers/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type TraceConfig struct {
type Bucket struct {
logger log.Logger
name string
Client *minio.Client
client *minio.Client
defaultSSE encrypt.ServerSide
putUserMetadata map[string]string
storageClass string
Expand Down Expand Up @@ -329,7 +329,7 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string) (*B
bkt := &Bucket{
logger: logger,
name: config.Bucket,
Client: client,
client: client,
defaultSSE: sse,
putUserMetadata: config.PutUserMetadata,
storageClass: storageClass,
Expand Down Expand Up @@ -400,7 +400,7 @@ func (b *Bucket) Iter(ctx context.Context, dir string, f func(string) error, opt
UseV1: b.listObjectsV1,
}

for object := range b.Client.ListObjects(ctx, b.name, opts) {
for object := range b.client.ListObjects(ctx, b.name, opts) {
// Catch the error when failed to list objects.
if object.Err != nil {
return object.Err
Expand Down Expand Up @@ -439,10 +439,10 @@ func (b *Bucket) getRange(ctx context.Context, name string, off, length int64) (
}

// StatObject to see if the object exists and we have permissions to read it
if _, err := b.Client.StatObject(ctx, b.name, name, *opts); err != nil {
if _, err := b.client.StatObject(ctx, b.name, name, *opts); err != nil {
return nil, err
}
return b.Client.GetObject(ctx, b.name, name, *opts)
return b.client.GetObject(ctx, b.name, name, *opts)
}

// Get returns a reader for the given object name.
Expand All @@ -457,7 +457,7 @@ func (b *Bucket) GetRange(ctx context.Context, name string, off, length int64) (

// Exists checks if the given object exists.
func (b *Bucket) Exists(ctx context.Context, name string) (bool, error) {
_, err := b.Client.StatObject(ctx, b.name, name, minio.StatObjectOptions{})
_, err := b.client.StatObject(ctx, b.name, name, minio.StatObjectOptions{})
if err != nil {
if b.IsObjNotFoundErr(err) {
return false, nil
Expand Down Expand Up @@ -493,7 +493,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {
userMetadata[k] = v
}

if _, err := b.Client.PutObject(
if _, err := b.client.PutObject(
ctx,
b.name,
name,
Expand All @@ -520,7 +520,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {

// Attributes returns information about the specified object.
func (b *Bucket) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error) {
objInfo, err := b.Client.StatObject(ctx, b.name, name, minio.StatObjectOptions{})
objInfo, err := b.client.StatObject(ctx, b.name, name, minio.StatObjectOptions{})
if err != nil {
return objstore.ObjectAttributes{}, err
}
Expand All @@ -533,7 +533,7 @@ func (b *Bucket) Attributes(ctx context.Context, name string) (objstore.ObjectAt

// Delete removes the object with the given name.
func (b *Bucket) Delete(ctx context.Context, name string) error {
return b.Client.RemoveObject(ctx, b.name, name, minio.RemoveObjectOptions{})
return b.client.RemoveObject(ctx, b.name, name, minio.RemoveObjectOptions{})
}

// IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.
Expand Down Expand Up @@ -622,15 +622,15 @@ func NewTestBucketFromConfig(t testing.TB, location string, c Config, reuseBucke
bktToCreate = objstore.CreateTemporaryTestBucketName(t)
}

if err := b.Client.MakeBucket(ctx, bktToCreate, minio.MakeBucketOptions{Region: location}); err != nil {
if err := b.client.MakeBucket(ctx, bktToCreate, minio.MakeBucketOptions{Region: location}); err != nil {
return nil, nil, err
}
b.name = bktToCreate
t.Log("created temporary AWS bucket for AWS tests with name", bktToCreate, "in", location)

return b, func() {
objstore.EmptyBucket(t, ctx, b)
if err := b.Client.RemoveBucket(ctx, bktToCreate); err != nil {
if err := b.client.RemoveBucket(ctx, bktToCreate); err != nil {
t.Logf("deleting bucket %s failed: %s", bktToCreate, err)
}
}, nil
Expand Down

0 comments on commit 8cf87fa

Please sign in to comment.