forked from TrueCloudLab/frostfs-sdk-go
[#170] checksum: Drop Empty
method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
168b3ee7a4
commit
96892d7bc4
6 changed files with 42 additions and 26 deletions
|
@ -199,20 +199,22 @@ func (o *Object) SetCreationEpoch(v uint64) {
|
|||
})
|
||||
}
|
||||
|
||||
// PayloadChecksum returns checksum of the object payload.
|
||||
// PayloadChecksum returns checksum of the object payload and
|
||||
// bool that indicates checksum presence in the object.
|
||||
//
|
||||
// Zero Object has zero checksum.
|
||||
// Zero Object does not have payload checksum.
|
||||
//
|
||||
// See also SetPayloadChecksum.
|
||||
func (o *Object) PayloadChecksum() checksum.Checksum {
|
||||
func (o *Object) PayloadChecksum() (checksum.Checksum, bool) {
|
||||
var v checksum.Checksum
|
||||
v2 := (*object.Object)(o)
|
||||
|
||||
if hash := v2.GetHeader().GetPayloadHash(); hash != nil {
|
||||
v.ReadFromV2(*hash)
|
||||
return v, true
|
||||
}
|
||||
|
||||
return v
|
||||
return v, false
|
||||
}
|
||||
|
||||
// SetPayloadChecksum sets checksum of the object payload.
|
||||
|
@ -228,20 +230,22 @@ func (o *Object) SetPayloadChecksum(v checksum.Checksum) {
|
|||
})
|
||||
}
|
||||
|
||||
// PayloadHomomorphicHash returns homomorphic hash of the object payload.
|
||||
// PayloadHomomorphicHash returns homomorphic hash of the object
|
||||
// payload and bool that indicates checksum presence in the object.
|
||||
//
|
||||
// Zero Object has zero checksum.
|
||||
// Zero Object does not have payload homomorphic checksum.
|
||||
//
|
||||
// See also SetPayloadHomomorphicHash.
|
||||
func (o *Object) PayloadHomomorphicHash() checksum.Checksum {
|
||||
func (o *Object) PayloadHomomorphicHash() (checksum.Checksum, bool) {
|
||||
var v checksum.Checksum
|
||||
v2 := (*object.Object)(o)
|
||||
|
||||
if hash := v2.GetHeader().GetHomomorphicHash(); hash != nil {
|
||||
v.ReadFromV2(*hash)
|
||||
return v, true
|
||||
}
|
||||
|
||||
return v
|
||||
return v, false
|
||||
}
|
||||
|
||||
// SetPayloadHomomorphicHash sets homomorphic hash of the object payload.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue