Fix s3 driver for supporting ceph radosgw
Radosgw does not support S3 `GET Bucket` API v2 API but v1. This API has backward compatibility, so most of this API is working correctly but we can not get `KeyCount` in v1 API and which is only for v2 API. Signed-off-by: Eohyung Lee <liquidnuker@gmail.com>
This commit is contained in:
parent
6d62eb1d4a
commit
f877726503
1 changed files with 10 additions and 2 deletions
|
@ -970,8 +970,16 @@ 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 {
|
||||||
|
|
||||||
*objectCount += *objects.KeyCount
|
var count int64
|
||||||
walkInfos := make([]walkInfoContainer, 0, *objects.KeyCount)
|
if objects.KeyCount != nil {
|
||||||
|
count = *objects.KeyCount
|
||||||
|
*objectCount += *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