app

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package app is the core menta application. It provides a base Tendermint ABCI environment with pluggable Services.

Index

Constants

View Source
const (
	MENTAHOME = ".menta"
	Home      = "home"
)

Variables

View Source
var DefaultHomeDir = os.ExpandEnv(fmt.Sprintf("$HOME/%s", MENTAHOME))

Functions

func InitTendermint

func InitTendermint(homedir string)

func LoadConfig

func LoadConfig(homedir string) (*cfg.Config, error)

func TrapSignal

func TrapSignal(cleanupFunc func())

TrapSignal Adapted from Cosmos SDK Note: Must add a select{} after this - see above

Types

type MentaApp

type MentaApp struct {
	Config *cfg.Config
	// contains filtered or unexported fields
}

MentaApp contains all the basics needed to build a tendermint application

func NewApp

func NewApp(appname, homedir string) *MentaApp

NewApp returns a new instance of MentaApp where appname is the name of your application, and homedir is the path where menta/tendermint will store all the data and configuration information

func NewMockApp

func NewMockApp() *MentaApp

NewMockApp creates a menta app that can be used for local testing without a full blown node and an in memory state tree

func (*MentaApp) AddService added in v0.3.0

func (app *MentaApp) AddService(service sdk.Service)

AddService : registers your service with Menta

func (*MentaApp) BeginBlock

func (app *MentaApp) BeginBlock(req abci.RequestBeginBlock) (resp abci.ResponseBeginBlock)

BeginBlock signals the start of processing a batch of transaction via DeliverTx

func (*MentaApp) CheckTx

func (app *MentaApp) CheckTx(checkTx abci.RequestCheckTx) abci.ResponseCheckTx

CheckTx populates the mempool. Transactions are ran through the OnValidationHandler. If the pass, they will be considered for inclusion in a block and processed via DeliverTx

func (*MentaApp) Commit

func (app *MentaApp) Commit() abci.ResponseCommit

Commit to state tree, refresh caches

func (*MentaApp) CreateNode

func (app *MentaApp) CreateNode() *node.Node

CreateNode creates an embedded tendermint node for standalone mode

func (*MentaApp) DeliverTx

func (app *MentaApp) DeliverTx(dtx abci.RequestDeliverTx) abci.ResponseDeliverTx

DeliverTx is the heart of processing transactions leading to a state transistion. This is where the your application logic lives via handlers

func (*MentaApp) EndBlock

func (app *MentaApp) EndBlock(req abci.RequestEndBlock) (resp abci.ResponseEndBlock)

EndBlock signals the end of a block of txs. TODO: return changes to the validator set

func (*MentaApp) Info

func (app *MentaApp) Info(req abci.RequestInfo) abci.ResponseInfo

Info checks the application state on startup. If the last block height known by the application is less than what tendermint says, then the application node will sync by replaying all transactions up to the current tendermint block height.

func (*MentaApp) InitChain

func (app *MentaApp) InitChain(req abci.RequestInitChain) (resp abci.ResponseInitChain)

InitChain is ran once, on the very first run of the application chain.

func (*MentaApp) Query

func (app *MentaApp) Query(query abci.RequestQuery) abci.ResponseQuery

Query *committed* state in the Tree This calls the handler where the path is the Service name return from Service.Route() and the key is the application specific key in storage

func (*MentaApp) Run

func (app *MentaApp) Run()

Run run a standalone / in-process tendermint app

func (*MentaApp) SetOption

func (app *MentaApp) SetOption(req abci.RequestSetOption) abci.ResponseSetOption

SetOption - not used

func (*MentaApp) ValidateTxHandler added in v0.3.0

func (app *MentaApp) ValidateTxHandler(fn sdk.ValidateTxHandler)

ValidateTxHandler : Add this handler to validate your transactions. This is NOT required as you can also validate tx in your Service if you want. Usually this is a good place to put signature verification. There is only 1 of these per application.

Jump to

Keyboard shortcuts

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