[#595] Fix typos and rewording

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-08-12 12:45:58 +03:00 committed by Kirillov Denis
parent 7ab473a688
commit 107d8a9033
5 changed files with 14 additions and 16 deletions

View file

@ -216,7 +216,7 @@ func formUploadAttributes(info *data.ObjectInfo, maxParts, marker int) (*ObjectP
for i, p := range partInfos {
part, err := layer.ParseCompletedPartHeader(p)
if err != nil {
return nil, fmt.Errorf("invalid competed part: %w", err)
return nil, fmt.Errorf("invalid completed part: %w", err)
}
parts[i] = Part{
PartNumber: part.PartNumber,

View file

@ -54,8 +54,8 @@ type Decrypter struct {
decLen uint64
skipLen uint64
ln uint64
off uint64
length uint64
offset uint64
}
const (
@ -197,12 +197,12 @@ func (d Decrypter) DecryptedLength() uint64 {
// EncryptedLength is size of encrypted data that should be read for successful decryption.
func (d Decrypter) EncryptedLength() uint64 {
return d.ln
return d.length
}
// EncryptedOffset is offset of encrypted payload for successful decryption.
func (d Decrypter) EncryptedOffset() uint64 {
return d.off
return d.offset
}
func (d *Decrypter) initRangeParams() {
@ -210,7 +210,7 @@ func (d *Decrypter) initRangeParams() {
d.encPartRangeLen = d.parts[d.currentPart].encryptedSize
if d.rangeParam == nil {
d.decLen = d.partDataRemain
d.ln = d.encPartRangeLen
d.length = d.encPartRangeLen
return
}
@ -230,7 +230,7 @@ func (d *Decrypter) initRangeParams() {
d.skipLen = (start - sum) % blockSize
d.seqNumber = (start - sum) / blockSize
encOffPart := d.seqNumber * fullBlockSize
d.off = encSum + encOffPart
d.offset = encSum + encOffPart
d.encPartRangeLen = d.encPartRangeLen - encOffPart
d.partDataRemain = d.partDataRemain + sum - start
@ -252,11 +252,11 @@ func (d *Decrypter) initRangeParams() {
if endPartEnc < endEnc {
endEnc = endPartEnc
}
d.ln = endEnc - d.off
d.length = endEnc - d.offset
d.decLen = end - start + 1
if d.ln < d.encPartRangeLen {
d.encPartRangeLen = d.ln
if d.length < d.encPartRangeLen {
d.encPartRangeLen = d.length
}
if d.decLen < d.partDataRemain {
d.partDataRemain = d.decLen

View file

@ -106,8 +106,8 @@ func TestDecrypterInitParams(t *testing.T) {
decReader.initRangeParams()
require.Equal(t, tc.expSkipLen, decReader.skipLen)
require.Equal(t, tc.expDecLen, decReader.decLen)
require.Equal(t, tc.expLn, decReader.ln)
require.Equal(t, tc.expOff, decReader.off)
require.Equal(t, tc.expLn, decReader.length)
require.Equal(t, tc.expOff, decReader.offset)
require.Equal(t, tc.expDataRemain, decReader.partDataRemain)
require.Equal(t, tc.expEncPartRange, decReader.encPartRangeLen)
require.Equal(t, tc.expSeqNumber, decReader.seqNumber)

View file

@ -11,14 +11,13 @@ import (
"strings"
"time"
"github.com/nspcc-dev/neofs-s3-gw/api/layer/encryption"
"github.com/nats-io/nats.go"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neofs-s3-gw/api"
"github.com/nspcc-dev/neofs-s3-gw/api/cache"
"github.com/nspcc-dev/neofs-s3-gw/api/data"
"github.com/nspcc-dev/neofs-s3-gw/api/errors"
"github.com/nspcc-dev/neofs-s3-gw/api/layer/encryption"
"github.com/nspcc-dev/neofs-s3-gw/api/resolver"
"github.com/nspcc-dev/neofs-s3-gw/creds/accessbox"
"github.com/nspcc-dev/neofs-sdk-go/bearer"

View file

@ -9,10 +9,9 @@ import (
"strings"
"time"
"github.com/nspcc-dev/neofs-s3-gw/api/layer/encryption"
"github.com/nspcc-dev/neofs-s3-gw/api"
"github.com/nspcc-dev/neofs-s3-gw/api/data"
"github.com/nspcc-dev/neofs-s3-gw/api/layer/encryption"
"github.com/nspcc-dev/neofs-s3-gw/creds/accessbox"
"github.com/nspcc-dev/neofs-sdk-go/object"
)