|
|
@ -59,29 +59,32 @@ func (l *GatewayLocker) NewNSLock(ctx context.Context, bucket string, objects .. |
|
|
|
// Walk - implements common gateway level Walker, to walk on all objects recursively at a prefix
|
|
|
|
// Walk - implements common gateway level Walker, to walk on all objects recursively at a prefix
|
|
|
|
func (l *GatewayLocker) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error { |
|
|
|
func (l *GatewayLocker) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo, opts ObjectOptions) error { |
|
|
|
walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error { |
|
|
|
walk := func(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error { |
|
|
|
var marker string |
|
|
|
go func() { |
|
|
|
|
|
|
|
// Make sure the results channel is ready to be read when we're done.
|
|
|
|
// Make sure the results channel is ready to be read when we're done.
|
|
|
|
defer close(results) |
|
|
|
defer close(results) |
|
|
|
|
|
|
|
|
|
|
|
var marker string |
|
|
|
for { |
|
|
|
|
|
|
|
// set maxKeys to '0' to list maximum possible objects in single call.
|
|
|
|
for { |
|
|
|
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0) |
|
|
|
// set maxKeys to '0' to list maximum possible objects in single call.
|
|
|
|
if err != nil { |
|
|
|
loi, err := l.ObjectLayer.ListObjects(ctx, bucket, prefix, marker, "", 0) |
|
|
|
return err |
|
|
|
if err != nil { |
|
|
|
} |
|
|
|
logger.LogIf(ctx, err) |
|
|
|
marker = loi.NextMarker |
|
|
|
return |
|
|
|
for _, obj := range loi.Objects { |
|
|
|
} |
|
|
|
select { |
|
|
|
marker = loi.NextMarker |
|
|
|
case results <- obj: |
|
|
|
for _, obj := range loi.Objects { |
|
|
|
case <-ctx.Done(): |
|
|
|
select { |
|
|
|
return nil |
|
|
|
case results <- obj: |
|
|
|
|
|
|
|
case <-ctx.Done(): |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if !loi.IsTruncated { |
|
|
|
|
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if !loi.IsTruncated { |
|
|
|
}() |
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|