[#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
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:
parent
f435ab1b26
commit
3c76884182
2 changed files with 6 additions and 15 deletions
|
@ -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,
|
||||
|
|
|
@ -84,7 +84,7 @@ func getObjectRange(cmd *cobra.Command, _ []string) {
|
|||
raw, _ := cmd.Flags().GetBool(rawFlag)
|
||||
prm.SetRawFlag(raw)
|
||||
prm.SetAddress(objAddr)
|
||||
prm.SetRange(ranges[0])
|
||||
prm.SetRange(&ranges[0])
|
||||
prm.SetPayloadWriter(out)
|
||||
|
||||
_, err = internalclient.PayloadRange(cmd.Context(), prm)
|
||||
|
@ -146,13 +146,13 @@ func marshalSplitInfo(cmd *cobra.Command, info *objectSDK.SplitInfo) ([]byte, er
|
|||
}
|
||||
}
|
||||
|
||||
func getRangeList(cmd *cobra.Command) ([]*objectSDK.Range, error) {
|
||||
func getRangeList(cmd *cobra.Command) ([]objectSDK.Range, error) {
|
||||
v := cmd.Flag("range").Value.String()
|
||||
if len(v) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
vs := strings.Split(v, ",")
|
||||
rs := make([]*objectSDK.Range, len(vs))
|
||||
rs := make([]objectSDK.Range, len(vs))
|
||||
for i := range vs {
|
||||
before, after, found := strings.Cut(vs[i], rangeSep)
|
||||
if !found {
|
||||
|
@ -176,7 +176,6 @@ func getRangeList(cmd *cobra.Command) ([]*objectSDK.Range, error) {
|
|||
return nil, fmt.Errorf("invalid '%s' range: uint64 overflow", vs[i])
|
||||
}
|
||||
|
||||
rs[i] = objectSDK.NewRange()
|
||||
rs[i].SetOffset(offset)
|
||||
rs[i].SetLength(length)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue