app

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

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

View Source
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

func NewBaseApp(store *StoreApp, handler sdk.Handler, clock sdk.Ticker) *BaseApp

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

func (*BaseApp) InitState added in v0.8.0

func (app *BaseApp) InitState(module, key, value string) error

InitState - used to setup state (was SetOption) to be used by InitChain later

TODO: rethink this a bit more....

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

func MockStoreApp(appName string, logger log.Logger) (*StoreApp, error)

MockStoreApp returns a Store app with no persistence

func NewStoreApp added in v0.8.0

func NewStoreApp(appName, dbName string, cacheSize int, logger log.Logger) (*StoreApp, error)

NewStoreApp creates a data store to handle queries

func (*StoreApp) AddValChange added in v0.8.0

func (app *StoreApp) AddValChange(diffs []*abci.Validator)

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

func (app *StoreApp) Append() sm.SimpleDB

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

func (app *StoreApp) Check() sm.SimpleDB

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

func (app *StoreApp) CommittedHeight() int64

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

func (app *StoreApp) GetChainID() string

GetChainID returns the currently stored chain

func (*StoreApp) Hash added in v0.8.0

func (app *StoreApp) Hash() []byte

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

func (app *StoreApp) Logger() log.Logger

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

func (*StoreApp) WorkingHeight added in v0.8.0

func (app *StoreApp) WorkingHeight() int64

WorkingHeight gets the current block we are writing

Jump to

Keyboard shortcuts

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