server

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: Apache-2.0 Imports: 34 Imported by: 5

Documentation

Index

Constants

View Source
const (
	FlagJson = "json"
)

Variables

View Source
var (
	FlagName       = "name"
	FlagClientHome = "home-client"
	FlagOWK        = "owk"
)

Parameter names, for init gen-tx command

View Source
var (
	FlagOverwrite = "overwrite"
	FlagWithTxs   = "with-txs"
	FlagIP        = "ip"
	FlagChainID   = "chain-id"
)

parameter names, init command

View Source
var DefaultAppInit = AppInit{
	AppGenTx:    SimpleAppGenTx,
	AppGenState: SimpleAppGenState,
}

simple default application init

Functions

func AddCommands

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

add server commands

func GenTxCmd

func GenTxCmd(ctx *Context, cdc *Codec, appInit AppInit) *cobra.Command

get cmd to initialize all files for tendermint and application

func InitCmd

func InitCmd(ctx *Context, cdc *Codec, appInit AppInit) *cobra.Command

get cmd to initialize all files for tendermint and application

func InsertKeyJSON

func InsertKeyJSON(cdc *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 RegisterCrypto

func RegisterCrypto(cdc *Codec)

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 SimpleAppGenState

func SimpleAppGenState(cdc *Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)

create the genesis app state

func SimpleAppGenTx

func SimpleAppGenTx(cdc *Codec, pk crypto.PubKey, genTxConfig serverconfig.GenTx) (
	appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error)

Generate a genesis transaction

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 UnsafeResetAllCmd

func UnsafeResetAllCmd(ctx *Context) *cobra.Command

UnsafeResetAllCmd - extension of the tendermint command, resets initialization

Types

type AppCreator

type AppCreator func(home string, logger log.Logger, traceStore string) (abci.Application, error)

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

func ConstructAppCreator

func ConstructAppCreator(appFn AppCreatorInit, name string) AppCreator

ConstructAppCreator returns an application generation function.

type AppCreatorInit

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

AppCreatorInit reflects a function that performs initialization of an AppCreator.

type AppInit

type AppInit struct {
	// flags required for application init functions
	FlagsAppGenState *pflag.FlagSet
	FlagsAppGenTx    *pflag.FlagSet

	// create the application genesis tx
	AppGenTx func(cdc *Codec, pk crypto.PubKey, genTxConfig serverconfig.GenTx) (
		appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error)

	// AppGenState creates the core parameters initialization. It takes in a
	// pubkey meant to represent the pubkey of the validator of this machine.
	AppGenState func(cdc *Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)
}

Core functionality passed from the application to the server init command

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 GenesisTx

type GenesisTx struct {
	NodeID    string                   `json:"node_id"`
	IP        string                   `json:"ip"`
	Validator tmtypes.GenesisValidator `json:"validator"`
	AppGenTx  json.RawMessage          `json:"app_gen_tx"`
}

genesis piece structure for creating combined genesis

type InitConfig

type InitConfig struct {
	ChainID   string
	GenTxs    bool
	GenTxsDir string
	Overwrite bool
}

Storage for init command input parameters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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