Documentation
¶
Index ¶
- Constants
- func ChainInitializers(inits ...weave.Initializer) weave.Initializer
- func ErrNoSuchPath(path string) error
- func IsNoSuchPathErr(err error) bool
- type BaseApp
- type Decorators
- type Genesis
- type Router
- func (r Router) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.CheckResult, error)
- func (r Router) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.DeliverResult, error)
- func (r Router) Handle(path string, h weave.Handler)
- func (r Router) Handler(path string) weave.Handler
- type StoreApp
- func (s *StoreApp) AddValChange(diffs []abci.Validator)
- func (s *StoreApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (s *StoreApp) BlockContext() weave.Context
- func (s *StoreApp) CheckStore() weave.CacheableKVStore
- func (s *StoreApp) Commit() (res abci.ResponseCommit)
- func (s *StoreApp) DeliverStore() weave.CacheableKVStore
- func (s *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (s *StoreApp) GetChainID() string
- func (s *StoreApp) Info(req abci.RequestInfo) abci.ResponseInfo
- func (s *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
- func (s *StoreApp) InitChainWithGenesis(req abci.RequestInitChain, data []byte) abci.ResponseInitChain
- func (s *StoreApp) Logger() log.Logger
- func (s *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
- func (s *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
- func (s *StoreApp) WithGenesis(genesisFile string) *StoreApp
- func (s *StoreApp) WithInit(init weave.Initializer) *StoreApp
- func (s *StoreApp) WithLogger(logger log.Logger) *StoreApp
Constants ¶
const CodeNoSuchPath uint32 = 10
CodeNoSuchPath is an ABCI Response Codes Base SDK reserves 0 ~ 99. App uses 10 ~ 19
const DefaultRouterSize = 10
DefaultRouterSize preallocates this much space to hold routes
Variables ¶
This section is empty.
Functions ¶
func ChainInitializers ¶
func ChainInitializers(inits ...weave.Initializer) weave.Initializer
ChainInitializers lets you initialize many extensions with one function
func ErrNoSuchPath ¶
ErrNoSuchPath constructs an error when router doesn't know the path
func IsNoSuchPathErr ¶
IsNoSuchPathErr checks if this is an unknown route error
Types ¶
type BaseApp ¶
type BaseApp struct {
*StoreApp
// contains filtered or unexported fields
}
BaseApp adds DeliverTx, CheckTx, and BeginBlock handlers to the storage and query functionality of StoreApp
func NewBaseApp ¶
func NewBaseApp(store *StoreApp, decoder weave.TxDecoder, handler weave.Handler, ticker weave.Ticker) BaseApp
NewBaseApp constructs a basic abci application
func (BaseApp) BeginBlock ¶
func (b BaseApp) BeginBlock(req abci.RequestBeginBlock) ( res abci.ResponseBeginBlock)
BeginBlock - ABCI
type Decorators ¶
type Decorators struct {
// contains filtered or unexported fields
}
Decorators holds a chain of decorators, not yet resolved by a Handler
func ChainDecorators ¶
func ChainDecorators(chain ...weave.Decorator) Decorators
ChainDecorators takes a chain of decorators, and upon adding a final Handler (often a Router), returns a Handler that will execute this whole stack.
app.ChainDecorators( util.NewLogging(), util.NewRecovery(), auth.NewDecorator(), coins.NewFeeDecorator(), util.NewSavepoint().OnDeliver(), ).WithHandler( myapp.NewRouter(), )
func (Decorators) Chain ¶
func (d Decorators) Chain(chain ...weave.Decorator) Decorators
Chain allows us to keep adding more Decorators to the chain
func (Decorators) WithHandler ¶
func (d Decorators) WithHandler(h weave.Handler) weave.Handler
WithHandler resolves the stack and returns a concrete Handler that will pass through the chain of decorators before calling the final Handler.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router allows us to register many handlers with different paths and then direct each message to the proper handler.
Minimal interface modeled after net/http.ServeMux
TODO: look for better trie routers that handle patterns... maybe take code from here? https://github.com/julienschmidt/httprouter https://github.com/julienschmidt/httprouter/blob/master/tree.go
func (Router) Check ¶
func (r Router) Check(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.CheckResult, error)
Check dispatches to the proper handler based on path
func (Router) Deliver ¶
func (r Router) Deliver(ctx weave.Context, store weave.KVStore, tx weave.Tx) (weave.DeliverResult, error)
Deliver dispatches to the proper handler based on path
type StoreApp ¶
type StoreApp struct {
// contains filtered or unexported fields
}
StoreApp contains a data store and all info needed to perform queries and handshakes.
It should be embedded in another struct for CheckTx, DeliverTx and initializing state from the genesis.
func NewStoreApp ¶
NewStoreApp initializes this app into a ready state with some defaults
panics if unable to properly load the state from the given store TODO: is this correct? nothing else to do really....
func (*StoreApp) AddValChange ¶
AddValChange is meant to be called by apps on DeliverTx results, this is added to the cache for the endblock changeset
func (*StoreApp) BeginBlock ¶
func (s *StoreApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock implements ABCI Sets up blockContext
func (*StoreApp) BlockContext ¶
BlockContext returns the block context for public use
func (*StoreApp) CheckStore ¶
func (s *StoreApp) CheckStore() weave.CacheableKVStore
CheckStore returns the current CheckTx cache for methods
func (*StoreApp) Commit ¶
func (s *StoreApp) Commit() (res abci.ResponseCommit)
Commit implements abci.Application
func (*StoreApp) DeliverStore ¶
func (s *StoreApp) DeliverStore() weave.CacheableKVStore
DeliverStore returns the current DeliverTx cache for methods
func (*StoreApp) EndBlock ¶
func (s *StoreApp) EndBlock(_ abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock - ABCI Returns a list of all validator changes made in this block
func (*StoreApp) GetChainID ¶
GetChainID returns the current chainID
func (*StoreApp) Info ¶
func (s *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 ¶
func (s *StoreApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
InitChain implements ABCI TODO: store the original validators somewhere Note: in tendermint 0.17, the genesis file is passed in here, we should use this to trigger reading the genesis now
func (*StoreApp) InitChainWithGenesis ¶
func (s *StoreApp) InitChainWithGenesis(req abci.RequestInitChain, data []byte) abci.ResponseInitChain
InitChainWithGenesis mocks out what we want for tendermint 0.17
func (*StoreApp) Query ¶
func (s *StoreApp) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
Query - ABCI
func (*StoreApp) SetOption ¶
func (s *StoreApp) SetOption(res abci.RequestSetOption) abci.ResponseSetOption
SetOption - ABCI TODO: not implemented (ABCI spec still unclear....)
func (*StoreApp) WithGenesis ¶
WithGenesis is used to set the genesis file we read initial state from, until it is sent from tendermint