mirror of
https://github.com/minio/minio.git
synced 2025-11-21 18:26:04 -05:00
Revert all GetObjectNInfo related PRs (#6398)
* Revert "Encrypted reader wrapped in NewGetObjectReader should be closed (#6383)" This reverts commit53a0bbeb5b. * Revert "Change SelectAPI to use new GetObjectNInfo API (#6373)" This reverts commit5b05df215a. * Revert "Implement GetObjectNInfo object layer call (#6290)" This reverts commite6d740ce09.
This commit is contained in:
committed by
kannappanr
parent
fb27388101
commit
4487f70f08
@@ -17,7 +17,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
@@ -163,54 +162,6 @@ func (xl xlObjects) CopyObject(ctx context.Context, srcBucket, srcObject, dstBuc
|
||||
return objInfo, nil
|
||||
}
|
||||
|
||||
func (xl xlObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec) (objInfo ObjectInfo, reader io.ReadCloser, err error) {
|
||||
|
||||
// Acquire lock
|
||||
lock := xl.nsMutex.NewNSLock(bucket, object)
|
||||
if err = lock.GetRLock(globalObjectTimeout); err != nil {
|
||||
return objInfo, nil, err
|
||||
}
|
||||
|
||||
if err = checkGetObjArgs(ctx, bucket, object); err != nil {
|
||||
return objInfo, nil, err
|
||||
}
|
||||
|
||||
if hasSuffix(object, slashSeparator) {
|
||||
if !xl.isObjectDir(bucket, object) {
|
||||
return objInfo, nil, toObjectErr(errFileNotFound, bucket, object)
|
||||
}
|
||||
var e error
|
||||
if objInfo, e = xl.getObjectInfoDir(ctx, bucket, object); e != nil {
|
||||
return objInfo, nil, toObjectErr(e, bucket, object)
|
||||
}
|
||||
objReader := NewGetObjectReader(bytes.NewReader(nil), lock, nil)
|
||||
return objInfo, objReader, nil
|
||||
}
|
||||
|
||||
objInfo, err = xl.getObjectInfo(ctx, bucket, object)
|
||||
if err != nil {
|
||||
return objInfo, nil, toObjectErr(err, bucket, object)
|
||||
}
|
||||
|
||||
startOffset, readLength := int64(0), objInfo.Size
|
||||
if rs != nil {
|
||||
startOffset, readLength = rs.GetOffsetLength(objInfo.Size)
|
||||
}
|
||||
|
||||
pr, pw := io.Pipe()
|
||||
objReader := NewGetObjectReader(pr, lock, nil)
|
||||
go func() {
|
||||
err := xl.getObject(ctx, bucket, object, startOffset, readLength, pw, "")
|
||||
if err != nil {
|
||||
pw.CloseWithError(err)
|
||||
return
|
||||
}
|
||||
pw.Close()
|
||||
}()
|
||||
|
||||
return objInfo, objReader, nil
|
||||
}
|
||||
|
||||
// GetObject - reads an object erasured coded across multiple
|
||||
// disks. Supports additional parameters like offset and length
|
||||
// which are synonymous with HTTP Range requests.
|
||||
|
||||
Reference in New Issue
Block a user