[#496] node: Fix linter importas
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m52s
Build / Build Components (1.19) (pull_request) Successful in 4m1s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m55s
Tests and linters / Lint (pull_request) Successful in 14m40s
Tests and linters / Tests (1.19) (pull_request) Successful in 15m29s
ci/woodpecker/push/pre-commit Pipeline was successful
All checks were successful
Build / Build Components (1.20) (pull_request) Successful in 3m52s
Build / Build Components (1.19) (pull_request) Successful in 4m1s
ci/woodpecker/pr/pre-commit Pipeline was successful
Tests and linters / Tests with -race (pull_request) Successful in 5m36s
Tests and linters / Tests (1.20) (pull_request) Successful in 5m55s
Tests and linters / Lint (pull_request) Successful in 14m40s
Tests and linters / Tests (1.19) (pull_request) Successful in 15m29s
ci/woodpecker/push/pre-commit Pipeline was successful
Standardize the alias of the import frostfs-sdk-go/object as objectSDK. Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
4bbe9cc936
commit
033eaf77e1
80 changed files with 444 additions and 443 deletions
|
@ -12,7 +12,7 @@ import (
|
|||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/netmap"
|
||||
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||
frostfsecdsa "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/crypto/ecdsa"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
||||
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||
)
|
||||
|
@ -87,7 +87,7 @@ func NewFormatValidator(opts ...FormatValidatorOption) *FormatValidator {
|
|||
// If unprepared is true, only fields set by user are validated.
|
||||
//
|
||||
// Returns nil error if the object has valid structure.
|
||||
func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unprepared bool) error {
|
||||
func (v *FormatValidator) Validate(ctx context.Context, obj *objectSDK.Object, unprepared bool) error {
|
||||
if obj == nil {
|
||||
return errNilObject
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr
|
|||
return fmt.Errorf("object did not pass expiration check: %w", err)
|
||||
}
|
||||
|
||||
if err := object.CheckHeaderVerificationFields(obj); err != nil {
|
||||
if err := objectSDK.CheckHeaderVerificationFields(obj); err != nil {
|
||||
return fmt.Errorf("(%T) could not validate header fields: %w", v, err)
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ func (v *FormatValidator) Validate(ctx context.Context, obj *object.Object, unpr
|
|||
return nil
|
||||
}
|
||||
|
||||
func (v *FormatValidator) validateSignatureKey(obj *object.Object) error {
|
||||
func (v *FormatValidator) validateSignatureKey(obj *objectSDK.Object) error {
|
||||
sig := obj.Signature()
|
||||
if sig == nil {
|
||||
// TODO(@cthulhu-rider): #468 use "const" error
|
||||
|
@ -178,13 +178,13 @@ func (v *FormatValidator) checkOwnerKey(id user.ID, key frostfsecdsa.PublicKey)
|
|||
// - object.TypeTombstone;
|
||||
// - object.TypeLock.
|
||||
type ContentMeta struct {
|
||||
typ object.Type
|
||||
typ objectSDK.Type
|
||||
|
||||
objs []oid.ID
|
||||
}
|
||||
|
||||
// Type returns object's type.
|
||||
func (i ContentMeta) Type() object.Type {
|
||||
func (i ContentMeta) Type() objectSDK.Type {
|
||||
return i.typ
|
||||
}
|
||||
|
||||
|
@ -197,17 +197,17 @@ func (i ContentMeta) Objects() []oid.ID {
|
|||
}
|
||||
|
||||
// ValidateContent validates payload content according to the object type.
|
||||
func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) {
|
||||
func (v *FormatValidator) ValidateContent(o *objectSDK.Object) (ContentMeta, error) {
|
||||
meta := ContentMeta{
|
||||
typ: o.Type(),
|
||||
}
|
||||
|
||||
switch o.Type() {
|
||||
case object.TypeTombstone:
|
||||
case objectSDK.TypeTombstone:
|
||||
if err := v.fillAndValidateTombstoneMeta(o, &meta); err != nil {
|
||||
return ContentMeta{}, err
|
||||
}
|
||||
case object.TypeLock:
|
||||
case objectSDK.TypeLock:
|
||||
if err := v.fillAndValidateLockMeta(o, &meta); err != nil {
|
||||
return ContentMeta{}, err
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error)
|
|||
return meta, nil
|
||||
}
|
||||
|
||||
func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *ContentMeta) error {
|
||||
func (v *FormatValidator) fillAndValidateLockMeta(o *objectSDK.Object, meta *ContentMeta) error {
|
||||
if len(o.Payload()) == 0 {
|
||||
return errors.New("empty payload in lock")
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten
|
|||
return fmt.Errorf("lock object expiration: %d; current: %d", lockExp, currEpoch)
|
||||
}
|
||||
|
||||
var lock object.Lock
|
||||
var lock objectSDK.Lock
|
||||
|
||||
if err = lock.Unmarshal(o.Payload()); err != nil {
|
||||
return fmt.Errorf("decode lock payload: %w", err)
|
||||
|
@ -256,12 +256,12 @@ func (v *FormatValidator) fillAndValidateLockMeta(o *object.Object, meta *Conten
|
|||
return nil
|
||||
}
|
||||
|
||||
func (v *FormatValidator) fillAndValidateTombstoneMeta(o *object.Object, meta *ContentMeta) error {
|
||||
func (v *FormatValidator) fillAndValidateTombstoneMeta(o *objectSDK.Object, meta *ContentMeta) error {
|
||||
if len(o.Payload()) == 0 {
|
||||
return fmt.Errorf("(%T) empty payload in tombstone", v)
|
||||
}
|
||||
|
||||
tombstone := object.NewTombstone()
|
||||
tombstone := objectSDK.NewTombstone()
|
||||
|
||||
if err := tombstone.Unmarshal(o.Payload()); err != nil {
|
||||
return fmt.Errorf("(%T) could not unmarshal tombstone content: %w", v, err)
|
||||
|
@ -287,7 +287,7 @@ func (v *FormatValidator) fillAndValidateTombstoneMeta(o *object.Object, meta *C
|
|||
|
||||
var errExpired = errors.New("object has expired")
|
||||
|
||||
func (v *FormatValidator) checkExpiration(ctx context.Context, obj *object.Object) error {
|
||||
func (v *FormatValidator) checkExpiration(ctx context.Context, obj *objectSDK.Object) error {
|
||||
exp, err := expirationEpochAttribute(obj)
|
||||
if err != nil {
|
||||
if errors.Is(err, errNoExpirationEpoch) {
|
||||
|
@ -321,7 +321,7 @@ func (v *FormatValidator) checkExpiration(ctx context.Context, obj *object.Objec
|
|||
return nil
|
||||
}
|
||||
|
||||
func expirationEpochAttribute(obj *object.Object) (uint64, error) {
|
||||
func expirationEpochAttribute(obj *objectSDK.Object) (uint64, error) {
|
||||
for _, a := range obj.Attributes() {
|
||||
if a.Key() != objectV2.SysAttributeExpEpoch && a.Key() != objectV2.SysAttributeExpEpochNeoFS {
|
||||
continue
|
||||
|
@ -338,7 +338,7 @@ var (
|
|||
errEmptyAttrVal = errors.New("empty attribute value")
|
||||
)
|
||||
|
||||
func (v *FormatValidator) checkAttributes(obj *object.Object) error {
|
||||
func (v *FormatValidator) checkAttributes(obj *objectSDK.Object) error {
|
||||
as := obj.Attributes()
|
||||
|
||||
mUnique := make(map[string]struct{}, len(as))
|
||||
|
@ -362,7 +362,7 @@ func (v *FormatValidator) checkAttributes(obj *object.Object) error {
|
|||
|
||||
var errIncorrectOwner = errors.New("incorrect object owner")
|
||||
|
||||
func (v *FormatValidator) checkOwner(obj *object.Object) error {
|
||||
func (v *FormatValidator) checkOwner(obj *objectSDK.Object) error {
|
||||
if idOwner := obj.OwnerID(); idOwner == nil || len(idOwner.WalletBytes()) == 0 {
|
||||
return errIncorrectOwner
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue