diff options
Diffstat (limited to 'weed/s3api')
| -rw-r--r-- | weed/s3api/bucket_metadata.go | 5 | ||||
| -rw-r--r-- | weed/s3api/filer_util.go | 14 | ||||
| -rw-r--r-- | weed/s3api/filer_util_tags.go | 11 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_handlers_list.go | 2 | ||||
| -rw-r--r-- | weed/s3api/s3api_object_handlers_multipart.go | 1 |
5 files changed, 17 insertions, 16 deletions
diff --git a/weed/s3api/bucket_metadata.go b/weed/s3api/bucket_metadata.go index d1f487104..a65fe5404 100644 --- a/weed/s3api/bucket_metadata.go +++ b/weed/s3api/bucket_metadata.go @@ -1,6 +1,7 @@ package s3api import ( + "context" "encoding/json" "github.com/aws/aws-sdk-go/service/s3" "github.com/seaweedfs/seaweedfs/weed/glog" @@ -13,7 +14,7 @@ import ( ) var loadBucketMetadataFromFiler = func(r *BucketRegistry, bucketName string) (*BucketMetaData, error) { - entry, err := filer_pb.GetEntry(r.s3a, util.NewFullPath(r.s3a.option.BucketsPath, bucketName)) + entry, err := filer_pb.GetEntry(context.Background(), r.s3a, util.NewFullPath(r.s3a.option.BucketsPath, bucketName)) if err != nil { return nil, err } @@ -64,7 +65,7 @@ func NewBucketRegistry(s3a *S3ApiServer) *BucketRegistry { } func (r *BucketRegistry) init() error { - err := filer_pb.List(r.s3a, r.s3a.option.BucketsPath, "", func(entry *filer_pb.Entry, isLast bool) error { + err := filer_pb.List(context.Background(), r.s3a, r.s3a.option.BucketsPath, "", func(entry *filer_pb.Entry, isLast bool) error { r.LoadBucketMetadata(entry) return nil }, "", false, math.MaxUint32) diff --git a/weed/s3api/filer_util.go b/weed/s3api/filer_util.go index 8ae8f780a..38400140f 100644 --- a/weed/s3api/filer_util.go +++ b/weed/s3api/filer_util.go @@ -11,19 +11,19 @@ import ( func (s3a *S3ApiServer) mkdir(parentDirectoryPath string, dirName string, fn func(entry *filer_pb.Entry)) error { - return filer_pb.Mkdir(s3a, parentDirectoryPath, dirName, fn) + return filer_pb.Mkdir(context.Background(), s3a, parentDirectoryPath, dirName, fn) } func (s3a *S3ApiServer) mkFile(parentDirectoryPath string, fileName string, chunks []*filer_pb.FileChunk, fn func(entry *filer_pb.Entry)) error { - return filer_pb.MkFile(s3a, parentDirectoryPath, fileName, chunks, fn) + return filer_pb.MkFile(context.Background(), s3a, parentDirectoryPath, fileName, chunks, fn) } func (s3a *S3ApiServer) list(parentDirectoryPath, prefix, startFrom string, inclusive bool, limit uint32) (entries []*filer_pb.Entry, isLast bool, err error) { - err = filer_pb.List(s3a, parentDirectoryPath, prefix, func(entry *filer_pb.Entry, isLastEntry bool) error { + err = filer_pb.List(context.Background(), s3a, parentDirectoryPath, prefix, func(entry *filer_pb.Entry, isLastEntry bool) error { entries = append(entries, entry) if isLastEntry { isLast = true @@ -76,19 +76,19 @@ func doDeleteEntry(client filer_pb.SeaweedFilerClient, parentDirectoryPath strin func (s3a *S3ApiServer) exists(parentDirectoryPath string, entryName string, isDirectory bool) (exists bool, err error) { - return filer_pb.Exists(s3a, parentDirectoryPath, entryName, isDirectory) + return filer_pb.Exists(context.Background(), s3a, parentDirectoryPath, entryName, isDirectory) } func (s3a *S3ApiServer) touch(parentDirectoryPath string, entryName string, entry *filer_pb.Entry) (err error) { - return filer_pb.Touch(s3a, parentDirectoryPath, entryName, entry) + return filer_pb.Touch(context.Background(), s3a, parentDirectoryPath, entryName, entry) } func (s3a *S3ApiServer) getEntry(parentDirectoryPath, entryName string) (entry *filer_pb.Entry, err error) { fullPath := util.NewFullPath(parentDirectoryPath, entryName) - return filer_pb.GetEntry(s3a, fullPath) + return filer_pb.GetEntry(context.Background(), s3a, fullPath) } func (s3a *S3ApiServer) updateEntry(parentDirectoryPath string, newEntry *filer_pb.Entry) error { @@ -98,7 +98,7 @@ func (s3a *S3ApiServer) updateEntry(parentDirectoryPath string, newEntry *filer_ } err := s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - err := filer_pb.UpdateEntry(client, updateEntryRequest) + err := filer_pb.UpdateEntry(context.Background(), client, updateEntryRequest) if err != nil { return err } diff --git a/weed/s3api/filer_util_tags.go b/weed/s3api/filer_util_tags.go index c2bdc7294..d33e46c2e 100644 --- a/weed/s3api/filer_util_tags.go +++ b/weed/s3api/filer_util_tags.go @@ -1,6 +1,7 @@ package s3api import ( + "context" "github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants" "strings" @@ -15,7 +16,7 @@ func (s3a *S3ApiServer) getTags(parentDirectoryPath string, entryName string) (t err = s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ + resp, err := filer_pb.LookupEntry(context.Background(), client, &filer_pb.LookupDirectoryEntryRequest{ Directory: parentDirectoryPath, Name: entryName, }) @@ -37,7 +38,7 @@ func (s3a *S3ApiServer) setTags(parentDirectoryPath string, entryName string, ta return s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ + resp, err := filer_pb.LookupEntry(context.Background(), client, &filer_pb.LookupDirectoryEntryRequest{ Directory: parentDirectoryPath, Name: entryName, }) @@ -58,7 +59,7 @@ func (s3a *S3ApiServer) setTags(parentDirectoryPath string, entryName string, ta resp.Entry.Extended[S3TAG_PREFIX+k] = []byte(v) } - return filer_pb.UpdateEntry(client, &filer_pb.UpdateEntryRequest{ + return filer_pb.UpdateEntry(context.Background(), client, &filer_pb.UpdateEntryRequest{ Directory: parentDirectoryPath, Entry: resp.Entry, IsFromOtherCluster: false, @@ -73,7 +74,7 @@ func (s3a *S3ApiServer) rmTags(parentDirectoryPath string, entryName string) (er return s3a.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error { - resp, err := filer_pb.LookupEntry(client, &filer_pb.LookupDirectoryEntryRequest{ + resp, err := filer_pb.LookupEntry(context.Background(), client, &filer_pb.LookupDirectoryEntryRequest{ Directory: parentDirectoryPath, Name: entryName, }) @@ -93,7 +94,7 @@ func (s3a *S3ApiServer) rmTags(parentDirectoryPath string, entryName string) (er return nil } - return filer_pb.UpdateEntry(client, &filer_pb.UpdateEntryRequest{ + return filer_pb.UpdateEntry(context.Background(), client, &filer_pb.UpdateEntryRequest{ Directory: parentDirectoryPath, Entry: resp.Entry, IsFromOtherCluster: false, diff --git a/weed/s3api/s3api_object_handlers_list.go b/weed/s3api/s3api_object_handlers_list.go index 6a4740fef..5233b7c30 100644 --- a/weed/s3api/s3api_object_handlers_list.go +++ b/weed/s3api/s3api_object_handlers_list.go @@ -471,7 +471,7 @@ func (s3a *S3ApiServer) ensureDirectoryAllEmpty(filerClient filer_pb.SeaweedFile var isExhausted bool var foundEntry bool for fileCounter == 0 && !isExhausted && err == nil { - err = filer_pb.SeaweedList(filerClient, currentDir, "", func(entry *filer_pb.Entry, isLast bool) error { + err = filer_pb.SeaweedList(context.Background(), filerClient, currentDir, "", func(entry *filer_pb.Entry, isLast bool) error { foundEntry = true if entry.IsOlderDir() { subDirs = append(subDirs, entry.Name) diff --git a/weed/s3api/s3api_object_handlers_multipart.go b/weed/s3api/s3api_object_handlers_multipart.go index dfd9f5844..ccad9d942 100644 --- a/weed/s3api/s3api_object_handlers_multipart.go +++ b/weed/s3api/s3api_object_handlers_multipart.go @@ -93,7 +93,6 @@ func (s3a *S3ApiServer) CompleteMultipartUploadHandler(w http.ResponseWriter, r } stats_collect.RecordBucketActiveTime(bucket) stats_collect.S3UploadedObjectsCounter.WithLabelValues(bucket).Inc() - writeSuccessResponseXML(w, r, response) } |
