[#170] checksum: Use constant mapping for checksum types
All checks were successful
DCO / DCO (pull_request) Successful in 1m8s
Tests and linters / Lint (pull_request) Successful in 1m22s
Tests and linters / Tests (1.19) (pull_request) Successful in 1m43s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m39s

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2023-09-28 17:18:36 +03:00
parent 99c273f499
commit 84b9d29fc9

View file

@ -24,17 +24,17 @@ type Checksum refs.Checksum
// Type represents the enumeration // Type represents the enumeration
// of checksum types. // of checksum types.
type Type uint8 type Type refs.ChecksumType
const ( const (
// Unknown is an undefined checksum type. // Unknown is an undefined checksum type.
Unknown Type = iota Unknown Type = Type(refs.UnknownChecksum)
// SHA256 is a SHA256 checksum type. // SHA256 is a SHA256 checksum type.
SHA256 SHA256 = Type(refs.SHA256)
// TZ is a Tillich-Zémor checksum type. // TZ is a Tillich-Zémor checksum type.
TZ TZ = Type(refs.TillichZemor)
) )
// ReadFromV2 reads Checksum from the refs.Checksum message. Checks if the // ReadFromV2 reads Checksum from the refs.Checksum message. Checks if the