[#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 { for i, p := range partInfos {
part, err := layer.ParseCompletedPartHeader(p) part, err := layer.ParseCompletedPartHeader(p)
if err != nil { if err != nil {
return nil, fmt.Errorf("invalid competed part: %w", err) return nil, fmt.Errorf("invalid completed part: %w", err)
} }
parts[i] = Part{ parts[i] = Part{
PartNumber: part.PartNumber, PartNumber: part.PartNumber,

View file

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

View file

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

View file

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

View file

@ -9,10 +9,9 @@ import (
"strings" "strings"
"time" "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"
"github.com/nspcc-dev/neofs-s3-gw/api/data" "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-s3-gw/creds/accessbox"
"github.com/nspcc-dev/neofs-sdk-go/object" "github.com/nspcc-dev/neofs-sdk-go/object"
) )