baseapp

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0, Apache-2.0 Imports: 44 Imported by: 0

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

View Source
const Paramspace = "baseapp"

Variables

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

func SetPruning(pruning string) func(*BaseApp)

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 (*BaseApp) BeginBlock

func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock)

BeginBlock implements the ABCI application interface.

func (*BaseApp) Check

func (app *BaseApp) Check(tx sdk.Tx) (result sdk.Result, err error)

nolint - Mostly for testing

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) Commit

func (app *BaseApp) Commit() (res abci.ResponseCommit)

Implements ABCI

func (*BaseApp) Deliver

func (app *BaseApp) Deliver(tx sdk.Tx) (result sdk.Result, err error)

nolint

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 (app *BaseApp) GetLatestVersion() int64

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) IsSealed

func (app *BaseApp) IsSealed() bool

func (*BaseApp) LastBlockHeight

func (app *BaseApp) LastBlockHeight() int64

the last committed block height

func (*BaseApp) LastCommitID

func (app *BaseApp) LastCommitID() sdk.CommitID

the last CommitID of the multistore

func (*BaseApp) ListSnapshots

func (*BaseApp) LoadLatestVersion

func (app *BaseApp) LoadLatestVersion(mainKey sdk.StoreKey) error

load latest application version

func (*BaseApp) LoadSnapshotChunk

func (*BaseApp) LoadVersion

func (app *BaseApp) LoadVersion(version int64, mainKey sdk.StoreKey) error

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

func (app *BaseApp) MountStore(key sdk.StoreKey, typ sdk.StoreType)

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

func (app *BaseApp) MountStoreWithDB(key sdk.StoreKey, typ sdk.StoreType, db dbm.DB)

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) Name

func (app *BaseApp) Name() string

BaseApp Name

func (*BaseApp) NewContext

func (app *BaseApp) NewContext(isCheckTx bool, header types.Header) sdk.Context

NewContext returns a new Context with the correct store, the given header, and nil txBytes.

func (*BaseApp) NewUncachedContext

func (app *BaseApp) NewUncachedContext(isCheckTx bool, header tmtypes.Header) sdk.Context

func (*BaseApp) OfferSnapshot

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) Router

func (app *BaseApp) Router() sdk.Router

func (*BaseApp) Seal

func (app *BaseApp) Seal()

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

func (app *BaseApp) SetCommitMultiStoreTracer(w io.Writer)

SetCommitMultiStoreTracer sets the store tracer on the BaseApp's underlying CommitMultiStore.

func (*BaseApp) SetCommitter

func (app *BaseApp) SetCommitter(committer Committer)

func (*BaseApp) SetDB

func (app *BaseApp) SetDB(db dbm.DB)

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 (app *BaseApp) SetInitialVersion(version int64) error

func (*BaseApp) SetName

func (app *BaseApp) SetName(name string)

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) Simulate

func (app *BaseApp) Simulate(txByte []byte) (result sdk.Result, err error)

nolint - full tx execution

func (*BaseApp) StoreConsensusParams added in v1.5.23

func (app *BaseApp) StoreConsensusParams(ctx sdk.Context, cp *abci.ConsensusParams)

type Committer

type Committer func(ctx sdk.Context) abci.ResponseCommit

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

type MsgServiceHandler = func(ctx sdk.Context, req sdk.MsgRequest) (*sdk.Result, error)

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 ParamStore interface {
	Get(ctx sdk.Context, key []byte, ptr interface{})
	Has(ctx sdk.Context, key []byte) bool
	Set(ctx sdk.Context, key []byte, param interface{})
}

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.

Jump to

Keyboard shortcuts

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