|
|
@ -78,7 +78,7 @@ func newBucket(bucketName, aclType, donutName string, nodes map[string]node) (bu |
|
|
|
metadata.ACL = BucketACL(aclType) |
|
|
|
metadata.ACL = BucketACL(aclType) |
|
|
|
metadata.Created = t |
|
|
|
metadata.Created = t |
|
|
|
metadata.Metadata = make(map[string]string) |
|
|
|
metadata.Metadata = make(map[string]string) |
|
|
|
metadata.BucketObjects = make(map[string]interface{}) |
|
|
|
metadata.BucketObjects = make(map[string]struct{}) |
|
|
|
|
|
|
|
|
|
|
|
return b, metadata, nil |
|
|
|
return b, metadata, nil |
|
|
|
} |
|
|
|
} |
|
|
@ -455,10 +455,16 @@ func (b bucket) readObjectData(objectName string, writer *io.PipeWriter, objMeta |
|
|
|
writer.CloseWithError(iodine.New(err, nil)) |
|
|
|
writer.CloseWithError(iodine.New(err, nil)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
expected512Sum, err := hex.DecodeString(objMetadata.SHA512Sum) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
writer.CloseWithError(iodine.New(err, nil)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
hasher := md5.New() |
|
|
|
hasher := md5.New() |
|
|
|
mwriter := io.MultiWriter(writer, hasher) |
|
|
|
sum512hasher := sha256.New() |
|
|
|
switch len(readers) == 1 { |
|
|
|
mwriter := io.MultiWriter(writer, hasher, sum512hasher) |
|
|
|
case false: |
|
|
|
switch len(readers) > 1 { |
|
|
|
|
|
|
|
case true: |
|
|
|
if objMetadata.ErasureTechnique == "" { |
|
|
|
if objMetadata.ErasureTechnique == "" { |
|
|
|
writer.CloseWithError(iodine.New(MissingErasureTechnique{}, nil)) |
|
|
|
writer.CloseWithError(iodine.New(MissingErasureTechnique{}, nil)) |
|
|
|
return |
|
|
|
return |
|
|
@ -482,7 +488,7 @@ func (b bucket) readObjectData(objectName string, writer *io.PipeWriter, objMeta |
|
|
|
} |
|
|
|
} |
|
|
|
totalLeft = totalLeft - int64(objMetadata.BlockSize) |
|
|
|
totalLeft = totalLeft - int64(objMetadata.BlockSize) |
|
|
|
} |
|
|
|
} |
|
|
|
case true: |
|
|
|
case false: |
|
|
|
_, err := io.Copy(writer, readers[0]) |
|
|
|
_, err := io.Copy(writer, readers[0]) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
writer.CloseWithError(iodine.New(err, nil)) |
|
|
|
writer.CloseWithError(iodine.New(err, nil)) |
|
|
@ -494,6 +500,10 @@ func (b bucket) readObjectData(objectName string, writer *io.PipeWriter, objMeta |
|
|
|
writer.CloseWithError(iodine.New(ChecksumMismatch{}, nil)) |
|
|
|
writer.CloseWithError(iodine.New(ChecksumMismatch{}, nil)) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if !bytes.Equal(expected512Sum, sum512hasher.Sum(nil)) { |
|
|
|
|
|
|
|
writer.CloseWithError(iodine.New(ChecksumMismatch{}, nil)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
writer.Close() |
|
|
|
writer.Close() |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|