f076238748
As part of fixing the IO priority of filewalker related processes such as the garbage collection and used-space calculation, this change allows the initial used-space calculation to run as a separate subprocess with lower IO priority. This can be enabled with the `--storage2.enable-lazy-filewalker` config item. It falls back to the old behaviour when the subprocess fails. Updates https://github.com/storj/storj/issues/5349 Change-Id: Ia6ee98ce912de3e89fc5ca670cf4a30be73b36a6
67 lines
1.7 KiB
Go
67 lines
1.7 KiB
Go
// Copyright (C) 2020 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"go.uber.org/zap"
|
|
|
|
"storj.io/common/fpath"
|
|
"storj.io/private/cfgstruct"
|
|
"storj.io/storj/storagenode"
|
|
)
|
|
|
|
// StorageNodeFlags defines storage node configuration.
|
|
type StorageNodeFlags struct {
|
|
EditConf bool `default:"false" help:"open config in default editor"`
|
|
|
|
storagenode.Config
|
|
|
|
Deprecated
|
|
}
|
|
|
|
// Factory contains default values for configuration flags.
|
|
type Factory struct {
|
|
Defaults cfgstruct.BindOpt
|
|
ConfDir string
|
|
IdentityDir string
|
|
UseColor bool
|
|
}
|
|
|
|
// newRootCmd creates a new root command.
|
|
func newRootCmd(setDefaults bool) (*cobra.Command, *Factory) {
|
|
cmd := &cobra.Command{
|
|
Use: "storagenode",
|
|
Short: "Storagenode",
|
|
}
|
|
|
|
factory := &Factory{}
|
|
|
|
if setDefaults {
|
|
defaultConfDir := fpath.ApplicationDir("storj", "storagenode")
|
|
defaultIdentityDir := fpath.ApplicationDir("storj", "identity", "storagenode")
|
|
cfgstruct.SetupFlag(zap.L(), cmd, &factory.ConfDir, "config-dir", defaultConfDir, "main directory for storagenode configuration")
|
|
cfgstruct.SetupFlag(zap.L(), cmd, &factory.IdentityDir, "identity-dir", defaultIdentityDir, "main directory for storagenode identity credentials")
|
|
cmd.PersistentFlags().BoolVar(&factory.UseColor, "color", false, "use color in user interface")
|
|
|
|
factory.Defaults = cfgstruct.DefaultsFlag(cmd)
|
|
}
|
|
|
|
cmd.AddCommand(
|
|
newConfigCmd(factory),
|
|
newSetupCmd(factory),
|
|
newDashboardCmd(factory),
|
|
newDiagCmd(factory),
|
|
newRunCmd(factory),
|
|
newNodeInfoCmd(factory),
|
|
newIssueAPIKeyCmd(factory),
|
|
newGracefulExitInitCmd(factory),
|
|
newGracefulExitStatusCmd(factory),
|
|
// internal hidden commands
|
|
newUsedSpaceFilewalkerCmd(),
|
|
)
|
|
|
|
return cmd, factory
|
|
}
|