Back to godoc.org

Package server

v0.22.0
Latest Go to latest

The latest major version is .

Published: Jul 16, 2018 | License: Apache-2.0 | Module: bitbucket.org/shareringvn/cosmos-sdk

Index

Variables

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

Parameter names, for init gen-tx command

var (
	FlagOverwrite = "overwrite"
	FlagGenTxs    = "gen-txs"
	FlagIP        = "ip"
	FlagChainID   = "chain-id"
)

parameter names, init command

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

simple default application init

func AddCommands

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

add server commands

func ExportCmd

func ExportCmd(ctx *Context, cdc *wire.Codec, appExporter AppExporter) *cobra.Command

ExportCmd dumps app state to JSON.

func FreeTCPAddr

func FreeTCPAddr() (addr, port string, err error)

Get a free address for a test tendermint server protocol is either tcp, http, etc

func GenTxCmd

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

get cmd to initialize all files for tendermint and application

func GenerateCoinKey

func GenerateCoinKey() (sdk.AccAddress, string, error)

GenerateCoinKey returns the address of a public key, along with the secret phrase to recover the private key.

func GenerateSaveCoinKey

func GenerateSaveCoinKey(clientRoot, keyName, keyPass string, overwrite bool) (sdk.AccAddress, string, error)

GenerateSaveCoinKey returns the address of a public key, along with the secret phrase to recover the private key.

func InitCmd

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

get cmd to initialize all files for tendermint and application

func InsertKeyJSON

func InsertKeyJSON(cdc *wire.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 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 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 *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)

create the genesis app state

func SimpleAppGenTx

func SimpleAppGenTx(cdc *wire.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 TestnetFilesCmd

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

get cmd to initialize all files for tendermint testnet and application

func UnsafeResetAllCmd

func UnsafeResetAllCmd(ctx *Context) *cobra.Command

UnsafeResetAllCmd - extension of the tendermint command, resets initialization

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 AppExporter

type AppExporter func(home string, logger log.Logger, traceStore string) (json.RawMessage, []tmtypes.GenesisValidator, error)

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

func ConstructAppExporter

func ConstructAppExporter(appFn AppExporterInit, name string) AppExporter

ConstructAppExporter returns an application export function.

type AppExporterInit

type AppExporterInit func(log.Logger, dbm.DB, io.Writer) (json.RawMessage, []tmtypes.GenesisValidator, error)

AppExporterInit reflects a function that performs initialization of an AppExporter.

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 *wire.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 *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)
}

Core functionality passed from the application to the server init command

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

type SimpleGenTx

type SimpleGenTx struct {
	Addr sdk.AccAddress `json:"addr"`
}

simple genesis tx

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier