From cc0c8c5f816c6fe95b703691e4e3c90fb3240be1 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 27 Aug 2022 00:21:57 -0700 Subject: [PATCH] simplify --- weed/replication/sink/s3sink/s3_sink.go | 15 +++++++++++++- weed/replication/sink/s3sink/s3_write.go | 25 ------------------------ 2 files changed, 14 insertions(+), 26 deletions(-) delete mode 100644 weed/replication/sink/s3sink/s3_write.go diff --git a/weed/replication/sink/s3sink/s3_sink.go b/weed/replication/sink/s3sink/s3_sink.go index 445800275..a032b58e8 100644 --- a/weed/replication/sink/s3sink/s3_sink.go +++ b/weed/replication/sink/s3sink/s3_sink.go @@ -102,7 +102,20 @@ func (s3sink *S3Sink) DeleteEntry(key string, isDirectory, deleteIncludeChunks b return nil } - return s3sink.deleteObject(key) + input := &s3.DeleteObjectInput{ + Bucket: aws.String(s3sink.bucket), + Key: aws.String(key), + } + + result, err := s3sink.conn.DeleteObject(input) + + if err == nil { + glog.V(2).Infof("[%s] delete %s: %v", s3sink.bucket, key, result) + } else { + glog.Errorf("[%s] delete %s: %v", s3sink.bucket, key, err) + } + + return err } diff --git a/weed/replication/sink/s3sink/s3_write.go b/weed/replication/sink/s3sink/s3_write.go deleted file mode 100644 index 256fc659c..000000000 --- a/weed/replication/sink/s3sink/s3_write.go +++ /dev/null @@ -1,25 +0,0 @@ -package S3Sink - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/s3" - "github.com/seaweedfs/seaweedfs/weed/glog" -) - -func (s3sink *S3Sink) deleteObject(key string) error { - input := &s3.DeleteObjectInput{ - Bucket: aws.String(s3sink.bucket), - Key: aws.String(key), - } - - result, err := s3sink.conn.DeleteObject(input) - - if err == nil { - glog.V(2).Infof("[%s] delete %s: %v", s3sink.bucket, key, result) - } else { - glog.Errorf("[%s] delete %s: %v", s3sink.bucket, key, err) - } - - return err - -}