in oss/lib/cp.go [2813:2866]
func (cc *CopyCommand) objectProducer(bucket *oss.Bucket, cloudURL CloudURL, chObjects chan<- objectInfoType, chError chan<- error) {
defer close(chObjects)
pre := oss.Prefix(cloudURL.object)
marker := oss.Marker("")
//while the src object is end with "/", use object key as marker, exclude the object itself
if strings.HasSuffix(cloudURL.object, "/") {
marker = oss.Marker(cloudURL.object)
}
del := oss.Delimiter("")
if cc.cpOption.onlyCurrentDir {
del = oss.Delimiter("/")
}
listOptions := append(cc.cpOption.payerOptions, pre, marker, del)
fnvIns := fnv.New64()
for {
lor, err := cc.command.ossListObjectsRetry(bucket, listOptions...)
if err != nil {
chError <- err
return
}
for _, object := range lor.Objects {
prefix := ""
relativeKey := object.Key
index := strings.LastIndex(cloudURL.object, "/")
if index > 0 {
prefix = object.Key[:index+1]
relativeKey = object.Key[index+1:]
}
if doesSingleObjectMatchPatterns(object.Key, cc.cpOption.filters) {
if cc.cpOption.partitionIndex == 0 || (cc.cpOption.partitionIndex > 0 && matchHash(fnvIns, object.Key, cc.cpOption.partitionIndex-1, cc.cpOption.partitionCount)) {
if strings.ToLower(object.Type) == "symlink" && cc.cpOption.opType == operationTypeGet {
props, _ := cc.command.ossGetObjectStatRetry(bucket, object.Key, cc.cpOption.payerOptions...)
size, err := strconv.ParseInt(props.Get(oss.HTTPHeaderContentLength), 10, 64)
if err == nil {
object.Size = size
}
}
chObjects <- objectInfoType{prefix, relativeKey, int64(object.Size), object.LastModified}
}
}
}
pre = oss.Prefix(lor.Prefix)
marker = oss.Marker(lor.NextMarker)
listOptions = append(cc.cpOption.payerOptions, pre, marker)
if !lor.IsTruncated {
break
}
}
chError <- nil
}