mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
XL: Change AppendFile() to return only error (#1932)
AppendFile ensures that it appends the entire buffer. Returns an error otherwise, this patch removes the necessity for the caller to look for 'n' return on short writes. Ref #1893
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
e1aad066c6
commit
50d25ca94a
@@ -270,7 +270,7 @@ func (fs fsObjects) PutObject(bucket string, object string, size int64, data io.
|
||||
|
||||
if size == 0 {
|
||||
// For size 0 we write a 0byte file.
|
||||
_, err := fs.storage.AppendFile(minioMetaBucket, tempObj, []byte(""))
|
||||
err := fs.storage.AppendFile(minioMetaBucket, tempObj, []byte(""))
|
||||
if err != nil {
|
||||
return "", toObjectErr(err, bucket, object)
|
||||
}
|
||||
@@ -287,13 +287,10 @@ func (fs fsObjects) PutObject(bucket string, object string, size int64, data io.
|
||||
if n > 0 {
|
||||
// Update md5 writer.
|
||||
md5Writer.Write(buf[:n])
|
||||
m, wErr := fs.storage.AppendFile(minioMetaBucket, tempObj, buf[:n])
|
||||
wErr := fs.storage.AppendFile(minioMetaBucket, tempObj, buf[:n])
|
||||
if wErr != nil {
|
||||
return "", toObjectErr(wErr, bucket, object)
|
||||
}
|
||||
if m != int64(n) {
|
||||
return "", toObjectErr(errUnexpected, bucket, object)
|
||||
}
|
||||
}
|
||||
if rErr == io.EOF {
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user