mirror of
https://github.com/minio/minio.git
synced 2025-02-25 12:29:15 -05:00
XL/erasure: Remove deprecated copyN function. (#2288)
This commit is contained in:
parent
091d80666a
commit
a2b6f0524d
@ -144,56 +144,6 @@ func getChunkSize(blockSize int64, dataBlocks int) int64 {
|
|||||||
return (blockSize + int64(dataBlocks) - 1) / int64(dataBlocks)
|
return (blockSize + int64(dataBlocks) - 1) / int64(dataBlocks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// copyN - copies from disk, volume, path to input writer until length
|
|
||||||
// is reached at volume, path or an error occurs. A success copyN returns
|
|
||||||
// err == nil, not err == EOF. Additionally offset can be provided to start
|
|
||||||
// the read at. copyN returns io.EOF if there aren't enough data to be read.
|
|
||||||
func copyN(writer io.Writer, disk StorageAPI, volume string, path string, offset int64, length int64) (err error) {
|
|
||||||
// Use staging buffer to read up to length.
|
|
||||||
bufSize := int64(readSizeV1)
|
|
||||||
if length > 0 && bufSize > length {
|
|
||||||
bufSize = length
|
|
||||||
}
|
|
||||||
buf := make([]byte, int(bufSize))
|
|
||||||
|
|
||||||
// Read into writer until length.
|
|
||||||
for length > 0 {
|
|
||||||
curLength := bufSize
|
|
||||||
if length < bufSize {
|
|
||||||
curLength = length
|
|
||||||
}
|
|
||||||
nr, er := disk.ReadFile(volume, path, offset, buf[:curLength])
|
|
||||||
if nr > 0 {
|
|
||||||
nw, ew := writer.Write(buf[0:nr])
|
|
||||||
if nw > 0 {
|
|
||||||
// Decrement the length.
|
|
||||||
length -= int64(nw)
|
|
||||||
|
|
||||||
// Progress the offset.
|
|
||||||
offset += int64(nw)
|
|
||||||
}
|
|
||||||
if ew != nil {
|
|
||||||
err = ew
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if nr != int64(nw) {
|
|
||||||
err = io.ErrShortWrite
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if er == io.EOF || er == io.ErrUnexpectedEOF {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if er != nil {
|
|
||||||
err = er
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Success.
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// copyBuffer - copies from disk, volume, path to input writer until either EOF
|
// copyBuffer - copies from disk, volume, path to input writer until either EOF
|
||||||
// is reached at volume, path or an error occurs. A success copyBuffer returns
|
// is reached at volume, path or an error occurs. A success copyBuffer returns
|
||||||
// err == nil, not err == EOF. Because copyBuffer is defined to read from path
|
// err == nil, not err == EOF. Because copyBuffer is defined to read from path
|
||||||
|
@ -54,9 +54,9 @@ func dialRedis(rLogger redisLogger) (*redis.Pool, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if password != "" {
|
if password != "" {
|
||||||
if _, err := c.Do("AUTH", password); err != nil {
|
if _, derr := c.Do("AUTH", password); derr != nil {
|
||||||
c.Close()
|
c.Close()
|
||||||
return nil, err
|
return nil, derr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c, err
|
return c, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user