agent

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	// Appchain will query if this appchain has registered to bitxhub.
	// If this appchain related to the pier has registered, bitxhub will return
	// some basic info about this chain. Otherwise, pier will get not exist appchain error.
	Appchain() (*rpcx.Appchain, error)

	// SyncMerkleWrapper tries to get an channel of merkleWrappers from bitxhub.
	// A merkleWrapper includes block header and interchain txs.
	// Note: only the wrapper beyond the height of sync-wrapper request moment will be sent to this channel
	SyncMerkleWrapper(ctx context.Context) (chan *pb.MerkleWrapper, error)

	// GetMerkleWrapper tries to get wrappers whose height is in the interval of [begin, end]
	// All these wrappers will be sent the channel.
	GetMerkleWrapper(begin, end uint64) (chan *pb.MerkleWrapper, error)

	// SendTransaction sends the wrapped interchain tx to bitxhub
	SendTransaction(tx *pb.Transaction) (*pb.Receipt, error)

	// SendIBTP sends wrapped ibtp to bitxhub internal VM to execute
	SendIBTP(ibtp *pb.IBTP) (*pb.Receipt, error)

	// GetIBTPByID queries interchain ibtp package record
	// given an unique id of ibtp from bitxhub
	GetIBTPByID(id string) (*pb.IBTP, error)

	// GetChainMeta gets chain meta of relay chain
	GetChainMeta() (*pb.ChainMeta, error)
}

type BxhAgent

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

BxhAgent represents the necessary data for interacting with bitxhub

func New

func New(client rpcx.Client, pierID types.Address, bitxhub repo.Bitxhub) (*BxhAgent, error)

New create an instance of BxhAgent given the client of bitxhub and the appchain id and some configuration of bitxhub

func (*BxhAgent) Appchain

func (agent *BxhAgent) Appchain() (*rpcx.Appchain, error)

Appchain implements Agent

func (*BxhAgent) GetChainMeta

func (agent *BxhAgent) GetChainMeta() (*pb.ChainMeta, error)

GetChainMeta implements Agent

func (*BxhAgent) GetIBTPByID

func (agent *BxhAgent) GetIBTPByID(id string) (*pb.IBTP, error)

GetIBTPByID implements Agent

func (*BxhAgent) GetMerkleWrapper

func (agent *BxhAgent) GetMerkleWrapper(begin, end uint64) (chan *pb.MerkleWrapper, error)

GetMerkleWrapper implements Agent

func (*BxhAgent) GetReceipt

func (agent *BxhAgent) GetReceipt(hash string) (*pb.Receipt, error)

GetReceipt implements Agent

func (*BxhAgent) SendIBTP

func (agent *BxhAgent) SendIBTP(ibtp *pb.IBTP) (*pb.Receipt, error)

SendIBTP implements Agent

func (*BxhAgent) SendTransaction

func (agent *BxhAgent) SendTransaction(tx *pb.Transaction) (*pb.Receipt, error)

SendTransaction implements Agent

func (*BxhAgent) Stop

func (agent *BxhAgent) Stop() error

func (*BxhAgent) SyncMerkleWrapper

func (agent *BxhAgent) SyncMerkleWrapper(ctx context.Context) (chan *pb.MerkleWrapper, error)

SyncMerkleWrapper implements Agent

Directories

Path Synopsis
Package mock_agent is a generated GoMock package.
Package mock_agent is a generated GoMock package.

Jump to

Keyboard shortcuts

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