server

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: Apache-2.0 Imports: 32 Imported by: 5

Documentation

Index

Constants

View Source
const (
	FlagJson = "json"
)

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(
	ctx *Context, cdc *go_amino.Codec,
	rootCmd *cobra.Command, appCreator AppCreator)

add server commands

func ExternalIP added in v0.0.10

func ExternalIP() (string, error)

https://stackoverflow.com/questions/23558425/how-do-i-get-the-local-ip-address-in-go TODO there must be a better way to get external IP

func InitCmd

func InitCmd(ctx *Context, cdc *go_amino.Codec, genGenesisDocFun CustomGenGenesisDocFunc, defaultNodeHome string) *cobra.Command

get cmd to initialize all files for tendermint and application nolint

func InitializeNodeValidatorFiles added in v0.0.10

func InitializeNodeValidatorFiles(
	config *cfg.Config) (nodeID string, valPubKey crypto.PubKey, err error,
)

InitializeNodeValidatorFiles creates private validator and p2p configuration files.

func InsertKeyJSON

func InsertKeyJSON(cdc *go_amino.Codec, baseJSON []byte, key string, value json.RawMessage) ([]byte, error)

InsertKeyJSON inserts a new JSON field/key with a given value to an existing JSON message. An error is returned if any serialization operation fails.

NOTE: The ordering of the keys returned as the resulting JSON message is non-deterministic, so the client should not rely on key ordering.

func MarshalJSONIndent

func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error)

func PersistentPreRunEFn

func PersistentPreRunEFn(context *Context) func(*cobra.Command, []string) error

PersistentPreRunEFn returns a PersistentPreRunE function for cobra that initailizes the passed in context with a properly configured logger and config objecy

func ReadOrCreatePrivValidator added in v0.0.10

func ReadOrCreatePrivValidator(privValFile string) crypto.PubKey

read of create the private key file for this config

func RegisterCrypto

func RegisterCrypto(cdc *Codec)

func SaveGenDoc added in v0.0.10

func SaveGenDoc(genFile string, genDoc types.GenesisDoc) error

func ShowAddressCmd

func ShowAddressCmd(ctx *Context) *cobra.Command

ShowAddressCmd - show this node's validator address

func ShowNodeIDCmd

func ShowNodeIDCmd(ctx *Context) *cobra.Command

ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout

func ShowValidatorCmd

func ShowValidatorCmd(ctx *Context) *cobra.Command

ShowValidator - ported from Tendermint, show this node's validator info

func StartCmd

func StartCmd(ctx *Context, appCreator AppCreator) *cobra.Command

StartCmd runs the service passed in, either stand-alone or in-process with Tendermint.

func TrapSignal added in v0.0.10

func TrapSignal(cleanupFunc func())

TrapSignal traps SIGINT and SIGTERM and terminates the server correctly.

func UnsafeResetAllCmd

func UnsafeResetAllCmd(ctx *Context) *cobra.Command

UnsafeResetAllCmd - extension of the tendermint command, resets initialization

Types

type AppCreator

type AppCreator func(log.Logger, dbm.DB, io.Writer) abci.Application

AppCreator is a function that allows us to lazily initialize an application using various configurations.

type AppExporter added in v0.0.10

AppExporter is a function that dumps all app state to JSON-serializable structure and returns the current validator set.

type Codec

type Codec = amino.Codec

func New

func New() *Codec

type Context

type Context struct {
	Config *cfg.Config
	Logger log.Logger
}

server context

func NewContext

func NewContext(config *cfg.Config, logger log.Logger) *Context

func NewDefaultContext

func NewDefaultContext() *Context

type CustomGenGenesisDocFunc added in v0.0.10

type CustomGenGenesisDocFunc func(ctx *Context, cdc *go_amino.Codec, chainID string, nodeValidatorPubKey crypto.PubKey) (types.GenesisDoc, error)

自定义生成GenesisDoc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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