plugin

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginNoncePrefix = "pn-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminApp

type AdminApp interface {
	GetNonce() uint64
	From() []byte
}

type AdminOp

type AdminOp struct {
	ChangedValidators []*agtypes.ValidatorAttr
	DisconnectedPeers []*p2p.Peer
	AddRefuseKeys     []crypto.PubKey
	DeleteRefuseKeys  []crypto.PubKey
	// contains filtered or unexported fields
}

func (*AdminOp) BeginBlock

func (s *AdminOp) BeginBlock(p *BeginBlockParams) (*BeginBlockReturns, error)

func (*AdminOp) CheckMajor23

func (s *AdminOp) CheckMajor23(cmd *agtypes.AdminOPCmd) bool

func (*AdminOp) CheckTx

func (s *AdminOp) CheckTx(tx []byte) (bool, error)

func (*AdminOp) DeliverTx

func (s *AdminOp) DeliverTx(tx []byte, i int) (bool, error)

func (*AdminOp) EndBlock

func (s *AdminOp) EndBlock(p *EndBlockParams) (*EndBlockReturns, error)

func (*AdminOp) ExecBlock

func (s *AdminOp) ExecBlock(p *ExecBlockParams) (*ExecBlockReturns, error)

func (*AdminOp) ExecTX

func (s *AdminOp) ExecTX(app AdminApp, tx []byte) error

func (*AdminOp) Init

func (s *AdminOp) Init(p *InitParams)

func (*AdminOp) ParseValidator

func (s *AdminOp) ParseValidator(cmd *agtypes.AdminOPCmd) (*agtypes.ValidatorAttr, error)

func (*AdminOp) ProcessAdminOP

func (s *AdminOp) ProcessAdminOP(cmd *agtypes.AdminOPCmd, app AdminApp) error

if power <=0, node is a peer, else if power > 0, node is a validator addnode: change node to peer update: change power value so that node to be validator remove: remove node from validators

func (*AdminOp) Reload

func (s *AdminOp) Reload(p *ReloadParams)

func (*AdminOp) Reset

func (s *AdminOp) Reset()

func (*AdminOp) SetEventSwitch

func (s *AdminOp) SetEventSwitch(sw agtypes.EventSwitch)

func (*AdminOp) Stop

func (s *AdminOp) Stop()

type BeginBlockParams

type BeginBlockParams struct {
	Block *types.Block
}

type BeginBlockReturns

type BeginBlockReturns struct {
}

type EndBlockParams

type EndBlockParams struct {
	Block             *types.Block
	ChangedValidators []*types.ValidatorAttr
	NextValidatorSet  *types.ValidatorSet
}

type EndBlockReturns

type EndBlockReturns struct {
	NextValidatorSet *types.ValidatorSet
}

type ExecBlockParams

type ExecBlockParams struct {
	Block       *types.Block
	EventSwitch types.EventSwitch
	EventCache  types.EventCache
	ValidTxs    types.Txs
	InvalidTxs  []types.ExecuteInvalidTx
}

type ExecBlockReturns

type ExecBlockReturns struct {
}

type IPlugin

type IPlugin interface {
	types.Eventable

	// DeliverTx return false means the tx won't be pass on to proxy app
	DeliverTx(tx []byte, i int) (bool, error)

	// CheckTx return false means the tx won't be pass on to proxy app
	CheckTx(tx []byte) (bool, error)

	// BeginBlock just mock the abci Blockaware interface
	BeginBlock(*BeginBlockParams) (*BeginBlockReturns, error)

	// ExecBlock receives block
	ExecBlock(*ExecBlockParams) (*ExecBlockReturns, error)

	// EndBlock just mock the abci Blockaware interface
	EndBlock(*EndBlockParams) (*EndBlockReturns, error)

	// Reset is called when u don't need to maintain the plugin status
	Reset()

	// InitPlugin custom the initialization of the plugin
	Init(*InitParams)

	// Reload reloads private fields of the plugin
	Reload(*ReloadParams)

	Stop()
}

IPlugin defines the behavior of the core plugins

type InitParams

type InitParams struct {
	Logger     *zap.Logger
	StateDB    dbm.DB
	Switch     *p2p.Switch
	PrivKey    crypto.PrivKey
	RefuseList *refuse_list.RefuseList
	Validators **types.ValidatorSet
}

type QueryCachePlugin

type QueryCachePlugin struct {
	// contains filtered or unexported fields
}

func (*QueryCachePlugin) BeginBlock

func (*QueryCachePlugin) CheckTx

func (qc *QueryCachePlugin) CheckTx(tx []byte) (bool, error)

func (*QueryCachePlugin) DeliverTx

func (qc *QueryCachePlugin) DeliverTx(tx []byte, i int) (bool, error)

func (*QueryCachePlugin) EndBlock

func (*QueryCachePlugin) ExecBlock

func (*QueryCachePlugin) ExecutionResult

func (qc *QueryCachePlugin) ExecutionResult(txHash []byte) (*types.TxExecutionResult, error)

func (*QueryCachePlugin) Init

func (qc *QueryCachePlugin) Init(p *InitParams)

func (*QueryCachePlugin) Reload

func (qc *QueryCachePlugin) Reload(p *ReloadParams)

func (*QueryCachePlugin) Reset

func (qc *QueryCachePlugin) Reset()

func (*QueryCachePlugin) SetEventSwitch

func (qc *QueryCachePlugin) SetEventSwitch(sw types.EventSwitch)

func (*QueryCachePlugin) Stop

func (qc *QueryCachePlugin) Stop()

type ReloadParams

type ReloadParams struct {
	Logger     *zap.Logger
	StateDB    dbm.DB
	Switch     *p2p.Switch
	PrivKey    crypto.PrivKey
	RefuseList *refuse_list.RefuseList
	Validators **types.ValidatorSet
}

Jump to

Keyboard shortcuts

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