Documentation ¶
Overview ¶
Package cmds provides command line tools.
Index ¶
- Constants
- Variables
- func Context(args []string, flags interface{}, options ...kong.Option) (*kong.Context, error)
- func DefaultProcesses() *pm.Processes
- func LoadFromStdInput() ([]byte, error)
- func RunCPUPprof(s string) (func() error, error)
- func RunMemPprof(s string) (func() error, error)
- func RunPprofs(flags *PprofFlags) (func() error, error)
- func RunTracePprof(s string) (func() error, error)
- func SetupLoggingFromFlags(flags *LogFlags, defaultout io.Writer) (*logging.Logging, error)
- type BaseCommand
- func (cmd *BaseCommand) BSONEncoder() *bsonenc.Encoder
- func (cmd *BaseCommand) Done()
- func (cmd *BaseCommand) Encoders() *encoder.Encoders
- func (cmd *BaseCommand) Initialize(flags interface{}, version util.Version) error
- func (cmd *BaseCommand) JSONEncoder() *jsonenc.Encoder
- func (cmd *BaseCommand) LoadEncoders(types []hint.Type, hinters []hint.Hinter) (*encoder.Encoders, error)
- func (cmd *BaseCommand) Version() util.Version
- type BaseRunCommand
- type BaseVerifyCommand
- type BlockDownloadCommand
- type BlockdataVerifyCommand
- type CleanByHeightStorageCommand
- type CleanStorageCommand
- type DatabaseVerifyCommand
- type DefaultConfigCommand
- type DeployKeyKeyCommand
- type DeployKeyKeysCommand
- type DeployKeyNewCommand
- type DeployKeyRevokeCommand
- type FileLoad
- type InitCommand
- type LogFlags
- type LogFormat
- type LogLevel
- type NetworkIDFlag
- type NodeConnectFlags
- type NodeInfoCommand
- type PprofFlags
- type QuicClientCommand
- type RestoreCommand
- type RunCommand
- type SetBlockdataMapsCommand
- type StartHandoverCommand
Constants ¶
View Source
const HookNameCleanByHeightStorage = "clean_by_height_storage"
Variables ¶
View Source
var ( ContextValueDryRun util.ContextKey = "dry_run" ContextValueHeight util.ContextKey = "clean_storage_by_height_height" ContextValueCleanDatabaseByHeight util.ContextKey = "clean_database_by_height" )
View Source
var ( DefaultName = "mitum" DefaultDescription = "mitum" MainOptions = kong.HelpOptions{NoAppSummary: false, Compact: true, Summary: false, Tree: true} )
View Source
var ( ContextValueWhenBlockSaved util.ContextKey = "restore_when_block_saved" ContextValueWhenFinished util.ContextKey = "restore_when_finished" )
View Source
var BlockDownloadVars = kong.Vars{ "block_datatypes": strings.Join(block.Blockdata, ","), "all_blockdata": allBlockdata, }
View Source
var ContextValueCleanDatabase util.ContextKey = "clean_database"
View Source
var DefaultConfigVars = kong.Vars{
"default_config_default_format": "yaml",
}
View Source
var LogVars = kong.Vars{
"log": "",
"log_level": "info",
"log_format": "terminal",
"log_color": "false",
}
View Source
var NodeConnectVars = kong.Vars{
"node_connect_timeout": "5s",
"node_connect_tls_insecure": "false",
}
View Source
var PprofVars = kong.Vars{
"enable_pprof": "false",
"mem_pprof_file": "mitum-mem.pprof",
"cpu_pprof_file": "mitum-cpu.pprof",
"trace_pprof_file": "mitum-trace.pprof",
}
Functions ¶
func DefaultProcesses ¶
func LoadFromStdInput ¶
func RunCPUPprof ¶
func RunMemPprof ¶
func RunPprofs ¶
func RunPprofs(flags *PprofFlags) (func() error, error)
func RunTracePprof ¶
Types ¶
type BaseCommand ¶
type BaseCommand struct { *logging.Logging *LogFlags *PprofFlags LogOutput io.Writer `kong:"-"` // contains filtered or unexported fields }
func NewBaseCommand ¶
func NewBaseCommand(name string) *BaseCommand
func (*BaseCommand) BSONEncoder ¶
func (cmd *BaseCommand) BSONEncoder() *bsonenc.Encoder
func (*BaseCommand) Done ¶
func (cmd *BaseCommand) Done()
func (*BaseCommand) Encoders ¶
func (cmd *BaseCommand) Encoders() *encoder.Encoders
func (*BaseCommand) Initialize ¶
func (cmd *BaseCommand) Initialize(flags interface{}, version util.Version) error
func (*BaseCommand) JSONEncoder ¶
func (cmd *BaseCommand) JSONEncoder() *jsonenc.Encoder
func (*BaseCommand) LoadEncoders ¶
func (*BaseCommand) Version ¶
func (cmd *BaseCommand) Version() util.Version
type BaseRunCommand ¶
type BaseRunCommand struct { *BaseCommand Design FileLoad `arg:"" name:"node design file" help:"node design file"` // contains filtered or unexported fields }
func NewBaseRunCommand ¶
func NewBaseRunCommand(dryrun bool, name string) *BaseRunCommand
func (*BaseRunCommand) Processes ¶
func (cmd *BaseRunCommand) Processes() *pm.Processes
func (*BaseRunCommand) SetProcesses ¶
func (cmd *BaseRunCommand) SetProcesses(processes *pm.Processes) *BaseRunCommand
type BaseVerifyCommand ¶
type BaseVerifyCommand struct { *BaseCommand NetworkID NetworkIDFlag `name:"network-id"` // contains filtered or unexported fields }
func NewBaseVerifyCommand ¶
func (*BaseVerifyCommand) Initialize ¶
func (cmd *BaseVerifyCommand) Initialize(flags interface{}, version util.Version) error
type BlockDownloadCommand ¶
type BlockDownloadCommand struct { *BaseCommand DataType string `arg:"" name:"data type" help:"data type of block data, {${block_datatypes} ${all_blockdata}}" required:"true"` // revive:disable-line:line-length-limit Heights []int64 `arg:"" name:"height" help:"heights of block" required:"true"` URL *url.URL `name:"node" help:"remote mitum url. default: ${node_url}" required:"true" default:"${node_url}"` // revive:disable-line:line-length-limit Timeout time.Duration `name:"timeout" help:"timeout; default is 5 seconds"` TLSInscure bool `name:"tls-insecure" help:"allow inseucre TLS connection; default is false"` Save string `name:"save" help:"save block data under directory"` // contains filtered or unexported fields }
func NewBlockDownloadCommand ¶
func NewBlockDownloadCommand(types []hint.Type, hinters []hint.Hinter) BlockDownloadCommand
type BlockdataVerifyCommand ¶
type BlockdataVerifyCommand struct { *BaseVerifyCommand Path string `arg:"" name:"blockdata path"` // contains filtered or unexported fields }
func NewBlockdataVerifyCommand ¶
func NewBlockdataVerifyCommand(types []hint.Type, hinters []hint.Hinter) BlockdataVerifyCommand
func (*BlockdataVerifyCommand) Initialize ¶
func (cmd *BlockdataVerifyCommand) Initialize(flags interface{}, version util.Version) error
type CleanByHeightStorageCommand ¶
type CleanByHeightStorageCommand struct { *BaseRunCommand Height int64 `arg:"" name:"height" help:"height of block" required:"true"` DryRun bool `help:"dry-run" optional:"" default:"false"` // contains filtered or unexported fields }
func NewCleanByHeightStorageCommand ¶
func NewCleanByHeightStorageCommand() CleanByHeightStorageCommand
type CleanStorageCommand ¶
type CleanStorageCommand struct { *BaseRunCommand // contains filtered or unexported fields }
func NewCleanStorageCommand ¶
func NewCleanStorageCommand(dryrun bool) CleanStorageCommand
type DatabaseVerifyCommand ¶
type DatabaseVerifyCommand struct { *BaseVerifyCommand URI string `arg:"" name:"database uri"` Path string `arg:"" name:"blockdata path"` // contains filtered or unexported fields }
func NewDatabaseVerifyCommand ¶
func NewDatabaseVerifyCommand(types []hint.Type, hinters []hint.Hinter) DatabaseVerifyCommand
func (*DatabaseVerifyCommand) Initialize ¶
func (cmd *DatabaseVerifyCommand) Initialize(flags interface{}, version util.Version) error
type DefaultConfigCommand ¶
type DefaultConfigCommand struct { *BaseCommand Format string `help:"output format, {yaml}" default:"${default_config_default_format}"` // contains filtered or unexported fields }
func NewDefaultConfigCommand ¶
func NewDefaultConfigCommand() DefaultConfigCommand
type DeployKeyKeyCommand ¶
type DeployKeyKeyCommand struct { DeployKey string `arg:"" name:"deploy key"` // contains filtered or unexported fields }
func NewDeployKeyKeyCommand ¶
func NewDeployKeyKeyCommand() DeployKeyKeyCommand
func (DeployKeyKeyCommand) Initialize ¶
type DeployKeyKeysCommand ¶
type DeployKeyKeysCommand struct {
// contains filtered or unexported fields
}
func NewDeployKeyKeysCommand ¶
func NewDeployKeyKeysCommand() DeployKeyKeysCommand
func (DeployKeyKeysCommand) Initialize ¶
type DeployKeyNewCommand ¶
type DeployKeyNewCommand struct {
// contains filtered or unexported fields
}
func NewDeployKeyNewCommand ¶
func NewDeployKeyNewCommand() DeployKeyNewCommand
func (DeployKeyNewCommand) Initialize ¶
type DeployKeyRevokeCommand ¶
type DeployKeyRevokeCommand struct { DeployKey string `arg:"" name:"deploy key"` // contains filtered or unexported fields }
func NewDeployKeyRevokeCommand ¶
func NewDeployKeyRevokeCommand() DeployKeyRevokeCommand
func (DeployKeyRevokeCommand) Initialize ¶
type InitCommand ¶
type InitCommand struct { *BaseRunCommand Force bool `help:"clean the existing environment"` }
func NewInitCommand ¶
func NewInitCommand(dryrun bool) InitCommand
type LogFlags ¶
type LogFlags struct { LogColor bool `help:"show color log" default:"${log_color}"` // revive:disable-line:struct-tag,line-length-limit LogLevel LogLevel `help:"log level {trace debug error warn info crit} (default: ${log_level})" default:"${log_level}"` // revive:disable-line:struct-tag,line-length-limit LogFormat LogFormat `help:"log format {json terminal} (default: ${log_format})" default:"${log_format}"` LogFile []string `name:"log" help:"log file"` }
type NetworkIDFlag ¶
type NetworkIDFlag []byte
func (NetworkIDFlag) NetworkID ¶
func (v NetworkIDFlag) NetworkID() base.NetworkID
func (*NetworkIDFlag) UnmarshalText ¶
func (v *NetworkIDFlag) UnmarshalText(b []byte) error
type NodeConnectFlags ¶
type NodeConnectFlags struct { URL *url.URL `arg:"" name:"node url" help:"remote mitum url; default: ${node_url}" required:"true" default:"${node_url}"` // revive:disable-line:line-length-limit Timeout time.Duration `name:"timeout" help:"timeout; default ${node_connect_timeout}" default:"${node_connect_timeout}"` // revive:disable-line:line-length-limit TLSInscure bool `` // revive:disable-line:line-length-limit,struct-tag /* 134-byte string literal not displayed */ }
type NodeInfoCommand ¶
type NodeInfoCommand struct { *BaseCommand URL *url.URL `arg:"" name:"node url" help:"remote mitum url" required:"true"` Timeout time.Duration `name:"timeout" help:"timeout; default is 5 seconds"` TLSInscure bool `name:"tls-insecure" help:"allow inseucre TLS connection; default is false"` }
func NewNodeInfoCommand ¶
func NewNodeInfoCommand() NodeInfoCommand
type PprofFlags ¶
type PprofFlags struct { EnableProfiling bool `name:"enable-pprof" help:"enable profiling (default:${enable_pprof})" default:"${enable_pprof}"` // nolint MemProf string `name:"pprof-mem" help:"memory prof file (default:${mem_pprof_file})" default:"${mem_pprof_file}"` // nolint CPUProf string `name:"pprof-cpu" help:"cpu prof file (default:${cpu_pprof_file})" default:"${cpu_pprof_file}"` // nolint TraceProf string `name:"pprof-trace" help:"trace prof file (default:${trace_pprof_file})" default:"${trace_pprof_file}"` // nolint }
type QuicClientCommand ¶
type QuicClientCommand struct { *BaseCommand URL *url.URL `arg:"" name:"node url" help:"remote mitum url" required:"true"` Timeout time.Duration `name:"timeout" help:"timeout; default is 5 seconds"` TLSInscure bool `name:"tls-insecure" help:"allow inseucre TLS connection; default is false"` Method string `name:"method" help:"http method {GET HEAD POST PUT DELETE CONNECT OPTIONS TRACE PATCH}; default is 'GET'"` // revive:disable-line:line-length-limit Headers []string `name:"header" help:"http header; <key>: <value>"` Body FileLoad `name:"body" help:"set http body" optional:""` JSON bool `name:"json" help:"json output format (default: false)" optional:"" default:"false"` // contains filtered or unexported fields }
func NewQuicClientCommand ¶
func NewQuicClientCommand() QuicClientCommand
func (*QuicClientCommand) Initialize ¶
func (cmd *QuicClientCommand) Initialize(flags interface{}, version util.Version) error
type RestoreCommand ¶
type RestoreCommand struct { *BaseRunCommand Clean bool `help:"clean the existing data"` Concurrency uint64 `help:"how many blocks are handled at same time default: 10" default:"10"` Dryrun bool `help:"just check blockdata and database default: false" default:"false"` One string `help:"restore one blockdata"` // contains filtered or unexported fields }
func NewRestoreCommand ¶
func NewRestoreCommand() RestoreCommand
type RunCommand ¶
type RunCommand struct { *BaseRunCommand Discovery []*url.URL `name:"discovery" help:"discovery node"` ExitAfter time.Duration `name:"exit-after" help:"exit after the given duration"` NetworkLogFile []string `name:"network-log" help:"network log file"` // contains filtered or unexported fields }
func NewRunCommand ¶
func NewRunCommand(dryrun bool) RunCommand
func (*RunCommand) AfterStartedHooks ¶
func (cmd *RunCommand) AfterStartedHooks() *pm.Hooks
type SetBlockdataMapsCommand ¶
type SetBlockdataMapsCommand struct { *BaseCommand DeployKey string `arg:"" name:"deploy key"` File *os.File `arg:"" name:"maps file" help:"set blockdatamap file"` *NodeConnectFlags // contains filtered or unexported fields }
func NewSetBlockdataMapsCommand ¶
func NewSetBlockdataMapsCommand() SetBlockdataMapsCommand
type StartHandoverCommand ¶
type StartHandoverCommand struct { *BaseCommand Address string `arg:"" name:"node address" required:"true"` Key string `arg:"" name:"private key of node" required:"true"` NetworkID string `arg:"" name:"network-id" required:"true"` URL *url.URL `arg:"" name:"new node url" help:"new node url" required:"true"` Timeout time.Duration `name:"timeout" help:"timeout; default is 5 seconds"` TLSInscure bool `name:"tls-insecure" help:"allow inseucre TLS connection; default is false"` // contains filtered or unexported fields }
func NewStartHandoverCommand ¶
func NewStartHandoverCommand() StartHandoverCommand
Source Files ¶
- base_node.go
- block_download.go
- blockdata_verify.go
- clean_by_height_storage.go
- clean_storage.go
- cmd.go
- database_verify.go
- default_config.go
- deploy_key.go
- deploy_key_key.go
- deploy_key_keys.go
- deploy_key_new.go
- deploy_key_revoke.go
- deploy_set_blockdatamaps.go
- doc.go
- flags.go
- init_node.go
- log.go
- node_info.go
- pprof.go
- quic_client.go
- restore.go
- run_node.go
- start_handover.go
- util.go
- verify_storage.go
Click to show internal directories.
Click to hide internal directories.