mirror of
https://github.com/pgsty/minio.git
synced 2026-08-11 08:43:28 +03:00
XL: Implement new ReadAll API for files which are read in single call. (#1974)
Add a unit test as well.
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
ed2fdd90b0
commit
42286cba70
+5
-10
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"path"
|
||||
"sort"
|
||||
@@ -59,18 +58,14 @@ func (m *fsMetaV1) AddObjectPart(partNumber int, partName string, partETag strin
|
||||
|
||||
// readFSMetadata - returns the object metadata `fs.json` content.
|
||||
func readFSMetadata(disk StorageAPI, bucket, object string) (fsMeta fsMetaV1, err error) {
|
||||
// 32KiB staging buffer for copying `fs.json`.
|
||||
var buf = make([]byte, 32*1024)
|
||||
|
||||
// `fs.json` writer.
|
||||
var buffer = new(bytes.Buffer)
|
||||
if err = copyBuffer(buffer, disk, bucket, path.Join(object, fsMetaJSONFile), buf); err != nil {
|
||||
// Read all `fs.json`.
|
||||
buf, err := disk.ReadAll(bucket, path.Join(object, fsMetaJSONFile))
|
||||
if err != nil {
|
||||
return fsMetaV1{}, err
|
||||
}
|
||||
|
||||
// Decode `fs.json` into fsMeta structure.
|
||||
d := json.NewDecoder(buffer)
|
||||
if err = d.Decode(&fsMeta); err != nil {
|
||||
// Decode `fs.json` into fsMeta structure.
|
||||
if err = json.Unmarshal(buf, &fsMeta); err != nil {
|
||||
return fsMetaV1{}, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user