forked from TrueCloudLab/frostfs-node
[#973] node: Resolve revive: unused-parameter linter
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
dacf580b87
commit
66a26b7775
34 changed files with 41 additions and 41 deletions
|
@ -32,7 +32,7 @@ var (
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
_ = viper.BindPFlag(commonflags.RefillGasAmountFlag, cmd.Flags().Lookup(commonflags.RefillGasAmountFlag))
|
_ = viper.BindPFlag(commonflags.RefillGasAmountFlag, cmd.Flags().Lookup(commonflags.RefillGasAmountFlag))
|
||||||
},
|
},
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
||||||
return refillGas(cmd, commonflags.RefillGasAmountFlag, false)
|
return refillGas(cmd, commonflags.RefillGasAmountFlag, false)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ var (
|
||||||
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
},
|
},
|
||||||
RunE: SetPolicyCmd,
|
RunE: SetPolicyCmd,
|
||||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
ValidArgsFunction: func(_ *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {
|
||||||
return []string{"ExecFeeFactor=", "StoragePrice=", "FeePerByte="}, cobra.ShellCompDirectiveNoSpace
|
return []string{"ExecFeeFactor=", "StoragePrice=", "FeePerByte="}, cobra.ShellCompDirectiveNoSpace
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ type PutObjectPrm struct {
|
||||||
|
|
||||||
rdr io.Reader
|
rdr io.Reader
|
||||||
|
|
||||||
headerCallback func(*objectSDK.Object)
|
headerCallback func()
|
||||||
|
|
||||||
prepareLocally bool
|
prepareLocally bool
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ func (x *PutObjectPrm) SetPayloadReader(rdr io.Reader) {
|
||||||
|
|
||||||
// SetHeaderCallback sets callback which is called on the object after the header is received
|
// SetHeaderCallback sets callback which is called on the object after the header is received
|
||||||
// but before the payload is written.
|
// but before the payload is written.
|
||||||
func (x *PutObjectPrm) SetHeaderCallback(f func(*objectSDK.Object)) {
|
func (x *PutObjectPrm) SetHeaderCallback(f func()) {
|
||||||
x.headerCallback = f
|
x.headerCallback = f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ func PutObject(ctx context.Context, prm PutObjectPrm) (*PutObjectRes, error) {
|
||||||
|
|
||||||
if wrt.WriteHeader(ctx, *prm.hdr) {
|
if wrt.WriteHeader(ctx, *prm.hdr) {
|
||||||
if prm.headerCallback != nil {
|
if prm.headerCallback != nil {
|
||||||
prm.headerCallback(prm.hdr)
|
prm.headerCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
sz := prm.hdr.PayloadSize()
|
sz := prm.hdr.PayloadSize()
|
||||||
|
|
|
@ -23,7 +23,7 @@ var accountingBalanceCmd = &cobra.Command{
|
||||||
Use: "balance",
|
Use: "balance",
|
||||||
Short: "Get internal balance of FrostFS account",
|
Short: "Get internal balance of FrostFS account",
|
||||||
Long: `Get internal balance of FrostFS account`,
|
Long: `Get internal balance of FrostFS account`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
var idUser user.ID
|
var idUser user.ID
|
||||||
|
|
||||||
pk := key.GetOrGenerate(cmd)
|
pk := key.GetOrGenerate(cmd)
|
||||||
|
|
|
@ -11,7 +11,7 @@ var Cmd = &cobra.Command{
|
||||||
Use: "accounting",
|
Use: "accounting",
|
||||||
Short: "Operations with accounts and balances",
|
Short: "Operations with accounts and balances",
|
||||||
Long: `Operations with accounts and balances`,
|
Long: `Operations with accounts and balances`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
|
|
||||||
_ = viper.BindPFlag(commonflags.WalletPath, flags.Lookup(commonflags.WalletPath))
|
_ = viper.BindPFlag(commonflags.WalletPath, flags.Lookup(commonflags.WalletPath))
|
||||||
|
|
|
@ -38,7 +38,7 @@ var createContainerCmd = &cobra.Command{
|
||||||
Short: "Create new container",
|
Short: "Create new container",
|
||||||
Long: `Create new container and register it in the FrostFS.
|
Long: `Create new container and register it in the FrostFS.
|
||||||
It will be stored in sidechain when inner ring will accepts it.`,
|
It will be stored in sidechain when inner ring will accepts it.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
placementPolicy, err := parseContainerPolicy(cmd, containerPolicy)
|
placementPolicy, err := parseContainerPolicy(cmd, containerPolicy)
|
||||||
commonCmd.ExitOnErr(cmd, "", err)
|
commonCmd.ExitOnErr(cmd, "", err)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ var deleteContainerCmd = &cobra.Command{
|
||||||
Short: "Delete existing container",
|
Short: "Delete existing container",
|
||||||
Long: `Delete existing container.
|
Long: `Delete existing container.
|
||||||
Only owner of the container has a permission to remove container.`,
|
Only owner of the container has a permission to remove container.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
id := parseContainerID(cmd)
|
id := parseContainerID(cmd)
|
||||||
|
|
||||||
tok := getSession(cmd)
|
tok := getSession(cmd)
|
||||||
|
|
|
@ -33,7 +33,7 @@ var getContainerInfoCmd = &cobra.Command{
|
||||||
Use: "get",
|
Use: "get",
|
||||||
Short: "Get container field info",
|
Short: "Get container field info",
|
||||||
Long: `Get container field info`,
|
Long: `Get container field info`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
cnr, _ := getContainer(cmd)
|
cnr, _ := getContainer(cmd)
|
||||||
|
|
||||||
prettyPrintContainer(cmd, cnr, containerJSON)
|
prettyPrintContainer(cmd, cnr, containerJSON)
|
||||||
|
|
|
@ -16,7 +16,7 @@ var getExtendedACLCmd = &cobra.Command{
|
||||||
Use: "get-eacl",
|
Use: "get-eacl",
|
||||||
Short: "Get extended ACL table of container",
|
Short: "Get extended ACL table of container",
|
||||||
Long: `Get extended ACL table of container`,
|
Long: `Get extended ACL table of container`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
id := parseContainerID(cmd)
|
id := parseContainerID(cmd)
|
||||||
pk := key.GetOrGenerate(cmd)
|
pk := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, pk, commonflags.RPC)
|
||||||
|
|
|
@ -31,7 +31,7 @@ var listContainersCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List all created containers",
|
Short: "List all created containers",
|
||||||
Long: "List all created containers",
|
Long: "List all created containers",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
var idUser user.ID
|
var idUser user.ID
|
||||||
|
|
||||||
key := key.GetOrGenerate(cmd)
|
key := key.GetOrGenerate(cmd)
|
||||||
|
|
|
@ -28,7 +28,7 @@ var listContainerObjectsCmd = &cobra.Command{
|
||||||
Use: "list-objects",
|
Use: "list-objects",
|
||||||
Short: "List existing objects in container",
|
Short: "List existing objects in container",
|
||||||
Long: `List existing objects in container`,
|
Long: `List existing objects in container`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
id := parseContainerID(cmd)
|
id := parseContainerID(cmd)
|
||||||
|
|
||||||
filters := new(objectSDK.SearchFilters)
|
filters := new(objectSDK.SearchFilters)
|
||||||
|
|
|
@ -19,7 +19,7 @@ var containerNodesCmd = &cobra.Command{
|
||||||
Use: "nodes",
|
Use: "nodes",
|
||||||
Short: "Show nodes for container",
|
Short: "Show nodes for container",
|
||||||
Long: "Show nodes taking part in a container at the current epoch.",
|
Long: "Show nodes taking part in a container at the current epoch.",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
cnr, pkey := getContainer(cmd)
|
cnr, pkey := getContainer(cmd)
|
||||||
|
|
||||||
if pkey == nil {
|
if pkey == nil {
|
||||||
|
|
|
@ -10,7 +10,7 @@ var Cmd = &cobra.Command{
|
||||||
Use: "container",
|
Use: "container",
|
||||||
Short: "Operations with containers",
|
Short: "Operations with containers",
|
||||||
Long: "Operations with containers",
|
Long: "Operations with containers",
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
// bind exactly that cmd's flags to
|
// bind exactly that cmd's flags to
|
||||||
// the viper before execution
|
// the viper before execution
|
||||||
commonflags.Bind(cmd)
|
commonflags.Bind(cmd)
|
||||||
|
|
|
@ -25,7 +25,7 @@ var setExtendedACLCmd = &cobra.Command{
|
||||||
Short: "Set new extended ACL table for container",
|
Short: "Set new extended ACL table for container",
|
||||||
Long: `Set new extended ACL table for container.
|
Long: `Set new extended ACL table for container.
|
||||||
Container ID in EACL table will be substituted with ID from the CLI.`,
|
Container ID in EACL table will be substituted with ID from the CLI.`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
id := parseContainerID(cmd)
|
id := parseContainerID(cmd)
|
||||||
eaclTable := common.ReadEACL(cmd, flagVarsSetEACL.srcPath)
|
eaclTable := common.ReadEACL(cmd, flagVarsSetEACL.srcPath)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ var dropObjectsCmd = &cobra.Command{
|
||||||
Use: "drop-objects",
|
Use: "drop-objects",
|
||||||
Short: "Drop objects from the node's local storage",
|
Short: "Drop objects from the node's local storage",
|
||||||
Long: "Drop objects from the node's local storage",
|
Long: "Drop objects from the node's local storage",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
pk := key.Get(cmd)
|
pk := key.Get(cmd)
|
||||||
|
|
||||||
dropObjectsList, _ := cmd.Flags().GetStringSlice(dropObjectsFlag)
|
dropObjectsList, _ := cmd.Flags().GetStringSlice(dropObjectsFlag)
|
||||||
|
|
|
@ -10,7 +10,7 @@ var Cmd = &cobra.Command{
|
||||||
Use: "control",
|
Use: "control",
|
||||||
Short: "Operations with storage node",
|
Short: "Operations with storage node",
|
||||||
Long: `Operations with storage node`,
|
Long: `Operations with storage node`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
ff := cmd.Flags()
|
ff := cmd.Flags()
|
||||||
|
|
||||||
_ = viper.BindPFlag(commonflags.WalletPath, ff.Lookup(commonflags.WalletPath))
|
_ = viper.BindPFlag(commonflags.WalletPath, ff.Lookup(commonflags.WalletPath))
|
||||||
|
|
|
@ -12,7 +12,7 @@ var getEpochCmd = &cobra.Command{
|
||||||
Use: "epoch",
|
Use: "epoch",
|
||||||
Short: "Get current epoch number",
|
Short: "Get current epoch number",
|
||||||
Long: "Get current epoch number",
|
Long: "Get current epoch number",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ var netInfoCmd = &cobra.Command{
|
||||||
Use: "netinfo",
|
Use: "netinfo",
|
||||||
Short: "Get information about FrostFS network",
|
Short: "Get information about FrostFS network",
|
||||||
Long: "Get information about FrostFS network",
|
Long: "Get information about FrostFS network",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ var nodeInfoCmd = &cobra.Command{
|
||||||
Use: "nodeinfo",
|
Use: "nodeinfo",
|
||||||
Short: "Get target node info",
|
Short: "Get target node info",
|
||||||
Long: `Get target node info`,
|
Long: `Get target node info`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ var Cmd = &cobra.Command{
|
||||||
Use: "netmap",
|
Use: "netmap",
|
||||||
Short: "Operations with Network Map",
|
Short: "Operations with Network Map",
|
||||||
Long: `Operations with Network Map`,
|
Long: `Operations with Network Map`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
// bind exactly that cmd's flags to
|
// bind exactly that cmd's flags to
|
||||||
// the viper before execution
|
// the viper before execution
|
||||||
commonflags.Bind(cmd)
|
commonflags.Bind(cmd)
|
||||||
|
|
|
@ -12,7 +12,7 @@ var snapshotCmd = &cobra.Command{
|
||||||
Use: "snapshot",
|
Use: "snapshot",
|
||||||
Short: "Request current local snapshot of the network map",
|
Short: "Request current local snapshot of the network map",
|
||||||
Long: `Request current local snapshot of the network map`,
|
Long: `Request current local snapshot of the network map`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, _ []string) {
|
||||||
p := key.GetOrGenerate(cmd)
|
p := key.GetOrGenerate(cmd)
|
||||||
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
cli := internalclient.GetSDKClientByFlag(cmd, p, commonflags.RPC)
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ func setFilePayloadReader(cmd *cobra.Command, f *os.File, prm *internalclient.Pu
|
||||||
p := pb.New64(fi.Size())
|
p := pb.New64(fi.Size())
|
||||||
p.Output = cmd.OutOrStdout()
|
p.Output = cmd.OutOrStdout()
|
||||||
prm.SetPayloadReader(p.NewProxyReader(f))
|
prm.SetPayloadReader(p.NewProxyReader(f))
|
||||||
prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() })
|
prm.SetHeaderCallback(func() { p.Start() })
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ func setBinaryPayloadReader(cmd *cobra.Command, obj *objectSDK.Object, prm *inte
|
||||||
p := pb.New(len(obj.Payload()))
|
p := pb.New(len(obj.Payload()))
|
||||||
p.Output = cmd.OutOrStdout()
|
p.Output = cmd.OutOrStdout()
|
||||||
prm.SetPayloadReader(p.NewProxyReader(payloadReader))
|
prm.SetPayloadReader(p.NewProxyReader(payloadReader))
|
||||||
prm.SetHeaderCallback(func(o *objectSDK.Object) { p.Start() })
|
prm.SetHeaderCallback(func() { p.Start() })
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ var Cmd = &cobra.Command{
|
||||||
Use: "object",
|
Use: "object",
|
||||||
Short: "Operations with Objects",
|
Short: "Operations with Objects",
|
||||||
Long: `Operations with Objects`,
|
Long: `Operations with Objects`,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
// bind exactly that cmd's flags to
|
// bind exactly that cmd's flags to
|
||||||
// the viper before execution
|
// the viper before execution
|
||||||
commonflags.Bind(cmd)
|
commonflags.Bind(cmd)
|
||||||
|
|
|
@ -29,7 +29,7 @@ var createCmd = &cobra.Command{
|
||||||
Use: "create",
|
Use: "create",
|
||||||
Short: "Create session token",
|
Short: "Create session token",
|
||||||
Run: createSession,
|
Run: createSession,
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
_ = viper.BindPFlag(commonflags.WalletPath, cmd.Flags().Lookup(commonflags.WalletPath))
|
_ = viper.BindPFlag(commonflags.WalletPath, cmd.Flags().Lookup(commonflags.WalletPath))
|
||||||
_ = viper.BindPFlag(commonflags.Account, cmd.Flags().Lookup(commonflags.Account))
|
_ = viper.BindPFlag(commonflags.Account, cmd.Flags().Lookup(commonflags.Account))
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
var Cmd = &cobra.Command{
|
var Cmd = &cobra.Command{
|
||||||
Use: "util",
|
Use: "util",
|
||||||
Short: "Utility operations",
|
Short: "Utility operations",
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
|
|
||||||
_ = viper.BindPFlag(commonflags.GenerateKey, flags.Lookup(commonflags.GenerateKey))
|
_ = viper.BindPFlag(commonflags.GenerateKey, flags.Lookup(commonflags.GenerateKey))
|
||||||
|
|
|
@ -925,7 +925,7 @@ func (c *cfg) getSubstorageOpts(shCfg shardCfg) []blobstor.SubStorage {
|
||||||
|
|
||||||
ss = append(ss, blobstor.SubStorage{
|
ss = append(ss, blobstor.SubStorage{
|
||||||
Storage: fstree.New(fstreeOpts...),
|
Storage: fstree.New(fstreeOpts...),
|
||||||
Policy: func(_ *objectSDK.Object, data []byte) bool {
|
Policy: func(_ *objectSDK.Object, _ []byte) bool {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -176,7 +176,7 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
||||||
c.cfgNetmap.state.setCurrentEpoch(ev.(netmapEvent.NewEpoch).EpochNumber())
|
c.cfgNetmap.state.setCurrentEpoch(ev.(netmapEvent.NewEpoch).EpochNumber())
|
||||||
})
|
})
|
||||||
|
|
||||||
addNewEpochAsyncNotificationHandler(c, func(ev event.Event) {
|
addNewEpochAsyncNotificationHandler(c, func(_ event.Event) {
|
||||||
if !c.needBootstrap() || c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
if !c.needBootstrap() || c.cfgNetmap.reBoostrapTurnedOff.Load() { // fixes #470
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ func addNewEpochNotificationHandlers(c *cfg) {
|
||||||
})
|
})
|
||||||
|
|
||||||
if c.cfgMorph.notaryEnabled {
|
if c.cfgMorph.notaryEnabled {
|
||||||
addNewEpochAsyncNotificationHandler(c, func(ev event.Event) {
|
addNewEpochAsyncNotificationHandler(c, func(_ event.Event) {
|
||||||
_, err := makeNotaryDeposit(c)
|
_, err := makeNotaryDeposit(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log.Error(logs.FrostFSNodeCouldNotMakeNotaryDeposit,
|
c.log.Error(logs.FrostFSNodeCouldNotMakeNotaryDeposit,
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (b *Blobovnicza) initializeCounters() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.iterateAllDataBuckets(tx, func(lower, upper uint64, b *bbolt.Bucket) (bool, error) {
|
return b.iterateAllDataBuckets(tx, func(_, _ uint64, b *bbolt.Bucket) (bool, error) {
|
||||||
return false, b.ForEach(func(k, v []byte) error {
|
return false, b.ForEach(func(k, v []byte) error {
|
||||||
size += uint64(len(k) + len(v))
|
size += uint64(len(k) + len(v))
|
||||||
items++
|
items++
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (db *DB) init(reset bool) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.ForEach(func(name []byte, b *bbolt.Bucket) error {
|
err = tx.ForEach(func(name []byte, _ *bbolt.Bucket) error {
|
||||||
if _, ok := mStaticBuckets[string(name)]; !ok {
|
if _, ok := mStaticBuckets[string(name)]; !ok {
|
||||||
return tx.DeleteBucket(name)
|
return tx.DeleteBucket(name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,7 +354,7 @@ func isTomb(graveyardBucket *bbolt.Bucket, key []byte) (bool, error) {
|
||||||
|
|
||||||
// iterate over graveyard and check if target address
|
// iterate over graveyard and check if target address
|
||||||
// is the address of tombstone in graveyard.
|
// is the address of tombstone in graveyard.
|
||||||
err := graveyardBucket.ForEach(func(k, v []byte) error {
|
err := graveyardBucket.ForEach(func(_, v []byte) error {
|
||||||
// check if graveyard has record with key corresponding
|
// check if graveyard has record with key corresponding
|
||||||
// to tombstone address (at least one)
|
// to tombstone address (at least one)
|
||||||
targetIsTomb = bytes.Equal(v, key)
|
targetIsTomb = bytes.Equal(v, key)
|
||||||
|
|
|
@ -174,7 +174,7 @@ func selectAllFromBucket(tx *bbolt.Tx, name []byte, to map[string]int, fNum int)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = bkt.ForEach(func(k, v []byte) error {
|
_ = bkt.ForEach(func(k, _ []byte) error {
|
||||||
markAddressInCache(to, fNum, string(k))
|
markAddressInCache(to, fNum, string(k))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -386,7 +386,7 @@ func (db *DB) selectFromList(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = fMatch.matchBucket(bkt, f.Header(), f.Value(), func(key, val []byte) error {
|
if err = fMatch.matchBucket(bkt, f.Header(), f.Value(), func(_, val []byte) error {
|
||||||
l, err := decodeList(val)
|
l, err := decodeList(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
db.log.Debug(logs.MetabaseCantDecodeListBucketLeaf,
|
db.log.Debug(logs.MetabaseCantDecodeListBucketLeaf,
|
||||||
|
@ -459,7 +459,7 @@ func (db *DB) selectObjectID(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := fMatch.matchBucket(bkt, f.Header(), f.Value(), func(k, v []byte) error {
|
err := fMatch.matchBucket(bkt, f.Header(), f.Value(), func(k, _ []byte) error {
|
||||||
var id oid.ID
|
var id oid.ID
|
||||||
if err := id.Decode(k); err == nil {
|
if err := id.Decode(k); err == nil {
|
||||||
appendOID(id)
|
appendOID(id)
|
||||||
|
|
|
@ -375,7 +375,7 @@ func WithRebuildWorkerLimiter(l RebuildWorkerLimiter) Option {
|
||||||
// For testing purposes only.
|
// For testing purposes only.
|
||||||
func WithDisabledGC() Option {
|
func WithDisabledGC() Option {
|
||||||
return func(c *cfg) {
|
return func(c *cfg) {
|
||||||
c.gcCfg.testHookRemover = func(ctx context.Context) gcRunResult { return gcRunResult{} }
|
c.gcCfg.testHookRemover = func(_ context.Context) gcRunResult { return gcRunResult{} }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ func IterateDB(db *bbolt.DB, f func(oid.Address) error) error {
|
||||||
|
|
||||||
var addr oid.Address
|
var addr oid.Address
|
||||||
|
|
||||||
return b.ForEach(func(k, v []byte) error {
|
return b.ForEach(func(k, _ []byte) error {
|
||||||
err := addr.DecodeString(string(k))
|
err := addr.DecodeString(string(k))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not parse object address: %w", err)
|
return fmt.Errorf("could not parse object address: %w", err)
|
||||||
|
|
|
@ -93,10 +93,10 @@ func New(oo ...Option) *Writer {
|
||||||
|
|
||||||
w.opts.nOpts = append(w.opts.nOpts,
|
w.opts.nOpts = append(w.opts.nOpts,
|
||||||
nats.NoCallbacksAfterClientClose(), // do not call callbacks when it was planned writer stop
|
nats.NoCallbacksAfterClientClose(), // do not call callbacks when it was planned writer stop
|
||||||
nats.DisconnectErrHandler(func(conn *nats.Conn, err error) {
|
nats.DisconnectErrHandler(func(_ *nats.Conn, err error) {
|
||||||
w.log.Error(logs.NatsNatsConnectionWasLost, zap.Error(err))
|
w.log.Error(logs.NatsNatsConnectionWasLost, zap.Error(err))
|
||||||
}),
|
}),
|
||||||
nats.ReconnectHandler(func(conn *nats.Conn) {
|
nats.ReconnectHandler(func(_ *nats.Conn) {
|
||||||
w.log.Warn(logs.NatsNatsReconnectedToTheServer)
|
w.log.Warn(logs.NatsNatsReconnectedToTheServer)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue