[#682] cli: Unify array of ranges type
Some checks failed
DCO action / DCO (pull_request) Successful in 3m39s
Vulncheck / Vulncheck (pull_request) Successful in 5m15s
Build / Build Components (1.21) (pull_request) Successful in 6m51s
Build / Build Components (1.20) (pull_request) Successful in 7m10s
Tests and linters / Staticcheck (pull_request) Successful in 9m16s
Tests and linters / Lint (pull_request) Successful in 9m37s
Tests and linters / Tests with -race (pull_request) Failing after 16m19s
Tests and linters / Tests (1.21) (pull_request) Successful in 17m56s
Tests and linters / Tests (1.20) (pull_request) Successful in 18m5s

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-09-12 10:41:29 +03:00
parent f435ab1b26
commit 3c76884182
2 changed files with 6 additions and 15 deletions

View file

@ -739,7 +739,7 @@ type HashPayloadRangesPrm struct {
tz bool
rngs []*objectSDK.Range
rngs []objectSDK.Range
salt []byte
}
@ -750,7 +750,7 @@ func (x *HashPayloadRangesPrm) TZ() {
}
// SetRanges sets a list of payload ranges to hash.
func (x *HashPayloadRangesPrm) SetRanges(rngs []*objectSDK.Range) {
func (x *HashPayloadRangesPrm) SetRanges(rngs []objectSDK.Range) {
x.rngs = rngs
}
@ -774,14 +774,6 @@ func (x HashPayloadRangesRes) HashList() [][]byte {
// Returns any error which prevented the operation from completing correctly in error return.
// Returns an error if number of received hashes differs with the number of requested ranges.
func HashPayloadRanges(ctx context.Context, prm HashPayloadRangesPrm) (*HashPayloadRangesRes, error) {
rngs := make([]objectSDK.Range, len(prm.rngs))
for i, r := range prm.rngs {
if r != nil {
rngs[i] = *r
}
}
cs := checksum.SHA256
if prm.tz {
cs = checksum.TZ
@ -794,7 +786,7 @@ func HashPayloadRanges(ctx context.Context, prm HashPayloadRangesPrm) (*HashPayl
ObjectID: &obj,
Local: prm.local,
Salt: prm.salt,
Ranges: rngs,
Ranges: prm.rngs,
ChecksumType: cs,
Session: prm.sessionToken,
BearerToken: prm.bearerToken,