forked from TrueCloudLab/frostfs-api-go
[#197] sdk: Rename getters of Checksum type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
2afc684313
commit
9f0bc50e53
2 changed files with 9 additions and 9 deletions
|
@ -37,8 +37,8 @@ func NewChecksum() *Checksum {
|
||||||
return NewChecksumFromV2(new(refs.Checksum))
|
return NewChecksumFromV2(new(refs.Checksum))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetType returns checksum type.
|
// Type returns checksum type.
|
||||||
func (c *Checksum) GetType() ChecksumType {
|
func (c *Checksum) Type() ChecksumType {
|
||||||
switch (*refs.Checksum)(c).GetType() {
|
switch (*refs.Checksum)(c).GetType() {
|
||||||
case refs.SHA256:
|
case refs.SHA256:
|
||||||
return ChecksumSHA256
|
return ChecksumSHA256
|
||||||
|
@ -49,8 +49,8 @@ func (c *Checksum) GetType() ChecksumType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSum returns checksum bytes.
|
// Sum returns checksum bytes.
|
||||||
func (c *Checksum) GetSum() []byte {
|
func (c *Checksum) Sum() []byte {
|
||||||
return (*refs.Checksum)(c).GetSum()
|
return (*refs.Checksum)(c).GetSum()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (c *Checksum) ToV2() *refs.Checksum {
|
||||||
}
|
}
|
||||||
|
|
||||||
func EqualChecksums(cs1, cs2 *Checksum) bool {
|
func EqualChecksums(cs1, cs2 *Checksum) bool {
|
||||||
return cs1.GetType() == cs2.GetType() && bytes.Equal(cs1.GetSum(), cs2.GetSum())
|
return cs1.Type() == cs2.Type() && bytes.Equal(cs1.Sum(), cs2.Sum())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marshal marshals Checksum into a protobuf binary form.
|
// Marshal marshals Checksum into a protobuf binary form.
|
||||||
|
|
|
@ -25,8 +25,8 @@ func TestChecksum(t *testing.T) {
|
||||||
|
|
||||||
c.SetSHA256(cSHA256)
|
c.SetSHA256(cSHA256)
|
||||||
|
|
||||||
require.Equal(t, ChecksumSHA256, c.GetType())
|
require.Equal(t, ChecksumSHA256, c.Type())
|
||||||
require.Equal(t, cSHA256[:], c.GetSum())
|
require.Equal(t, cSHA256[:], c.Sum())
|
||||||
|
|
||||||
cV2 := c.ToV2()
|
cV2 := c.ToV2()
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ func TestChecksum(t *testing.T) {
|
||||||
|
|
||||||
c.SetTillichZemor(cTZ)
|
c.SetTillichZemor(cTZ)
|
||||||
|
|
||||||
require.Equal(t, ChecksumTZ, c.GetType())
|
require.Equal(t, ChecksumTZ, c.Type())
|
||||||
require.Equal(t, cTZ[:], c.GetSum())
|
require.Equal(t, cTZ[:], c.Sum())
|
||||||
|
|
||||||
cV2 = c.ToV2()
|
cV2 = c.ToV2()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue