Merge pull request #2879 from tbe/fix-s3-ceph
Fix s3 driver for supporting ceph radosgw
This commit is contained in:
commit
d80a17d8e0
1 changed files with 13 additions and 2 deletions
|
@ -970,8 +970,19 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre
|
||||||
defer done("s3aws.ListObjectsV2Pages(%s)", path)
|
defer done("s3aws.ListObjectsV2Pages(%s)", path)
|
||||||
listObjectErr := d.S3.ListObjectsV2PagesWithContext(ctx, listObjectsInput, func(objects *s3.ListObjectsV2Output, lastPage bool) bool {
|
listObjectErr := d.S3.ListObjectsV2PagesWithContext(ctx, listObjectsInput, func(objects *s3.ListObjectsV2Output, lastPage bool) bool {
|
||||||
|
|
||||||
|
var count int64
|
||||||
|
// KeyCount was introduced with version 2 of the GET Bucket operation in S3.
|
||||||
|
// Some S3 implementations don't support V2 now, so we fall back to manual
|
||||||
|
// calculation of the key count if required
|
||||||
|
if objects.KeyCount != nil {
|
||||||
|
count = *objects.KeyCount
|
||||||
*objectCount += *objects.KeyCount
|
*objectCount += *objects.KeyCount
|
||||||
walkInfos := make([]walkInfoContainer, 0, *objects.KeyCount)
|
} else {
|
||||||
|
count = int64(len(objects.Contents) + len(objects.CommonPrefixes))
|
||||||
|
*objectCount += count
|
||||||
|
}
|
||||||
|
|
||||||
|
walkInfos := make([]walkInfoContainer, 0, count)
|
||||||
|
|
||||||
for _, dir := range objects.CommonPrefixes {
|
for _, dir := range objects.CommonPrefixes {
|
||||||
commonPrefix := *dir.Prefix
|
commonPrefix := *dir.Prefix
|
||||||
|
|
Loading…
Reference in a new issue