commands

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenValidatorCmd = &cobra.Command{
	Use:   "gen_validator",
	Short: "Generate new validator keypair",
	Run:   genValidator,
}

GenValidatorCmd allows the generation of a keypair for a validator.

View Source
var InitFilesCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialize BlockChain",
	RunE:  initFiles,
}

InitFilesCmd initialises a fresh BlockChain Core instance.

View Source
var ReplayCmd = &cobra.Command{
	Use:   "replay",
	Short: "Replay messages from WAL",
	Run: func(cmd *cobra.Command, args []string) {
		consensus.RunReplayFile(config, false)
	},
}

ReplayCmd allows replaying of messages from the WAL.

View Source
var ReplayConsoleCmd = &cobra.Command{
	Use:   "replay_console",
	Short: "Replay messages from WAL in a console",
	Run: func(cmd *cobra.Command, args []string) {
		consensus.RunReplayFile(config, true)
	},
}

ReplayConsoleCmd allows replaying of messages from the WAL in a console.

View Source
var ResetAllCmd = &cobra.Command{
	Use:   "unsafe_reset_all",
	Short: "(unsafe) Remove all the data and WAL, reset this node's validator to genesis state",
	Run:   resetAll,
}

ResetAllCmd removes the database of this core instance.

View Source
var ResetPrivValidatorCmd = &cobra.Command{
	Use:   "unsafe_reset_priv_validator",
	Short: "(unsafe) Reset this node's validator to genesis state",
	Run:   resetPrivValidator,
}

ResetPrivValidatorCmd resets the private validator files.

View Source
var RootCmd = &cobra.Command{
	Use:   "linkchain",
	Short: "linkchain root command",
	PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
		if cmd.Name() == VersionCmd.Name() {
			return nil
		}
		if cmd.Name() == NewConsoleCommand().Name() {
			return nil
		}
		config, err = ParseConfig()
		if err != nil {
			return err
		}
		if !filepath.IsAbs(config.Log.Filename) {
			config.Log.Filename = filepath.Join(config.LogDir(), config.Log.Filename)
		}
		logDir := filepath.Dir(config.Log.Filename)
		if err := os.MkdirAll(logDir, 0755); err != nil {
			return err
		}
		logOnce.Do(func() {
			rotateHandler, err := log.RotateHandler(config.Log, log.TerminalFormat(false))
			if err != nil {
				logger.Error("rotateHandler err", "err", err)
				return
			}
			logger.SetHandler(rotateHandler)
		})
		logger, err = log.ParseLogLevel(config.LogLevel, logger, cfg.DefaultLogLevel())
		if err != nil {
			return err
		}
		if viper.GetBool(cli.TraceFlag) {
			logger = log.NewTracingLogger(logger)
		}
		logger = logger.With("module", "main")
		return nil
	},
}

RootCmd is the root command.

View Source
var ShowValidatorCmd = &cobra.Command{
	Use:   "show_validator",
	Short: "Show this node's validator info",
	Run:   showValidator,
}

ShowValidatorCmd adds capabilities for showing the validator info.

View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Show version info",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("linkchain version: %s, gitCommit:%s ,gitBranch:%s\n", version.Version, version.GitCommit, version.GitBranch)
	},
}

VersionCmd ...

Functions

func AddNodeFlags

func AddNodeFlags(cmd *cobra.Command)

AddNodeFlags exposes some common configuration options on the command-line These are exposed for convenience of commands embedding a node

func NewConsoleCommand

func NewConsoleCommand() *cobra.Command

func NewRunNodeCmd

func NewRunNodeCmd(nodeProvider nm.NodeProvider) *cobra.Command

NewRunNodeCmd returns the command that allows the CLI to start a node. It can be used with a custom PrivValidator and in-process ABCI application.

func ParseConfig

func ParseConfig() (*cfg.Config, error)

ParseConfig retrieves the default environment configuration, sets up the root and ensures that the root exists

func ResetAll

func ResetAll(dbDir, addrBookFile, privValFile string, logger log.Logger)

ResetAll removes the privValidator and address book files plus all data. Exported so other CLI tools can use it.

Types

type ContractData

type ContractData struct {
	// contains filtered or unexported fields
}

ContractData used to store the contract data that we need repaly

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL