mirror of
https://github.com/minio/minio.git
synced 2025-04-05 04:10:28 -04:00
Extend quorum based listing for prefixes (#5749)
Previous PR 2afd196c83ceccaa930dff74ed052432bfdcdecf fixed the issue of quorum based listing for regular objects, this PR continues on this idea by extending this support to object directory prefixes as well. Fixes #5733
This commit is contained in:
parent
98315b8e60
commit
8eb838bf91
@ -725,17 +725,13 @@ func (s *xlSets) ListObjects(ctx context.Context, bucket, prefix, marker, delimi
|
|||||||
return result, toObjectErr(walkResult.err, bucket, prefix)
|
return result, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry := walkResult.entry
|
|
||||||
var objInfo ObjectInfo
|
var objInfo ObjectInfo
|
||||||
if hasSuffix(entry, slashSeparator) {
|
|
||||||
// Object name needs to be full path.
|
|
||||||
objInfo.Bucket = bucket
|
|
||||||
objInfo.Name = entry
|
|
||||||
objInfo.IsDir = true
|
|
||||||
} else {
|
|
||||||
// Set the Mode to a "regular" file.
|
|
||||||
var err error
|
var err error
|
||||||
objInfo, err = s.getHashedSet(entry).getObjectInfo(bucket, entry)
|
if hasSuffix(walkResult.entry, slashSeparator) {
|
||||||
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfoDir(bucket, walkResult.entry)
|
||||||
|
} else {
|
||||||
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfo(bucket, walkResult.entry)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Ignore errFileNotFound as the object might have got
|
// Ignore errFileNotFound as the object might have got
|
||||||
// deleted in the interim period of listing and getObjectInfo(),
|
// deleted in the interim period of listing and getObjectInfo(),
|
||||||
@ -746,7 +742,6 @@ func (s *xlSets) ListObjects(ctx context.Context, bucket, prefix, marker, delimi
|
|||||||
}
|
}
|
||||||
return result, toObjectErr(err, bucket, prefix)
|
return result, toObjectErr(err, bucket, prefix)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nextMarker = objInfo.Name
|
nextMarker = objInfo.Name
|
||||||
objInfos = append(objInfos, objInfo)
|
objInfos = append(objInfos, objInfo)
|
||||||
i++
|
i++
|
||||||
@ -1270,16 +1265,13 @@ func (s *xlSets) listObjectsHeal(bucket, prefix, marker, delimiter string, maxKe
|
|||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
return loi, toObjectErr(walkResult.err, bucket, prefix)
|
return loi, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
entry := walkResult.entry
|
|
||||||
var objInfo ObjectInfo
|
var objInfo ObjectInfo
|
||||||
if hasSuffix(entry, slashSeparator) {
|
|
||||||
// Object name needs to be full path.
|
|
||||||
objInfo.Bucket = bucket
|
|
||||||
objInfo.Name = entry
|
|
||||||
objInfo.IsDir = true
|
|
||||||
} else {
|
|
||||||
var err error
|
var err error
|
||||||
objInfo, err = s.getHashedSet(entry).getObjectInfo(bucket, entry)
|
if hasSuffix(walkResult.entry, slashSeparator) {
|
||||||
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfoDir(bucket, walkResult.entry)
|
||||||
|
} else {
|
||||||
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfo(bucket, walkResult.entry)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Ignore errFileNotFound
|
// Ignore errFileNotFound
|
||||||
if errors.Cause(err) == errFileNotFound {
|
if errors.Cause(err) == errFileNotFound {
|
||||||
@ -1287,7 +1279,6 @@ func (s *xlSets) listObjectsHeal(bucket, prefix, marker, delimiter string, maxKe
|
|||||||
}
|
}
|
||||||
return loi, toObjectErr(err, bucket, prefix)
|
return loi, toObjectErr(err, bucket, prefix)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nextMarker = objInfo.Name
|
nextMarker = objInfo.Name
|
||||||
objInfos = append(objInfos, objInfo)
|
objInfos = append(objInfos, objInfo)
|
||||||
i++
|
i++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user