Documentation ¶
Overview ¶
Package app contains data structures that provide basic data storage functionality and act as a bridge between the abci interface and the internal sdk representations.
StoreApp handles creating a datastore or loading an existing one from disk, provides helpers to use in the transaction workflow (check/deliver/commit), and provides bindings to the ABCI interface for functionality such as handshaking with tendermint on restart, querying the data store, and handling begin/end block and commit messages. It does not handle CheckTx or DeliverTx, or have any logic for modifying the state, and is quite generic if you don't wish to use the standard Handlers.
BaseApp embeds StoreApp and extends it for the standard sdk usecase, where we dispatch all CheckTx/DeliverTx messages to a handler (which may contain decorators and a router to multiple modules), and supports a Ticker which is called every BeginBlock.
Index ¶
- Constants
- type BaseApp
- func (app *BaseApp) BeginBlock(_ abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (app *BaseApp) CheckTx(txBytes []byte) abci.ResponseCheckTx
- func (app *BaseApp) DeliverTx(txBytes []byte) abci.ResponseDeliverTx
- func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (app *BaseApp) InitState(module, key, value string) error
- type StoreApp
- func (app *StoreApp) AddValChange(diffs []*abci.Validator)
- func (app *StoreApp) Append() sm.SimpleDB
- func (app *StoreApp) BeginBlock(_ abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (app *StoreApp) Check() sm.SimpleDB
- func (app *StoreApp) Commit() (res abci.ResponseCommit)
- func (app *StoreApp) CommittedHeight() int64
- func (app *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (app *StoreApp) GetChainID() string
- func (app *StoreApp) Hash() []byte
- func (app *StoreApp) Info(req abci.RequestInfo) abci.ResponseInfo
- func (app *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
- func (app *StoreApp) Logger() log.Logger
- func (app *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
- func (app *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
- func (app *StoreApp) WorkingHeight() int64
Constants ¶
const DefaultHistorySize = 10
DefaultHistorySize is how many blocks of history to store for ABCI queries
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseApp ¶ added in v0.8.0
type BaseApp struct { *StoreApp // contains filtered or unexported fields }
BaseApp - The ABCI application
func NewBaseApp ¶ added in v0.8.0
NewBaseApp extends a StoreApp with a handler and a ticker, which it binds to the proper abci calls
func (*BaseApp) BeginBlock ¶ added in v0.8.0
func (app *BaseApp) BeginBlock(_ abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock - ABCI
func (*BaseApp) CheckTx ¶ added in v0.8.0
func (app *BaseApp) CheckTx(txBytes []byte) abci.ResponseCheckTx
CheckTx - ABCI - dispatches to the handler
func (*BaseApp) DeliverTx ¶ added in v0.8.0
func (app *BaseApp) DeliverTx(txBytes []byte) abci.ResponseDeliverTx
DeliverTx - ABCI - dispatches to the handler
func (*BaseApp) EndBlock ¶ added in v0.8.0
func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock - ABCI - triggers Tick actions
type StoreApp ¶ added in v0.8.0
type StoreApp struct { // Name is what is returned from info Name string // contains filtered or unexported fields }
StoreApp contains a data store and all info needed to perform queries and handshakes.
It should be embeded in another struct for CheckTx, DeliverTx and initializing state from the genesis.
func MockStoreApp ¶ added in v0.8.0
MockStoreApp returns a Store app with no persistence
func NewStoreApp ¶ added in v0.8.0
NewStoreApp creates a data store to handle queries
func (*StoreApp) AddValChange ¶ added in v0.8.0
AddValChange is meant to be called by apps on DeliverTx results, this is added to the cache for the endblock changeset
func (*StoreApp) Append ¶ added in v0.8.0
Append returns the working state for DeliverTx
func (*StoreApp) BeginBlock ¶ added in v0.8.0
func (app *StoreApp) BeginBlock(_ abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock - ABCI
func (*StoreApp) Check ¶ added in v0.8.0
Check returns the working state for CheckTx
func (*StoreApp) Commit ¶ added in v0.8.0
func (app *StoreApp) Commit() (res abci.ResponseCommit)
Commit implements abci.Application
func (*StoreApp) CommittedHeight ¶ added in v0.8.0
CommittedHeight gets the last block height committed to the db
func (*StoreApp) EndBlock ¶ added in v0.8.0
func (app *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock - ABCI Returns a list of all validator changes made in this block
func (*StoreApp) GetChainID ¶ added in v0.8.0
GetChainID returns the currently stored chain
func (*StoreApp) Hash ¶ added in v0.8.0
Hash gets the last hash stored in the database
func (*StoreApp) Info ¶ added in v0.8.0
func (app *StoreApp) Info(req abci.RequestInfo) abci.ResponseInfo
Info implements abci.Application. It returns the height and hash, as well as the abci name and version.
The height is the block that holds the transactions, not the apphash itself.
func (*StoreApp) InitChain ¶ added in v0.8.0
func (app *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
InitChain - ABCI
func (*StoreApp) Logger ¶ added in v0.8.0
Logger returns the application base logger
func (*StoreApp) Query ¶ added in v0.8.0
func (app *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
Query - ABCI
func (*StoreApp) SetOption ¶ added in v0.8.0
func (app *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
SetOption - ABCI