agent

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockAgent

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

func NewBlockAgent

func NewBlockAgent(blk *lpb.InternalBlock) *BlockAgent

func (*BlockAgent) GetBlockid

func (t *BlockAgent) GetBlockid() []byte

func (*BlockAgent) GetConsensusStorage

func (t *BlockAgent) GetConsensusStorage() ([]byte, error)

共识记录信息,xledger账本由于历史原因需要做下转换

func (*BlockAgent) GetHeight

func (t *BlockAgent) GetHeight() int64

func (*BlockAgent) GetPreHash

func (t *BlockAgent) GetPreHash() []byte

func (*BlockAgent) GetProposer

func (t *BlockAgent) GetProposer() []byte

func (*BlockAgent) GetPublicKey

func (t *BlockAgent) GetPublicKey() string

func (*BlockAgent) GetSign

func (t *BlockAgent) GetSign() []byte

func (*BlockAgent) GetTimestamp

func (t *BlockAgent) GetTimestamp() int64

func (*BlockAgent) MakeBlockId

func (t *BlockAgent) MakeBlockId() ([]byte, error)

计算BlockId

func (*BlockAgent) SetItem

func (t *BlockAgent) SetItem(item string, value interface{}) error

用于pow挖矿时需更新nonce

type ChainCoreAgent

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

func NewChainCoreAgent

func NewChainCoreAgent(chainCtx *common.ChainCtx) *ChainCoreAgent

func (*ChainCoreAgent) GetAccountAddresses

func (t *ChainCoreAgent) GetAccountAddresses(accountName string) ([]string, error)

查询合约acl

func (*ChainCoreAgent) QueryBlock

func (t *ChainCoreAgent) QueryBlock(blockid []byte) (ledger.BlockHandle, error)

QueryBlock query block

func (*ChainCoreAgent) QueryTransaction

func (t *ChainCoreAgent) QueryTransaction(txid []byte) (*pb.Transaction, error)

QueryTransaction query confirmed tx

func (*ChainCoreAgent) VerifyContractOwnerPermission

func (t *ChainCoreAgent) VerifyContractOwnerPermission(contractName string, authRequire []string) error

结合合约acl设置鉴权

func (*ChainCoreAgent) VerifyContractPermission

func (t *ChainCoreAgent) VerifyContractPermission(initiator string, authRequire []string, contractName, methodName string) (bool, error)

结合合约acl设置鉴权

type ChainRelyAgentImpl

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

代理依赖组件实例化操作,方便mock单测和并行开发

func NewChainRelyAgent

func NewChainRelyAgent(chain common.Chain) *ChainRelyAgentImpl

func (*ChainRelyAgentImpl) CreateAcl

func (t *ChainRelyAgentImpl) CreateAcl() (aclBase.AclManager, error)

Acl权限

func (*ChainRelyAgentImpl) CreateConsensus

func (t *ChainRelyAgentImpl) CreateConsensus() (consensus.ConsensusInterface, error)

创建共识实例

func (*ChainRelyAgentImpl) CreateContract

func (t *ChainRelyAgentImpl) CreateContract(xmreader kledger.XMReader) (contract.Manager, error)

创建合约实例

func (*ChainRelyAgentImpl) CreateCrypto

func (t *ChainRelyAgentImpl) CreateCrypto(cryptoType string) (cryptoBase.CryptoClient, error)

加密

func (*ChainRelyAgentImpl) CreateGovernToken

func (t *ChainRelyAgentImpl) CreateGovernToken() (governToken.GovManager, error)

创建治理代币实例

func (*ChainRelyAgentImpl) CreateLedger

func (t *ChainRelyAgentImpl) CreateLedger() (*ledger.Ledger, error)

创建账本

func (*ChainRelyAgentImpl) CreateProposal

func (t *ChainRelyAgentImpl) CreateProposal() (propose.ProposeManager, error)

创建提案实例

func (*ChainRelyAgentImpl) CreateState

func (t *ChainRelyAgentImpl) CreateState(leg *ledger.Ledger,
	crypt cryptoBase.CryptoClient) (*state.State, error)

创建状态机实例

func (*ChainRelyAgentImpl) CreateTimerTask

func (t *ChainRelyAgentImpl) CreateTimerTask() (timerTask.TimerManager, error)

创建定时器任务实例

type ConsensusStorage

type ConsensusStorage struct {
	TargetBits  int32           `json:"targetBits,omitempty"`
	Justify     *lpb.QuorumCert `json:"justify,omitempty"`
	CurTerm     int64           `json:"curTerm,omitempty"`
	CurBlockNum int64           `json:"curBlockNum,omitempty"`
}

兼容xledger账本历史原因共识部分字段分开存储在区块中

type EngineRelyAgentImpl

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

代理依赖组件实例化操作,方便mock单测和并行开发

func NewEngineRelyAgent

func NewEngineRelyAgent(engine common.Engine) *EngineRelyAgentImpl

func (*EngineRelyAgentImpl) CreateNetwork

func (t *EngineRelyAgentImpl) CreateNetwork(envCfg *xconf.EnvConf) (network.Network, error)

创建并启动p2p网络

type LedgerAgent

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

func NewLedgerAgent

func NewLedgerAgent(chainCtx *common.ChainCtx) *LedgerAgent

func (*LedgerAgent) CreateSnapshot

func (t *LedgerAgent) CreateSnapshot(blkId []byte) (kledger.XMReader, error)

根据指定blockid创建快照(Select方法不可用)

func (*LedgerAgent) CreateXMReader

func (t *LedgerAgent) CreateXMReader() kledger.XMReader

获取最新状态数据

func (*LedgerAgent) GetConsensusConf

func (t *LedgerAgent) GetConsensusConf() ([]byte, error)

从创世块获取共识配置

func (*LedgerAgent) GetCryptoType

func (t *LedgerAgent) GetCryptoType() (string, error)

从创世块获取加密算法类型

func (*LedgerAgent) GetGenesisPreDistribution

func (t *LedgerAgent) GetGenesisPreDistribution() ([]ledger.Predistribution, error)

从创世块获取治理代币消耗gas

func (*LedgerAgent) GetNewAccountGas

func (t *LedgerAgent) GetNewAccountGas() (int64, error)

从创世块获取创建合约账户消耗gas

func (*LedgerAgent) GetNewGovGas

func (t *LedgerAgent) GetNewGovGas() (int64, error)

从创世块获取治理代币消耗gas

func (*LedgerAgent) GetTipBlock

func (t *LedgerAgent) GetTipBlock() kledger.BlockHandle

func (*LedgerAgent) GetTipSnapshot

func (t *LedgerAgent) GetTipSnapshot() (kledger.XMReader, error)

获取最新确认高度快照(Select方法不可用)

func (*LedgerAgent) GetTipXMSnapshotReader

func (t *LedgerAgent) GetTipXMSnapshotReader() (kledger.XMSnapshotReader, error)

获取状态机最新确认高度快照(只有Get方法,直接返回[]byte)

func (*LedgerAgent) QueryBlock

func (t *LedgerAgent) QueryBlock(blkId []byte) (kledger.BlockHandle, error)

查询区块

func (*LedgerAgent) QueryBlockByHeight

func (t *LedgerAgent) QueryBlockByHeight(height int64) (kledger.BlockHandle, error)

Jump to

Keyboard shortcuts

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