Documentation ¶
Overview ¶
Package baseapp contains data structures that provide basic data storage functionality and act as a bridge between the ABCI interface and the SDK abstractions.
BaseApp has no state except the CommitMultiStore you provide upon init.
See examples/basecoin/app/* for usage.
nolint: golint
Index ¶
- Constants
- Variables
- func NewQueryRouter() *queryrouter
- func RunForever(app abci.Application)
- func SetGasPriceConfig(gasPriceConfig *config.GasPriceConfig) func(*BaseApp)
- func SetPruning(pruning string) func(*BaseApp)
- type BaseApp
- func (app *BaseApp) ApplySnapshotChunk(req abci.RequestApplySnapshotChunk) abci.ResponseApplySnapshotChunk
- func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
- func (app *BaseApp) Check(tx sdk.Tx) (result sdk.Result, err error)
- func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
- func (app *BaseApp) Commit() (res abci.ResponseCommit)
- func (app *BaseApp) Deliver(tx sdk.Tx) (result sdk.Result, err error)
- func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
- func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
- func (app *BaseApp) FilterPeerByAddrPort(info string) abci.ResponseQuery
- func (app *BaseApp) FilterPeerByPubKey(info string) abci.ResponseQuery
- func (app *BaseApp) GRPCQueryRouter() *GRPCQueryRouter
- func (app *BaseApp) GetConsensusParams(ctx sdk.Context) *abci.ConsensusParams
- func (app *BaseApp) GetLatestVersion() int64
- func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo
- func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
- func (app *BaseApp) IsSealed() bool
- func (app *BaseApp) LastBlockHeight() int64
- func (app *BaseApp) LastCommitID() sdk.CommitID
- func (app *BaseApp) ListSnapshots(req abci.RequestListSnapshots) abci.ResponseListSnapshots
- func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error
- func (app *BaseApp) LoadSnapshotChunk(req abci.RequestLoadSnapshotChunk) abci.ResponseLoadSnapshotChunk
- func (app *BaseApp) LoadVersion(version int64, mainKey sdk.StoreKey) error
- func (app *BaseApp) MountKVStores(keys map[string]*sdk.KVStoreKey)
- func (app *BaseApp) MountKVStoresTransient(keys map[string]*sdk.TransientStoreKey)
- func (app *BaseApp) MountStore(key sdk.StoreKey, typ sdk.StoreType)
- func (app *BaseApp) MountStoreMemory(keys map[string]*sdk.MemoryStoreKey)
- func (app *BaseApp) MountStoreWithDB(key sdk.StoreKey, typ sdk.StoreType, db dbm.DB)
- func (app *BaseApp) MountStoresIAVL(keys ...*sdk.KVStoreKey)
- func (app *BaseApp) MsgServiceRouter() *MsgServiceRouter
- func (app *BaseApp) Name() string
- func (app *BaseApp) NewContext(isCheckTx bool, header types.Header) sdk.Context
- func (app *BaseApp) NewUncachedContext(isCheckTx bool, header tmtypes.Header) sdk.Context
- func (app *BaseApp) OfferSnapshot(req abci.RequestOfferSnapshot) abci.ResponseOfferSnapshot
- func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery)
- func (app *BaseApp) QueryRouter() QueryRouter
- func (app *BaseApp) Router() sdk.Router
- func (app *BaseApp) Seal()
- func (app *BaseApp) SetAddrPeerFilter(pf sdk.PeerFilter)
- func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler)
- func (app *BaseApp) SetBeginBlocker(beginBlocker sdk.BeginBlocker)
- func (app *BaseApp) SetCMS(cms store.CommitMultiStore)
- func (app *BaseApp) SetCommitMultiStoreTracer(w io.Writer)
- func (app *BaseApp) SetCommitter(committer Committer)
- func (app *BaseApp) SetDB(db dbm.DB)
- func (app *BaseApp) SetDeferHandler(de sdk.DeferHandler)
- func (app *BaseApp) SetEndBlocker(endBlocker sdk.EndBlocker)
- func (app *BaseApp) SetGasPriceConfig(gasPriceConfig *config.GasPriceConfig)
- func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer)
- func (app *BaseApp) SetInitialVersion(version int64) error
- func (app *BaseApp) SetName(name string)
- func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption)
- func (app *BaseApp) SetParamStore(ps ParamStore)
- func (app *BaseApp) SetPubKeyPeerFilter(pf sdk.PeerFilter)
- func (app *BaseApp) Simulate(txByte []byte) (result sdk.Result, err error)
- func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp *abci.ConsensusParams)
- type Committer
- type GRPCQueryHandler
- type GRPCQueryRouter
- type MsgServiceHandler
- type MsgServiceRouter
- type ParamStore
- type QueryRouter
Constants ¶
const Paramspace = "baseapp"
Variables ¶
var ( ParamStoreKeyBlockParams = []byte("BlockParams") ParamStoreKeyEvidenceParams = []byte("EvidenceParams") ParamStoreKeyValidatorParams = []byte("ValidatorParams") )
Functions ¶
func NewQueryRouter ¶
func NewQueryRouter() *queryrouter
nolint NewRouter - create new router TODO either make Function unexported or make return types (router) Exported
func RunForever ¶
func RunForever(app abci.Application)
RunForever - BasecoinApp execution and cleanup
func SetGasPriceConfig ¶ added in v1.5.28
func SetGasPriceConfig(gasPriceConfig *config.GasPriceConfig) func(*BaseApp)
SetGasPriceConfig returns an option that sets the gas price config on the app.
func SetPruning ¶
SetPruning sets a pruning option on the multistore associated with the app
Types ¶
type BaseApp ¶
type BaseApp struct { // initialized on creation Logger log.Logger // contains filtered or unexported fields }
BaseApp reflects the ABCI application implementation.
func NewBaseApp ¶
func NewBaseApp(name string, logger log.Logger, ldb dbm.DB, cdb dbm.DB, cacheDir string, txDecoder sdk.TxDecoder, options ...func(*BaseApp)) *BaseApp
NewBaseApp returns a reference to an initialized BaseApp.
TODO: Determine how to use a flexible and robust configuration paradigm that allows for sensible defaults while being highly configurable (e.g. functional options).
NOTE: The db is used to store the version number for now. Accepts a user-defined txDecoder Accepts variable number of option functions, which act on the BaseApp to set configuration choices
func (*BaseApp) ApplySnapshotChunk ¶
func (app *BaseApp) ApplySnapshotChunk(req abci.RequestApplySnapshotChunk) abci.ResponseApplySnapshotChunk
func (*BaseApp) BeginBlock ¶
func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)
BeginBlock implements the ABCI application interface.
func (*BaseApp) CheckTx ¶
func (app *BaseApp) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx
CheckTx implements the ABCI interface. It runs the "basic checks" to see whether or not a transfer can possibly be executed, first decoding, then the ante handler (which checks signatures/fees/ValidateBasic), then finally the route match to see whether a handler exists.
NOTE:CheckTx does not run the actual Tx handler function(s).
func (*BaseApp) DeliverTx ¶
func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
DeliverTx implements the ABCI interface.
func (*BaseApp) EndBlock ¶
func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBlock)
EndBlock implements the ABCI application interface.
func (*BaseApp) FilterPeerByAddrPort ¶
func (app *BaseApp) FilterPeerByAddrPort(info string) abci.ResponseQuery
Filter peers by address / port
func (*BaseApp) FilterPeerByPubKey ¶
func (app *BaseApp) FilterPeerByPubKey(info string) abci.ResponseQuery
Filter peers by public types
func (*BaseApp) GRPCQueryRouter ¶
func (app *BaseApp) GRPCQueryRouter() *GRPCQueryRouter
GRPCQueryRouter returns the GRPCQueryRouter of a BaseApp.
func (*BaseApp) GetConsensusParams ¶ added in v1.5.23
func (app *BaseApp) GetConsensusParams(ctx sdk.Context) *abci.ConsensusParams
GetConsensusParams returns the current consensus parameters from the BaseApp's ParamStore. If the BaseApp has no ParamStore defined, nil is returned.
func (*BaseApp) GetLatestVersion ¶
func (*BaseApp) Info ¶
func (app *BaseApp) Info(req abci.RequestInfo) abci.ResponseInfo
Implements ABCI
func (*BaseApp) InitChain ¶
func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)
Implements ABCI InitChain runs the initialization logic directly on the CommitMultiStore and commits it.
func (*BaseApp) LastBlockHeight ¶
the last committed block height
func (*BaseApp) LastCommitID ¶
the last CommitID of the multistore
func (*BaseApp) ListSnapshots ¶
func (app *BaseApp) ListSnapshots(req abci.RequestListSnapshots) abci.ResponseListSnapshots
func (*BaseApp) LoadLatestVersion ¶
load latest application version
func (*BaseApp) LoadSnapshotChunk ¶
func (app *BaseApp) LoadSnapshotChunk(req abci.RequestLoadSnapshotChunk) abci.ResponseLoadSnapshotChunk
func (*BaseApp) LoadVersion ¶
load application version
func (*BaseApp) MountKVStores ¶ added in v1.6.3
func (app *BaseApp) MountKVStores(keys map[string]*sdk.KVStoreKey)
MountStores mounts all IAVL or DB stores to the provided keys in the BaseApp multistore.
func (*BaseApp) MountKVStoresTransient ¶ added in v1.6.3
func (app *BaseApp) MountKVStoresTransient(keys map[string]*sdk.TransientStoreKey)
Mount stores to the provided keys in the BaseApp multistore
func (*BaseApp) MountStore ¶
Mount a store to the provided types in the BaseApp multistore, using the default DB
func (*BaseApp) MountStoreMemory ¶
func (app *BaseApp) MountStoreMemory(keys map[string]*sdk.MemoryStoreKey)
func (*BaseApp) MountStoreWithDB ¶
Mount a store to the provided types in the BaseApp multistore, using a specified DB
func (*BaseApp) MountStoresIAVL ¶
func (app *BaseApp) MountStoresIAVL(keys ...*sdk.KVStoreKey)
Mount IAVL stores to the provided keys in the BaseApp multistore
func (*BaseApp) MsgServiceRouter ¶
func (app *BaseApp) MsgServiceRouter() *MsgServiceRouter
MsgServiceRouter returns the MsgServiceRouter of a BaseApp.
func (*BaseApp) NewContext ¶
NewContext returns a new Context with the correct store, the given header, and nil txBytes.
func (*BaseApp) NewUncachedContext ¶
func (*BaseApp) OfferSnapshot ¶
func (app *BaseApp) OfferSnapshot(req abci.RequestOfferSnapshot) abci.ResponseOfferSnapshot
func (*BaseApp) Query ¶
func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery)
Implements ABCI. Delegates to CommitMultiStore if it implements Queryable
func (*BaseApp) QueryRouter ¶
func (app *BaseApp) QueryRouter() QueryRouter
func (*BaseApp) SetAddrPeerFilter ¶
func (app *BaseApp) SetAddrPeerFilter(pf sdk.PeerFilter)
func (*BaseApp) SetAnteHandler ¶
func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler)
func (*BaseApp) SetBeginBlocker ¶
func (app *BaseApp) SetBeginBlocker(beginBlocker sdk.BeginBlocker)
func (*BaseApp) SetCMS ¶
func (app *BaseApp) SetCMS(cms store.CommitMultiStore)
func (*BaseApp) SetCommitMultiStoreTracer ¶
SetCommitMultiStoreTracer sets the store tracer on the BaseApp's underlying CommitMultiStore.
func (*BaseApp) SetCommitter ¶
func (*BaseApp) SetDeferHandler ¶
func (app *BaseApp) SetDeferHandler(de sdk.DeferHandler)
func (*BaseApp) SetEndBlocker ¶
func (app *BaseApp) SetEndBlocker(endBlocker sdk.EndBlocker)
func (*BaseApp) SetGasPriceConfig ¶ added in v1.5.28
func (app *BaseApp) SetGasPriceConfig(gasPriceConfig *config.GasPriceConfig)
func (*BaseApp) SetInitChainer ¶
func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer)
func (*BaseApp) SetInitialVersion ¶ added in v1.5.26
func (*BaseApp) SetOption ¶
func (app *BaseApp) SetOption(req abci.RequestSetOption) (res abci.ResponseSetOption)
Implements ABCI
func (*BaseApp) SetParamStore ¶ added in v1.5.23
func (app *BaseApp) SetParamStore(ps ParamStore)
SetParamStore sets a parameter store on the BaseApp.
func (*BaseApp) SetPubKeyPeerFilter ¶
func (app *BaseApp) SetPubKeyPeerFilter(pf sdk.PeerFilter)
func (*BaseApp) StoreConsensusParams ¶ added in v1.5.23
func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp *abci.ConsensusParams)
type GRPCQueryHandler ¶
type GRPCQueryHandler = func(ctx sdk.Context, req abci.RequestQuery) (abci.ResponseQuery, error)
GRPCQueryHandler defines a function type which handles ABCI Query requests using gRPC
type GRPCQueryRouter ¶
type GRPCQueryRouter struct {
// contains filtered or unexported fields
}
GRPCQueryRouter routes ABCI Query requests to GRPC handlers
func NewGRPCQueryRouter ¶
func NewGRPCQueryRouter() *GRPCQueryRouter
NewGRPCQueryRouter creates a new GRPCQueryRouter
func (*GRPCQueryRouter) RegisterService ¶
func (qrt *GRPCQueryRouter) RegisterService(sd *grpc.ServiceDesc, handler interface{})
RegisterService implements the gRPC Server.RegisterService method. sd is a gRPC service description, handler is an object which implements that gRPC service/
This functions PANICS: - if a protobuf service is registered twice.
func (*GRPCQueryRouter) Route ¶
func (qrt *GRPCQueryRouter) Route(path string) GRPCQueryHandler
Route returns the GRPCQueryHandler for a given query route path or nil if not found
func (*GRPCQueryRouter) SetInterfaceRegistry ¶
func (qrt *GRPCQueryRouter) SetInterfaceRegistry(interfaceRegistry codectypes.InterfaceRegistry)
SetInterfaceRegistry sets the interface registry for the router. This will also register the interface reflection gRPC service.
type MsgServiceHandler ¶
MsgServiceHandler defines a function type which handles Msg service message.
type MsgServiceRouter ¶
type MsgServiceRouter struct {
// contains filtered or unexported fields
}
MsgServiceRouter routes fully-qualified Msg service methods to their handler.
func NewMsgServiceRouter ¶
func NewMsgServiceRouter() *MsgServiceRouter
NewMsgServiceRouter creates a new MsgServiceRouter.
func (*MsgServiceRouter) Handler ¶
func (msr *MsgServiceRouter) Handler(methodName string) MsgServiceHandler
Handler returns the MsgServiceHandler for a given query route path or nil if not found.
func (*MsgServiceRouter) RegisterService ¶
func (msr *MsgServiceRouter) RegisterService(sd *grpc.ServiceDesc, handler interface{})
RegisterService implements the gRPC Server.RegisterService method. sd is a gRPC service description, handler is an object which implements that gRPC service.
This function PANICs:
- if it is called before the service `Msg`s have been registered using RegisterInterfaces,
- or if a service is being registered twice.
func (*MsgServiceRouter) SetInterfaceRegistry ¶
func (msr *MsgServiceRouter) SetInterfaceRegistry(interfaceRegistry codectypes.InterfaceRegistry)
SetInterfaceRegistry sets the interface registry for the router.
type ParamStore ¶ added in v1.5.23
type QueryRouter ¶
type QueryRouter interface { AddRoute(r string, h sdk.Querier) (rtr QueryRouter) Route(path string) (h sdk.Querier) }
QueryRouter provides queryables for each query path.