From 80f1b49898ddcacfbf1d814be1dcc828739176f0 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 08:56:02 +0300 Subject: [PATCH 01/15] [#1388] golangci: Make `unused` linter stricker Add aditional checks. The most important false positive - structs used as map keys. Signed-off-by: Dmitrii Stepanov --- .golangci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 971f0d0e7..33cf88d8a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -38,6 +38,10 @@ linters-settings: alias: pkg: git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object alias: objectSDK + unused: + field-writes-are-uses: false + exported-fields-are-used: false + local-variables-are-used: false custom: truecloudlab-linters: path: bin/linters/external_linters.so -- 2.45.2 From 078d3c5edd003de598734854b69e3124f0774cd3 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 08:57:18 +0300 Subject: [PATCH 02/15] [#1388] cli: Drop unused flag/parameter Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-cli/internal/client/client.go | 7 ------- cmd/frostfs-cli/modules/object/head.go | 3 --- 2 files changed, 10 deletions(-) diff --git a/cmd/frostfs-cli/internal/client/client.go b/cmd/frostfs-cli/internal/client/client.go index 03a987a57..dcd67f0d9 100644 --- a/cmd/frostfs-cli/internal/client/client.go +++ b/cmd/frostfs-cli/internal/client/client.go @@ -565,13 +565,6 @@ type HeadObjectPrm struct { commonObjectPrm objectAddressPrm rawPrm - - mainOnly bool -} - -// SetMainOnlyFlag sets flag to get only main fields of an object header in terms of FrostFS API. -func (x *HeadObjectPrm) SetMainOnlyFlag(v bool) { - x.mainOnly = v } // HeadObjectRes groups the resulting values of HeadObject operation. diff --git a/cmd/frostfs-cli/modules/object/head.go b/cmd/frostfs-cli/modules/object/head.go index 14797dc41..cf2e2d5e6 100644 --- a/cmd/frostfs-cli/modules/object/head.go +++ b/cmd/frostfs-cli/modules/object/head.go @@ -38,7 +38,6 @@ func initObjectHeadCmd() { _ = objectHeadCmd.MarkFlagRequired(commonflags.OIDFlag) flags.String(fileFlag, "", "File to write header to. Default: stdout.") - flags.Bool("main-only", false, "Return only main fields") flags.Bool(commonflags.JSON, false, "Marshal output in JSON") flags.Bool("proto", false, "Marshal output in Protobuf") flags.Bool(rawFlag, false, rawFlagDesc) @@ -49,7 +48,6 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { var obj oid.ID objAddr := readObjectAddress(cmd, &cnr, &obj) - mainOnly, _ := cmd.Flags().GetBool("main-only") pk := key.GetOrGenerate(cmd) cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC) @@ -62,7 +60,6 @@ func getObjectHeader(cmd *cobra.Command, _ []string) { raw, _ := cmd.Flags().GetBool(rawFlag) prm.SetRawFlag(raw) prm.SetAddress(objAddr) - prm.SetMainOnlyFlag(mainOnly) res, err := internalclient.HeadObject(cmd.Context(), prm) if err != nil { -- 2.45.2 From 09819fb975f00c7fc576eff5b4960107aac432fc Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:02:00 +0300 Subject: [PATCH 03/15] [#1388] metrics: Mark nolint:unused metrics Although these fields could be deleted, I annotated them so that all the metrics used would be defined in one place. Signed-off-by: Dmitrii Stepanov --- internal/metrics/innerring.go | 3 ++- internal/metrics/node.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/metrics/innerring.go b/internal/metrics/innerring.go index f6b14a632..f3f529d05 100644 --- a/internal/metrics/innerring.go +++ b/internal/metrics/innerring.go @@ -17,7 +17,8 @@ type InnerRingServiceMetrics struct { eventDuration *prometheus.HistogramVec morphCacheMetrics *morphCacheMetrics logMetrics logger.LogMetrics - appInfo *ApplicationInfo + // nolint: unused + appInfo *ApplicationInfo } // NewInnerRingMetrics returns new instance of metrics collectors for inner ring. diff --git a/internal/metrics/node.go b/internal/metrics/node.go index d9e401446..711387875 100644 --- a/internal/metrics/node.go +++ b/internal/metrics/node.go @@ -25,7 +25,8 @@ type NodeMetrics struct { morphClient *morphClientMetrics morphCache *morphCacheMetrics log logger.LogMetrics - appInfo *ApplicationInfo + // nolint: unused + appInfo *ApplicationInfo } func NewNodeMetrics() *NodeMetrics { -- 2.45.2 From d4811c408b193218bd8a9a05164df26a86990714 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:06:19 +0300 Subject: [PATCH 04/15] [#1388] governance: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/innerring/initialization.go | 1 - .../processors/governance/handlers_test.go | 21 ------------------- .../processors/governance/processor.go | 3 --- 3 files changed, 25 deletions(-) diff --git a/pkg/innerring/initialization.go b/pkg/innerring/initialization.go index 7da0a9794..c4aaeda56 100644 --- a/pkg/innerring/initialization.go +++ b/pkg/innerring/initialization.go @@ -163,7 +163,6 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli Log: s.log, Metrics: s.irMetrics, FrostFSClient: frostfsCli, - NetmapClient: s.netmapClient, AlphabetState: s, EpochState: s, Voter: s, diff --git a/pkg/innerring/processors/governance/handlers_test.go b/pkg/innerring/processors/governance/handlers_test.go index b73e24318..87040bdef 100644 --- a/pkg/innerring/processors/governance/handlers_test.go +++ b/pkg/innerring/processors/governance/handlers_test.go @@ -8,7 +8,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client" frostfscontract "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/frostfs" - nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/rolemanagement" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger/test" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" @@ -38,7 +37,6 @@ func TestHandleAlphabetSyncEvent(t *testing.T) { alphabetKeys: testKeys.mainnetKeys, } f := &testFrostFSClient{} - nm := &testNetmapClient{} proc, err := New( &Params{ @@ -50,7 +48,6 @@ func TestHandleAlphabetSyncEvent(t *testing.T) { MorphClient: m, MainnetClient: mn, FrostFSClient: f, - NetmapClient: nm, }, ) @@ -73,10 +70,6 @@ func TestHandleAlphabetSyncEvent(t *testing.T) { }, }, v.votes, "invalid vote calls") - var irUpdateExp []nmClient.UpdateIRPrm - - require.EqualValues(t, irUpdateExp, nm.updates, "invalid IR updates") - var expAlphabetUpdate client.UpdateAlphabetListPrm expAlphabetUpdate.SetHash(ev.txHash) expAlphabetUpdate.SetList(testKeys.newInnerRingExp) @@ -119,7 +112,6 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) { alphabetKeys: testKeys.mainnetKeys, } f := &testFrostFSClient{} - nm := &testNetmapClient{} proc, err := New( &Params{ @@ -131,7 +123,6 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) { MorphClient: m, MainnetClient: mn, FrostFSClient: f, - NetmapClient: nm, }, ) @@ -155,9 +146,6 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) { }, }, v.votes, "invalid vote calls") - var irUpdatesExp []nmClient.UpdateIRPrm - require.EqualValues(t, irUpdatesExp, nm.updates, "invalid IR updates") - var alpabetUpdExp client.UpdateAlphabetListPrm alpabetUpdExp.SetList(testKeys.newInnerRingExp) alpabetUpdExp.SetHash(ev.TxHash) @@ -293,12 +281,3 @@ func (c *testFrostFSClient) AlphabetUpdate(p frostfscontract.AlphabetUpdatePrm) c.updates = append(c.updates, p) return nil } - -type testNetmapClient struct { - updates []nmClient.UpdateIRPrm -} - -func (c *testNetmapClient) UpdateInnerRing(p nmClient.UpdateIRPrm) error { - c.updates = append(c.updates, p) - return nil -} diff --git a/pkg/innerring/processors/governance/processor.go b/pkg/innerring/processors/governance/processor.go index fa267eade..6daea417e 100644 --- a/pkg/innerring/processors/governance/processor.go +++ b/pkg/innerring/processors/governance/processor.go @@ -79,7 +79,6 @@ type ( metrics metrics.Register pool *ants.Pool frostfsClient FrostFSClient - netmapClient NetmapClient alphabetState AlphabetState epochState EpochState @@ -105,7 +104,6 @@ type ( MorphClient MorphClient MainnetClient MainnetClient FrostFSClient FrostFSClient - NetmapClient NetmapClient } ) @@ -146,7 +144,6 @@ func New(p *Params) (*Processor, error) { metrics: metricsRegister, pool: pool, frostfsClient: p.FrostFSClient, - netmapClient: p.NetmapClient, alphabetState: p.AlphabetState, epochState: p.EpochState, voter: p.Voter, -- 2.45.2 From 6223ff66e8fc1badc4cd96bd1611895556c6c119 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:08:11 +0300 Subject: [PATCH 05/15] [#1388] apeSvc: Drop unused and make annotations Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-node/config.go | 1 - cmd/frostfs-node/object.go | 1 - cmd/frostfs-node/policy_engine.go | 4 +++- pkg/ape/chainbase/option.go | 10 ---------- pkg/services/object/ape/service.go | 6 +----- 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 63f410b89..0ffa8c45b 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -1082,7 +1082,6 @@ func initAccessPolicyEngine(_ context.Context, c *cfg) { localOverrideDB = chainbase.NewInmemoryLocalOverrideDatabase() } else { localOverrideDB = chainbase.NewBoltLocalOverrideDatabase( - chainbase.WithLogger(c.log), chainbase.WithPath(nodeconfig.PersistentPolicyRules(c.appCfg).Path()), chainbase.WithPerm(nodeconfig.PersistentPolicyRules(c.appCfg).Perm()), chainbase.WithNoSync(nodeconfig.PersistentPolicyRules(c.appCfg).NoSync()), diff --git a/cmd/frostfs-node/object.go b/cmd/frostfs-node/object.go index 610e2c363..9d4e35ca8 100644 --- a/cmd/frostfs-node/object.go +++ b/cmd/frostfs-node/object.go @@ -473,7 +473,6 @@ func createACLServiceV2(c *cfg, apeSvc *objectAPE.Service, irFetcher *cachedIRFe func createAPEService(c *cfg, splitSvc *objectService.TransportSplitter) *objectAPE.Service { return objectAPE.NewService( - c.log, objectAPE.NewChecker( c.cfgObject.cfgAccessPolicyEngine.accessPolicyEngine.LocalStorage(), c.cfgObject.cfgAccessPolicyEngine.accessPolicyEngine.MorphRuleChainStorage(), diff --git a/cmd/frostfs-node/policy_engine.go b/cmd/frostfs-node/policy_engine.go index 22fda2b4c..55f76cc76 100644 --- a/cmd/frostfs-node/policy_engine.go +++ b/cmd/frostfs-node/policy_engine.go @@ -21,7 +21,9 @@ type accessPolicyEngine struct { var _ engine.MorphRuleChainStorageReader = (*morphAPEChainCache)(nil) type morphAPEChainCacheKey struct { - name chain.Name + // nolint:unused + name chain.Name + // nolint:unused target engine.Target } diff --git a/pkg/ape/chainbase/option.go b/pkg/ape/chainbase/option.go index e547701fb..590b7a885 100644 --- a/pkg/ape/chainbase/option.go +++ b/pkg/ape/chainbase/option.go @@ -5,9 +5,7 @@ import ( "os" "time" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "go.etcd.io/bbolt" - "go.uber.org/zap" ) type Option func(*cfg) @@ -18,7 +16,6 @@ type cfg struct { noSync bool maxBatchDelay time.Duration maxBatchSize int - log *logger.Logger } func defaultCfg() *cfg { @@ -26,7 +23,6 @@ func defaultCfg() *cfg { perm: os.ModePerm, maxBatchDelay: bbolt.DefaultMaxBatchDelay, maxBatchSize: bbolt.DefaultMaxBatchSize, - log: &logger.Logger{Logger: zap.L()}, } } @@ -59,9 +55,3 @@ func WithMaxBatchSize(maxBatchSize int) Option { c.maxBatchSize = maxBatchSize } } - -func WithLogger(l *logger.Logger) Option { - return func(c *cfg) { - c.log = l - } -} diff --git a/pkg/services/object/ape/service.go b/pkg/services/object/ape/service.go index a1634e7c5..6eedaf99e 100644 --- a/pkg/services/object/ape/service.go +++ b/pkg/services/object/ape/service.go @@ -12,7 +12,6 @@ import ( objectSvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object" getsvc "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/get" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/bearer" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" @@ -24,8 +23,6 @@ import ( var errFailedToCastToRequestContext = errors.New("failed cast to RequestContext") type Service struct { - log *logger.Logger - apeChecker Checker next objectSvc.ServiceServer @@ -67,9 +64,8 @@ func NewStorageEngineHeaderProvider(e *engine.StorageEngine, s *getsvc.Service) } } -func NewService(log *logger.Logger, apeChecker Checker, next objectSvc.ServiceServer) *Service { +func NewService(apeChecker Checker, next objectSvc.ServiceServer) *Service { return &Service{ - log: log, apeChecker: apeChecker, next: next, } -- 2.45.2 From 0c87e187fc592c659fd3f1d0317d71c5bcda806e Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:10:03 +0300 Subject: [PATCH 06/15] [#1388] getSvc: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/services/object/get/assembleec.go | 2 +- pkg/services/object/get/assemblerec.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/services/object/get/assembleec.go b/pkg/services/object/get/assembleec.go index a58602bf7..03f913bbf 100644 --- a/pkg/services/object/get/assembleec.go +++ b/pkg/services/object/get/assembleec.go @@ -43,7 +43,7 @@ func (r *request) assembleEC(ctx context.Context) { } r.prm.common = r.prm.common.WithLocalOnly(false) - assembler := newAssemblerEC(r.address(), r.infoEC, r.ctxRange(), r, r.localStorage, r.containerSource, r.log, r.headOnly(), r.traverserGenerator, r.curProcEpoch) + assembler := newAssemblerEC(r.address(), r.infoEC, r.ctxRange(), r, r.localStorage, r.log, r.headOnly(), r.traverserGenerator, r.curProcEpoch) r.log.Debug(logs.GetAssemblingECObject, zap.Uint64("range_offset", r.ctxRange().GetOffset()), diff --git a/pkg/services/object/get/assemblerec.go b/pkg/services/object/get/assemblerec.go index dde0d7dad..44d9af3a2 100644 --- a/pkg/services/object/get/assemblerec.go +++ b/pkg/services/object/get/assemblerec.go @@ -34,7 +34,6 @@ type assemblerec struct { rng *objectSDK.Range remoteStorage ecRemoteStorage localStorage localStorage - cs container.Source log *logger.Logger head bool traverserGenerator traverserGenerator @@ -47,7 +46,6 @@ func newAssemblerEC( rng *objectSDK.Range, remoteStorage ecRemoteStorage, localStorage localStorage, - cs container.Source, log *logger.Logger, head bool, tg traverserGenerator, @@ -59,7 +57,6 @@ func newAssemblerEC( ecInfo: ecInfo, remoteStorage: remoteStorage, localStorage: localStorage, - cs: cs, log: log, head: head, traverserGenerator: tg, -- 2.45.2 From 93fefe9970ba6e74c2df2cfba7b3d55d3fe8d7da Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:10:38 +0300 Subject: [PATCH 07/15] [#1388] engine: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/local_object_storage/engine/control.go | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pkg/local_object_storage/engine/control.go b/pkg/local_object_storage/engine/control.go index 4778cf539..80fb3f9ed 100644 --- a/pkg/local_object_storage/engine/control.go +++ b/pkg/local_object_storage/engine/control.go @@ -249,23 +249,9 @@ func (e *StorageEngine) ResumeExecution() error { } type ReConfiguration struct { - errorsThreshold uint32 - shardPoolSize uint32 - shards map[string][]shard.Option // meta path -> shard opts } -// SetErrorsThreshold sets a size amount of errors after which -// shard is moved to read-only mode. -func (rCfg *ReConfiguration) SetErrorsThreshold(errorsThreshold uint32) { - rCfg.errorsThreshold = errorsThreshold -} - -// SetShardPoolSize sets a size of worker pool for each shard. -func (rCfg *ReConfiguration) SetShardPoolSize(shardPoolSize uint32) { - rCfg.shardPoolSize = shardPoolSize -} - // AddShard adds a shard for the reconfiguration. // Shard identifier is calculated from paths used in blobstor. func (rCfg *ReConfiguration) AddShard(id string, opts []shard.Option) { -- 2.45.2 From afeda1f3d789ec783a9c10a072a763de5e14b089 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:11:15 +0300 Subject: [PATCH 08/15] [#1388] blobstor: Drop unused Signed-off-by: Dmitrii Stepanov --- .../blobstor/memstore/control.go | 16 ++++++++-------- .../blobstor/memstore/memstore_test.go | 2 -- .../blobstor/memstore/option.go | 15 +-------------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/pkg/local_object_storage/blobstor/memstore/control.go b/pkg/local_object_storage/blobstor/memstore/control.go index 449d4352a..83da52eb7 100644 --- a/pkg/local_object_storage/blobstor/memstore/control.go +++ b/pkg/local_object_storage/blobstor/memstore/control.go @@ -10,11 +10,11 @@ func (s *memstoreImpl) Open(mod mode.ComponentMode) error { return nil } -func (s *memstoreImpl) Init() error { return nil } -func (s *memstoreImpl) Close() error { return nil } -func (s *memstoreImpl) Type() string { return Type } -func (s *memstoreImpl) Path() string { return s.rootPath } -func (s *memstoreImpl) SetCompressor(cc *compression.Config) { s.compression = cc } -func (s *memstoreImpl) Compressor() *compression.Config { return s.compression } -func (s *memstoreImpl) SetReportErrorFunc(f func(string, error)) { s.reportError = f } -func (s *memstoreImpl) SetParentID(string) {} +func (s *memstoreImpl) Init() error { return nil } +func (s *memstoreImpl) Close() error { return nil } +func (s *memstoreImpl) Type() string { return Type } +func (s *memstoreImpl) Path() string { return s.rootPath } +func (s *memstoreImpl) SetCompressor(cc *compression.Config) { s.compression = cc } +func (s *memstoreImpl) Compressor() *compression.Config { return s.compression } +func (s *memstoreImpl) SetReportErrorFunc(func(string, error)) {} +func (s *memstoreImpl) SetParentID(string) {} diff --git a/pkg/local_object_storage/blobstor/memstore/memstore_test.go b/pkg/local_object_storage/blobstor/memstore/memstore_test.go index 8d1480dff..dd130e5f9 100644 --- a/pkg/local_object_storage/blobstor/memstore/memstore_test.go +++ b/pkg/local_object_storage/blobstor/memstore/memstore_test.go @@ -8,7 +8,6 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/internal/blobstortest" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger/test" objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" "github.com/stretchr/testify/require" ) @@ -16,7 +15,6 @@ import ( func TestSimpleLifecycle(t *testing.T) { s := New( WithRootPath("memstore"), - WithLogger(test.NewLogger(t)), ) defer func() { require.NoError(t, s.Close()) }() require.NoError(t, s.Open(mode.ComponentReadWrite)) diff --git a/pkg/local_object_storage/blobstor/memstore/option.go b/pkg/local_object_storage/blobstor/memstore/option.go index 3d67b1e9c..97a03993d 100644 --- a/pkg/local_object_storage/blobstor/memstore/option.go +++ b/pkg/local_object_storage/blobstor/memstore/option.go @@ -2,33 +2,20 @@ package memstore import ( "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/compression" - "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/util/logger" - "go.uber.org/zap" ) type cfg struct { - log *logger.Logger rootPath string readOnly bool compression *compression.Config - reportError func(string, error) } func defaultConfig() *cfg { - return &cfg{ - log: &logger.Logger{Logger: zap.L()}, - reportError: func(string, error) {}, - } + return &cfg{} } type Option func(*cfg) -func WithLogger(l *logger.Logger) Option { - return func(c *cfg) { - c.log = l - } -} - func WithRootPath(p string) Option { return func(c *cfg) { c.rootPath = p -- 2.45.2 From 8ffce7694564d95423103767e5bafe87053cfc03 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:12:01 +0300 Subject: [PATCH 09/15] [#1388] metabase: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/local_object_storage/metabase/delete.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/local_object_storage/metabase/delete.go b/pkg/local_object_storage/metabase/delete.go index 00c8d06e0..0e8ca7fc7 100644 --- a/pkg/local_object_storage/metabase/delete.go +++ b/pkg/local_object_storage/metabase/delete.go @@ -77,8 +77,6 @@ func (p *DeletePrm) SetAddresses(addrs ...oid.Address) { type referenceNumber struct { all, cur int - addr oid.Address - obj *objectSDK.Object } @@ -295,9 +293,8 @@ func (db *DB) delete(tx *bbolt.Tx, addr oid.Address, refCounter referenceCounter nRef, ok := refCounter[k] if !ok { nRef = &referenceNumber{ - all: parentLength(tx, parAddr), - addr: parAddr, - obj: parent, + all: parentLength(tx, parAddr), + obj: parent, } refCounter[k] = nRef -- 2.45.2 From e5f0541b281fa989a05bb2f62bf9ccc3f3227071 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:12:32 +0300 Subject: [PATCH 10/15] [#1388] signSvc: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/services/object/sign.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/services/object/sign.go b/pkg/services/object/sign.go index 35367aafe..f5ae97b62 100644 --- a/pkg/services/object/sign.go +++ b/pkg/services/object/sign.go @@ -10,8 +10,6 @@ import ( ) type SignService struct { - key *ecdsa.PrivateKey - sigSvc *util.SignService svc ServiceServer @@ -48,7 +46,6 @@ type getRangeStreamSigner struct { func NewSignService(key *ecdsa.PrivateKey, svc ServiceServer) *SignService { return &SignService{ - key: key, sigSvc: util.NewUnarySignService(key), svc: svc, } -- 2.45.2 From 309142e913ab594dc37cda32243995367d5fa15c Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:12:54 +0300 Subject: [PATCH 11/15] [#1388] sessionSvc: Add nolint annotations Used as map key. Signed-off-by: Dmitrii Stepanov --- pkg/services/session/storage/temporary/storage.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/services/session/storage/temporary/storage.go b/pkg/services/session/storage/temporary/storage.go index ee93dee71..9ae9db9dc 100644 --- a/pkg/services/session/storage/temporary/storage.go +++ b/pkg/services/session/storage/temporary/storage.go @@ -9,7 +9,9 @@ import ( ) type key struct { + // nolint:unused tokenID string + // nolint:unused ownerID string } -- 2.45.2 From 46a007ed52620d22f8e6ba2dffcd0c5a2d2693f8 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 09:13:27 +0300 Subject: [PATCH 12/15] [#1388] node: Drop unused Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-node/config.go | 1 - cmd/frostfs-node/container.go | 6 ------ cmd/frostfs-node/netmap.go | 1 - 3 files changed, 8 deletions(-) diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 0ffa8c45b..c625b575f 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -602,7 +602,6 @@ type cfgNetmap struct { needBootstrap bool reBoostrapTurnedOff *atomic.Bool // managed by control service in runtime - startEpoch uint64 // epoch number when application is started } type cfgNodeInfo struct { diff --git a/cmd/frostfs-node/container.go b/cmd/frostfs-node/container.go index 5a29aac76..6733140d2 100644 --- a/cmd/frostfs-node/container.go +++ b/cmd/frostfs-node/container.go @@ -128,9 +128,6 @@ func configureEACLAndContainerSources(c *cfg, client *cntClient.Client, cnrSrc c cnrRdr.lister = client cnrRdr.eacl = c.cfgObject.eaclSource cnrRdr.src = c.cfgObject.cnrSource - - cnrWrt.cacheEnabled = true - cnrWrt.eacls = cachedEACLStorage } return cnrRdr, cnrWrt @@ -247,9 +244,6 @@ func (x *morphContainerReader) ContainersOf(id *user.ID) ([]cid.ID, error) { type morphContainerWriter struct { neoClient *cntClient.Client - - cacheEnabled bool - eacls ttlEACLStorage } func (m morphContainerWriter) Put(cnr containerCore.Container) (*cid.ID, error) { diff --git a/cmd/frostfs-node/netmap.go b/cmd/frostfs-node/netmap.go index c0b87492c..5e4585f85 100644 --- a/cmd/frostfs-node/netmap.go +++ b/cmd/frostfs-node/netmap.go @@ -259,7 +259,6 @@ func initNetmapState(c *cfg) { } c.cfgNetmap.state.setCurrentEpoch(epoch) - c.cfgNetmap.startEpoch = epoch c.setContractNodeInfo(ni) } -- 2.45.2 From e4d75b115f22ac748db77d6115de3f654e2d91f7 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Mon, 23 Sep 2024 10:51:05 +0300 Subject: [PATCH 13/15] [#1388] ir: Annotate cmode as nolint Signed-off-by: Dmitrii Stepanov --- pkg/innerring/innerring.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 50a37845b..53a07e36c 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -103,6 +103,8 @@ type ( // to the application. runners []func(chan<- error) error + // cmode used for upgrade scenario. + // nolint:unused cmode *atomic.Bool } -- 2.45.2 From b1d6b4b54a436dfab5f39591bdbf2aec0b5a9329 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 24 Sep 2024 12:13:11 +0300 Subject: [PATCH 14/15] [#1388] putSvc: Drop unused Signed-off-by: Dmitrii Stepanov --- pkg/services/object/put/prm.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pkg/services/object/put/prm.go b/pkg/services/object/put/prm.go index 0c8f12b45..52a7c102c 100644 --- a/pkg/services/object/put/prm.go +++ b/pkg/services/object/put/prm.go @@ -2,7 +2,6 @@ package putsvc import ( "context" - "crypto/ecdsa" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/object/util" @@ -21,8 +20,6 @@ type PutInitPrm struct { traverseOpts []placement.Option relay func(context.Context, client.NodeInfo, client.MultiAddressClient) error - - privateKey *ecdsa.PrivateKey } type PutChunkPrm struct { @@ -68,11 +65,3 @@ func (p *PutChunkPrm) WithChunk(v []byte) *PutChunkPrm { return p } - -func (p *PutInitPrm) WithPrivateKey(v *ecdsa.PrivateKey) *PutInitPrm { - if p != nil { - p.privateKey = v - } - - return p -} -- 2.45.2 From 62c8e6554cdfbf5bf9c122d19776a09a968afaab Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 24 Sep 2024 15:58:52 +0300 Subject: [PATCH 15/15] [#1388] lens: Add nolint annotations Signed-off-by: Dmitrii Stepanov --- cmd/frostfs-lens/internal/schema/common/raw.go | 2 ++ cmd/frostfs-lens/internal/schema/writecache/types.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cmd/frostfs-lens/internal/schema/common/raw.go b/cmd/frostfs-lens/internal/schema/common/raw.go index 0990e24c3..55051554c 100644 --- a/cmd/frostfs-lens/internal/schema/common/raw.go +++ b/cmd/frostfs-lens/internal/schema/common/raw.go @@ -7,6 +7,8 @@ import ( ) type RawEntry struct { + // key and value used for record dump. + // nolint:unused key, value []byte } diff --git a/cmd/frostfs-lens/internal/schema/writecache/types.go b/cmd/frostfs-lens/internal/schema/writecache/types.go index 3f71c5366..11e6f3fcd 100644 --- a/cmd/frostfs-lens/internal/schema/writecache/types.go +++ b/cmd/frostfs-lens/internal/schema/writecache/types.go @@ -16,6 +16,8 @@ type ( DefaultRecord struct { addr oid.Address + // data used for record dump. + // nolint:unused data []byte } ) -- 2.45.2