[#148] linter: Add funlen linter

Long functions are hard to understand and source of errors

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-20 10:01:27 +03:00
parent cc8ff015b4
commit 97c36ed3ec
52 changed files with 76 additions and 0 deletions

View file

@ -26,6 +26,9 @@ linters-settings:
check-shadowing: false check-shadowing: false
staticcheck: staticcheck:
checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed. checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed.
funlen:
lines: 80
statements: 60
linters: linters:
enable: enable:
@ -54,5 +57,6 @@ linters:
- reassign - reassign
- whitespace - whitespace
- containedctx - containedctx
- funlen
disable-all: true disable-all: true
fast: false fast: false

View file

@ -44,6 +44,7 @@ const (
notaryEnabled = true notaryEnabled = true
) )
// nolint: funlen
func dumpBalances(cmd *cobra.Command, _ []string) error { func dumpBalances(cmd *cobra.Command, _ []string) error {
var ( var (
dumpStorage, _ = cmd.Flags().GetBool(dumpBalancesStorageFlag) dumpStorage, _ = cmd.Flags().GetBool(dumpBalancesStorageFlag)

View file

@ -152,6 +152,7 @@ func listContainers(cmd *cobra.Command, _ []string) error {
return nil return nil
} }
// nolint: funlen
func restoreContainers(cmd *cobra.Command, _ []string) error { func restoreContainers(cmd *cobra.Command, _ []string) error {
filename, err := cmd.Flags().GetString(containerDumpFlag) filename, err := cmd.Flags().GetString(containerDumpFlag)
if err != nil { if err != nil {

View file

@ -57,6 +57,7 @@ func init() {
ff.String(customZoneFlag, "frostfs", "Custom zone for NNS") ff.String(customZoneFlag, "frostfs", "Custom zone for NNS")
} }
// nolint: funlen
func deployContractCmd(cmd *cobra.Command, args []string) error { func deployContractCmd(cmd *cobra.Command, args []string) error {
v := viper.GetViper() v := viper.GetViper()
c, err := newInitializeContext(cmd, v) c, err := newInitializeContext(cmd, v)

View file

@ -108,6 +108,7 @@ func (c *initializeContext) close() {
} }
} }
// nolint: funlen
func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContext, error) { func newInitializeContext(cmd *cobra.Command, v *viper.Viper) (*initializeContext, error) {
walletDir := config.ResolveHomePath(viper.GetString(alphabetWalletsFlag)) walletDir := config.ResolveHomePath(viper.GetString(alphabetWalletsFlag))
wallets, err := openAlphabetWallets(v, walletDir) wallets, err := openAlphabetWallets(v, walletDir)

View file

@ -156,6 +156,7 @@ func (c *initializeContext) deployNNS(method string) error {
return c.awaitTx() return c.awaitTx()
} }
// nolint: funlen
func (c *initializeContext) updateContracts() error { func (c *initializeContext) updateContracts() error {
alphaCs := c.getContract(alphabetContract) alphaCs := c.getContract(alphabetContract)

View file

@ -22,6 +22,7 @@ import (
// https://github.com/nspcc-dev/neo-go/blob/master/pkg/core/native/notary.go#L48 // https://github.com/nspcc-dev/neo-go/blob/master/pkg/core/native/notary.go#L48
const defaultNotaryDepositLifetime = 5760 const defaultNotaryDepositLifetime = 5760
// nolint: funlen
func depositNotary(cmd *cobra.Command, _ []string) error { func depositNotary(cmd *cobra.Command, _ []string) error {
p, err := cmd.Flags().GetString(storageWalletFlag) p, err := cmd.Flags().GetString(storageWalletFlag)
if err != nil { if err != nil {

View file

@ -238,6 +238,7 @@ var (
} }
) )
// nolint: funlen
func init() { func init() {
RootCmd.AddCommand(generateAlphabetCmd) RootCmd.AddCommand(generateAlphabetCmd)
generateAlphabetCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir") generateAlphabetCmd.Flags().String(alphabetWalletsFlag, "", "Path to alphabet wallets dir")

View file

@ -307,6 +307,8 @@ const (
) )
// common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands. // common executor cmdSubnetAdminAdd and cmdSubnetAdminRemove commands.
//
// nolint: funlen
func manageSubnetAdmins(cmd *cobra.Command, rm bool) error { func manageSubnetAdmins(cmd *cobra.Command, rm bool) error {
// read private key // read private key
var key keys.PrivateKey var key keys.PrivateKey
@ -651,6 +653,8 @@ func addCommandInheritPreRun(par *cobra.Command, subs ...*cobra.Command) {
} }
// registers flags and binds sub-commands for subnet commands. // registers flags and binds sub-commands for subnet commands.
//
// nolint: funlen
func init() { func init() {
cmdSubnetCreate.Flags().StringP(flagSubnetWallet, "w", "", "Path to file with wallet") cmdSubnetCreate.Flags().StringP(flagSubnetWallet, "w", "", "Path to file with wallet")
_ = cmdSubnetCreate.MarkFlagRequired(flagSubnetWallet) _ = cmdSubnetCreate.MarkFlagRequired(flagSubnetWallet)
@ -868,6 +872,7 @@ func invokeNonNotary(c Client, key keys.PrivateKey, method string, args ...any)
return nil return nil
} }
// nolint: funlen
func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...any) error { func invokeNotary(c Client, key keys.PrivateKey, method string, notaryHash util.Uint160, args ...any) error {
nnsCs, err := c.GetContractStateByID(1) nnsCs, err := c.GetContractStateByID(1)
if err != nil { if err != nil {

View file

@ -79,6 +79,7 @@ type config struct {
MetabasePath string MetabasePath string
} }
// nolint: funlen
func storageConfig(cmd *cobra.Command, args []string) { func storageConfig(cmd *cobra.Command, args []string) {
var outPath string var outPath string
if len(args) != 0 { if len(args) != 0 {

View file

@ -42,6 +42,7 @@ func initObjectGetCmd() {
flags.Bool(binaryFlag, false, "Serialize whole object structure into given file(id + signature + header + payload).") flags.Bool(binaryFlag, false, "Serialize whole object structure into given file(id + signature + header + payload).")
} }
// nolint: funlen
func getObject(cmd *cobra.Command, _ []string) { func getObject(cmd *cobra.Command, _ []string) {
var cnr cid.ID var cnr cid.ID
var obj oid.ID var obj oid.ID

View file

@ -58,6 +58,7 @@ func initObjectPutCmd() {
flags.Bool(binaryFlag, false, "Deserialize object structure from given file.") flags.Bool(binaryFlag, false, "Deserialize object structure from given file.")
} }
// nolint: funlen
func putObject(cmd *cobra.Command, _ []string) { func putObject(cmd *cobra.Command, _ []string) {
binary, _ := cmd.Flags().GetBool(binaryFlag) binary, _ := cmd.Flags().GetBool(binaryFlag)
cidVal, _ := cmd.Flags().GetString(commonflags.CIDFlag) cidVal, _ := cmd.Flags().GetString(commonflags.CIDFlag)

View file

@ -339,6 +339,8 @@ func initFlagSession(cmd *cobra.Command, verb string) {
// container. // container.
// //
// The object itself is not included in the result. // The object itself is not included in the result.
//
// nolint: funlen
func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID, obj oid.ID) []oid.ID { func collectObjectRelatives(cmd *cobra.Command, cli *client.Client, cnr cid.ID, obj oid.ID) []oid.ID {
common.PrintVerbose(cmd, "Fetching raw object header...") common.PrintVerbose(cmd, "Fetching raw object header...")

View file

@ -41,6 +41,7 @@ func newConfig(path, directory string) (*viper.Viper, error) {
return v, err return v, err
} }
// nolint: funlen
func defaultConfiguration(cfg *viper.Viper) { func defaultConfiguration(cfg *viper.Viper) {
cfg.SetDefault("logger.level", "info") cfg.SetDefault("logger.level", "info")

View file

@ -171,6 +171,8 @@ type subStorageCfg struct {
// readConfig fills applicationConfiguration with raw configuration values // readConfig fills applicationConfiguration with raw configuration values
// not modifying them. // not modifying them.
//
// nolint: funlen
func (a *applicationConfiguration) readConfig(c *config.Config) error { func (a *applicationConfiguration) readConfig(c *config.Config) error {
if a._read { if a._read {
err := c.Reload() err := c.Reload()
@ -522,6 +524,7 @@ type cfgReputation struct {
var persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block") var persistateSideChainLastBlockKey = []byte("side_chain_last_processed_block")
// nolint: funlen
func initCfg(appCfg *config.Config) *cfg { func initCfg(appCfg *config.Config) *cfg {
c := &cfg{} c := &cfg{}
@ -654,6 +657,7 @@ type shardOptsWithID struct {
shOpts []shard.Option shOpts []shard.Option
} }
// nolint: funlen
func (c *cfg) shardOpts() []shardOptsWithID { func (c *cfg) shardOpts() []shardOptsWithID {
shards := make([]shardOptsWithID, 0, len(c.EngineCfg.shards)) shards := make([]shardOptsWithID, 0, len(c.EngineCfg.shards))

View file

@ -39,6 +39,7 @@ const (
stopEstimationNotifyEvent = "StopEstimation" stopEstimationNotifyEvent = "StopEstimation"
) )
// nolint: funlen
func initContainerService(c *cfg) { func initContainerService(c *cfg) {
// container wrapper that tries to invoke notary // container wrapper that tries to invoke notary
// requests if chain is configured so // requests if chain is configured so

View file

@ -135,6 +135,7 @@ func (c *cfg) addressNum() int {
return 0 return 0
} }
// nolint: funlen
func initNetmapService(c *cfg) { func initNetmapService(c *cfg) {
network.WriteToNodeInfo(c.localAddr, &c.cfgNodeInfo.localInfo) network.WriteToNodeInfo(c.localAddr, &c.cfgNodeInfo.localInfo)
c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes()) c.cfgNodeInfo.localInfo.SetPublicKey(c.key.PublicKey().Bytes())

View file

@ -163,6 +163,7 @@ func (x *coreClientConstructor) Get(info coreclient.NodeInfo) (coreclient.MultiA
return c.(coreclient.MultiAddressClient), nil return c.(coreclient.MultiAddressClient), nil
} }
// nolint: funlen
func initObjectService(c *cfg) { func initObjectService(c *cfg) {
ls := c.cfgObject.cfgLocalStorage.localStorage ls := c.cfgObject.cfgLocalStorage.localStorage
keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore, c.cfgNetmap.state) keyStorage := util.NewKeyStorage(&c.key.PrivateKey, c.privateTokenStore, c.cfgNetmap.state)

View file

@ -33,6 +33,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
// nolint: funlen
func initReputationService(c *cfg) { func initReputationService(c *cfg) {
wrap, err := repClient.NewFromMorph(c.cfgMorph.client, c.cfgReputation.scriptHash, 0, repClient.TryNotary()) wrap, err := repClient.NewFromMorph(c.cfgMorph.client, c.cfgReputation.scriptHash, 0, repClient.TryNotary())
fatalOnErr(err) fatalOnErr(err)

View file

@ -202,6 +202,8 @@ func (i ContentMeta) Objects() []oid.ID {
} }
// ValidateContent validates payload content according to the object type. // ValidateContent validates payload content according to the object type.
//
// nolint: funlen
func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) { func (v *FormatValidator) ValidateContent(o *object.Object) (ContentMeta, error) {
meta := ContentMeta{ meta := ContentMeta{
typ: o.Type(), typ: o.Type(),

View file

@ -53,6 +53,8 @@ const (
) )
// String returns l in config-compatible format. // String returns l in config-compatible format.
//
// nolint: funlen
func (l GlagoliticLetter) String() string { func (l GlagoliticLetter) String() string {
switch l { switch l {
default: default:

View file

@ -158,6 +158,8 @@ var (
) )
// Start runs all event providers. // Start runs all event providers.
//
// nolint: funlen
func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) { func (s *Server) Start(ctx context.Context, intError chan<- error) (err error) {
s.setHealthStatus(control.HealthStatus_STARTING) s.setHealthStatus(control.HealthStatus_STARTING)
defer func() { defer func() {
@ -319,6 +321,8 @@ func (s *Server) registerStarter(f func() error) {
} }
// New creates instance of inner ring sever structure. // New creates instance of inner ring sever structure.
//
// nolint: funlen
func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan<- error) (*Server, error) { func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan<- error) (*Server, error) {
var err error var err error
server := &Server{log: log} server := &Server{log: log}

View file

@ -10,6 +10,7 @@ import (
const emitMethod = "emit" const emitMethod = "emit"
// nolint: funlen
func (ap *Processor) processEmit() { func (ap *Processor) processEmit() {
index := ap.irList.AlphabetIndex() index := ap.irList.AlphabetIndex()
if index < 0 { if index < 0 {

View file

@ -17,6 +17,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
// nolint: funlen
func (ap *Processor) processStartAudit(epoch uint64) { func (ap *Processor) processStartAudit(epoch uint64) {
log := ap.log.With(zap.Uint64("epoch", epoch)) log := ap.log.With(zap.Uint64("epoch", epoch))

View file

@ -46,6 +46,8 @@ type signatureVerificationData struct {
// - v.binPublicKey is a public session key // - v.binPublicKey is a public session key
// - session context corresponds to the container and verb in v // - session context corresponds to the container and verb in v
// - session is "alive" // - session is "alive"
//
// nolint: funlen
func (cp *Processor) verifySignature(v signatureVerificationData) error { func (cp *Processor) verifySignature(v signatureVerificationData) error {
var err error var err error
var key frostfsecdsa.PublicKeyRFC6979 var key frostfsecdsa.PublicKeyRFC6979

View file

@ -18,6 +18,7 @@ const (
alphabetUpdateIDPrefix = "AlphabetUpdate" alphabetUpdateIDPrefix = "AlphabetUpdate"
) )
// nolint: funlen
func (gp *Processor) processAlphabetSync(txHash util.Uint256) { func (gp *Processor) processAlphabetSync(txHash util.Uint256) {
if !gp.alphabetState.IsAlphabet() { if !gp.alphabetState.IsAlphabet() {
gp.log.Info("non alphabet mode, ignore alphabet sync") gp.log.Info("non alphabet mode, ignore alphabet sync")

View file

@ -13,6 +13,8 @@ import (
// Put saves object in the maximum weight blobobnicza. // Put saves object in the maximum weight blobobnicza.
// //
// returns error if could not save object in any blobovnicza. // returns error if could not save object in any blobovnicza.
//
// nolint: funlen
func (b *Blobovniczas) Put(prm common.PutPrm) (common.PutRes, error) { func (b *Blobovniczas) Put(prm common.PutPrm) (common.PutRes, error) {
if b.readOnly { if b.readOnly {
return common.PutRes{}, common.ErrReadOnly return common.PutRes{}, common.ErrReadOnly

View file

@ -9,6 +9,7 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// nolint: funlen
func TestIterate(t *testing.T, cons Constructor, min, max uint64) { func TestIterate(t *testing.T, cons Constructor, min, max uint64) {
s := cons(t) s := cons(t)
require.NoError(t, s.Open(false)) require.NoError(t, s.Open(false))

View file

@ -57,6 +57,8 @@ var errMustHaveTwoShards = errors.New("must have at least 1 spare shard")
// Evacuate moves data from one shard to the others. // Evacuate moves data from one shard to the others.
// The shard being moved must be in read-only mode. // The shard being moved must be in read-only mode.
//
// nolint: funlen
func (e *StorageEngine) Evacuate(prm EvacuateShardPrm) (EvacuateShardRes, error) { func (e *StorageEngine) Evacuate(prm EvacuateShardPrm) (EvacuateShardRes, error) {
sidList := make([]string, len(prm.shardID)) sidList := make([]string, len(prm.shardID))
for i := range prm.shardID { for i := range prm.shardID {

View file

@ -52,6 +52,7 @@ func (e *StorageEngine) Get(prm GetPrm) (res GetRes, err error) {
return return
} }
// nolint: funlen
func (e *StorageEngine) get(prm GetPrm) (GetRes, error) { func (e *StorageEngine) get(prm GetPrm) (GetRes, error) {
if e.metrics != nil { if e.metrics != nil {
defer elapsed(e.metrics.AddGetDuration)() defer elapsed(e.metrics.AddGetDuration)()

View file

@ -65,6 +65,7 @@ func (e *StorageEngine) GetRange(prm RngPrm) (res RngRes, err error) {
return return
} }
// nolint: funlen
func (e *StorageEngine) getRange(prm RngPrm) (RngRes, error) { func (e *StorageEngine) getRange(prm RngPrm) (RngRes, error) {
if e.metrics != nil { if e.metrics != nil {
defer elapsed(e.metrics.AddRangeDuration)() defer elapsed(e.metrics.AddRangeDuration)()

View file

@ -118,6 +118,8 @@ var ErrLockObjectRemoval = logicerr.New("lock object removal")
// //
// NOTE: Marks any object with GC mark (despite any prohibitions on operations // NOTE: Marks any object with GC mark (despite any prohibitions on operations
// with that object) if WithForceGCMark option has been provided. // with that object) if WithForceGCMark option has been provided.
//
// nolint: funlen
func (db *DB) Inhume(prm InhumePrm) (res InhumeRes, err error) { func (db *DB) Inhume(prm InhumePrm) (res InhumeRes, err error) {
db.modeMtx.RLock() db.modeMtx.RLock()
defer db.modeMtx.RUnlock() defer db.modeMtx.RUnlock()

View file

@ -76,6 +76,7 @@ func (db *DB) Put(prm PutPrm) (res PutRes, err error) {
return return
} }
// nolint: funlen
func (db *DB) put( func (db *DB) put(
tx *bbolt.Tx, obj *objectSDK.Object, id []byte, tx *bbolt.Tx, obj *objectSDK.Object, id []byte,
si *objectSDK.SplitInfo, currEpoch uint64) error { si *objectSDK.SplitInfo, currEpoch uint64) error {

View file

@ -156,6 +156,7 @@ func (s *Shard) Init() error {
return nil return nil
} }
// nolint: funlen
func (s *Shard) refillMetabase() error { func (s *Shard) refillMetabase() error {
err := s.metaBase.Reset() err := s.metaBase.Reset()
if err != nil { if err != nil {

View file

@ -26,6 +26,7 @@ type (
const engineSubsystem = "engine" const engineSubsystem = "engine"
// nolint: funlen
func newEngineMetrics() engineMetrics { func newEngineMetrics() engineMetrics {
var ( var (
listContainersDuration = prometheus.NewCounter(prometheus.CounterOpts{ listContainersDuration = prometheus.NewCounter(prometheus.CounterOpts{

View file

@ -75,6 +75,7 @@ func (m methodCount) Inc(success bool) {
} }
} }
// nolint: funlen
func newObjectServiceMetrics() objectServiceMetrics { func newObjectServiceMetrics() objectServiceMetrics {
var ( // Request counter metrics. var ( // Request counter metrics.
getCounter = newMethodCallCounter("get") getCounter = newMethodCallCounter("get")

View file

@ -445,6 +445,7 @@ func (c *Client) notaryInvokeAsCommittee(method string, nonce, vub uint32, args
return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...) return c.notaryInvoke(true, true, designate, nonce, &vub, method, args...)
} }
// nolint: funlen
func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...any) error { func (c *Client) notaryInvoke(committee, invokedByAlpha bool, contract util.Uint160, nonce uint32, vub *uint32, method string, args ...any) error {
alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation alphabetList, err := c.notary.alphabetSource() // prepare arguments for test invocation
if err != nil { if err != nil {

View file

@ -191,6 +191,7 @@ func (l *listener) listen(ctx context.Context, intError chan<- error) error {
return nil return nil
} }
// nolint: funlen
func (l *listener) listenLoop(ctx context.Context, chEvent <-chan *state.ContainedNotificationEvent, intErr chan<- error) { func (l *listener) listenLoop(ctx context.Context, chEvent <-chan *state.ContainedNotificationEvent, intErr chan<- error) {
var ( var (
blockChan <-chan *block.Block blockChan <-chan *block.Block

View file

@ -103,6 +103,8 @@ func notaryPreparator(prm PreparatorPrm) NotaryPreparator {
// transaction is expected to be received one more time // transaction is expected to be received one more time
// from the Notary service but already signed. This happens // from the Notary service but already signed. This happens
// since every notary call is a new notary request in fact. // since every notary call is a new notary request in fact.
//
// nolint: funlen
func (p Preparator) Prepare(nr *payload.P2PNotaryRequest) (NotaryEvent, error) { func (p Preparator) Prepare(nr *payload.P2PNotaryRequest) (NotaryEvent, error) {
// notary request's main tx is expected to have // notary request's main tx is expected to have
// three or four witnesses: one for proxy contract, // three or four witnesses: one for proxy contract,

View file

@ -35,6 +35,7 @@ func (c *Context) executePoR() {
c.report.SetPoRCounters(c.porRequests.Load(), c.porRetries.Load()) c.report.SetPoRCounters(c.porRequests.Load(), c.porRetries.Load())
} }
// nolint: funlen
func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGroup) { func (c *Context) checkStorageGroupPoR(sgID oid.ID, sg storagegroupSDK.StorageGroup) {
members := sg.Members() members := sg.Members()
c.updateSGInfo(sgID, members) c.updateSGInfo(sgID, members)

View file

@ -118,6 +118,8 @@ func (c *Checker) StickyBitCheck(info v2.RequestInfo, owner user.ID) bool {
} }
// CheckEACL is a main check function for extended ACL. // CheckEACL is a main check function for extended ACL.
//
// nolint: funlen
func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error { func (c *Checker) CheckEACL(msg any, reqInfo v2.RequestInfo) error {
basicACL := reqInfo.BasicACL() basicACL := reqInfo.BasicACL()
if !basicACL.Extendable() { if !basicACL.Extendable() {

View file

@ -101,6 +101,7 @@ func requestHeaders(msg xHeaderSource) []eaclSDK.Header {
var errMissingOID = errors.New("object ID is missing") var errMissingOID = errors.New("object ID is missing")
// nolint: funlen
func (h *cfg) readObjectHeaders(dst *headerSource) error { func (h *cfg) readObjectHeaders(dst *headerSource) error {
switch m := h.msg.(type) { switch m := h.msg.(type) {
default: default:

View file

@ -443,6 +443,7 @@ func (b Service) GetRangeHash(
return b.next.GetRangeHash(ctx, request) return b.next.GetRangeHash(ctx, request)
} }
// nolint: funlen
func (p putStreamBasicChecker) Send(request *objectV2.PutRequest) error { func (p putStreamBasicChecker) Send(request *objectV2.PutRequest) error {
body := request.GetBody() body := request.GetBody()
if body == nil { if body == nil {

View file

@ -87,6 +87,7 @@ func (c *clientCacheWrapper) get(info coreclient.NodeInfo) (getClient, error) {
}, nil }, nil
} }
// nolint: funlen
func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*object.Object, error) { func (c *clientWrapper) getObject(exec *execCtx, info coreclient.NodeInfo) (*object.Object, error) {
if exec.isForwardingEnabled() { if exec.isForwardingEnabled() {
return exec.prm.forwarder(info, c.client) return exec.prm.forwarder(info, c.client)

View file

@ -33,6 +33,7 @@ import (
var errWrongMessageSeq = errors.New("incorrect message sequence") var errWrongMessageSeq = errors.New("incorrect message sequence")
// nolint: funlen
func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStream) (*getsvc.Prm, error) { func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStream) (*getsvc.Prm, error) {
body := req.GetBody() body := req.GetBody()
@ -199,6 +200,7 @@ func (s *Service) toPrm(req *objectV2.GetRequest, stream objectSvc.GetObjectStre
return p, nil return p, nil
} }
// nolint: funlen
func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.GetObjectRangeStream) (*getsvc.RangePrm, error) { func (s *Service) toRangePrm(req *objectV2.GetRangeRequest, stream objectSvc.GetObjectRangeStream) (*getsvc.RangePrm, error) {
body := req.GetBody() body := req.GetBody()
@ -424,6 +426,7 @@ func (w *headResponseWriter) WriteHeader(_ context.Context, hdr *object.Object)
return nil return nil
} }
// nolint: funlen
func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp *objectV2.HeadResponse) (*getsvc.HeadPrm, error) { func (s *Service) toHeadPrm(ctx context.Context, req *objectV2.HeadRequest, resp *objectV2.HeadResponse) (*getsvc.HeadPrm, error) {
body := req.GetBody() body := req.GetBody()

View file

@ -164,6 +164,7 @@ func (t *distributedTarget) sendObject(node nodeDesc) error {
return nil return nil
} }
// nolint: funlen
func (t *distributedTarget) iteratePlacement(f func(nodeDesc) error) (*transformer.AccessIdentifiers, error) { func (t *distributedTarget) iteratePlacement(f func(nodeDesc) error) (*transformer.AccessIdentifiers, error) {
id, _ := t.obj.ID() id, _ := t.obj.ID()

View file

@ -54,6 +54,7 @@ func (p *Streamer) MaxObjectSize() uint64 {
return p.maxPayloadSz return p.maxPayloadSz
} }
// nolint: funlen
func (p *Streamer) initTarget(prm *PutInitPrm) error { func (p *Streamer) initTarget(prm *PutInitPrm) error {
// prevent re-calling // prevent re-calling
if p.target != nil { if p.target != nil {

View file

@ -22,6 +22,7 @@ import (
oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
) )
// nolint: funlen
func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStream) (*searchsvc.Prm, error) { func (s *Service) toPrm(req *objectV2.SearchRequest, stream objectSvc.SearchStream) (*searchsvc.Prm, error) {
body := req.GetBody() body := req.GetBody()

View file

@ -72,6 +72,7 @@ func TraverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler)
return err return err
} }
// nolint: funlen
func traverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) (bool, error) { func traverseSplitChain(r HeadReceiver, addr oid.Address, h SplitMemberHandler) (bool, error) {
v, err := r.Head(addr) v, err := r.Head(addr)
if err != nil { if err != nil {

View file

@ -147,6 +147,7 @@ type processPlacementContext struct {
removeLocalCopy bool removeLocalCopy bool
} }
// nolint: funlen
func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType, func (p *Policer) processNodes(ctx *processPlacementContext, addrWithType objectcore.AddressWithType,
nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) { nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) {
addr := addrWithType.Address addr := addrWithType.Address

View file

@ -104,6 +104,7 @@ type iterDaughterPrm struct {
consumersIter TrustIterator consumersIter TrustIterator
} }
// nolint: funlen
func (c *Calculator) iterateDaughter(p iterDaughterPrm) { func (c *Calculator) iterateDaughter(p iterDaughterPrm) {
initTrust, err := c.prm.InitialTrustSource.InitialTrust(p.id) initTrust, err := c.prm.InitialTrustSource.InitialTrust(p.id)
if err != nil { if err != nil {

View file

@ -255,6 +255,7 @@ func (s *Service) SynchronizeAll() error {
} }
} }
// nolint: funlen
func (s *Service) syncLoop(ctx context.Context) { func (s *Service) syncLoop(ctx context.Context) {
for { for {
select { select {