agent

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 8 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)

	// syncBlockHeaer tries to get an channel of Headers from bitxhub.
	// Note: only the header beyond the height of sync-header request moment will be sent to this channel
	SyncBlockHeader(ctx context.Context, ch chan *pb.BlockHeader) error

	// GetBlockHeader tries to get headers whose height is in the interval of [begin, end]
	// All these headers will be sent the channel.
	GetBlockHeader(ctx context.Context, begin, end uint64, ch chan *pb.BlockHeader) error

	// SyncInterchainTxWrapper tries to get an channel of interchain tx wrapper from bitxhub.
	// Note: only the interchain tx wrappers beyond the height of sync-header request moment will be sent to this channel
	SyncInterchainTxWrapper(ctx context.Context, ch chan *pb.InterchainTxWrapper) error

	// GetInterchainTxWrapper tries to get txWrappers whose height is in the interval of [begin, end]
	// All these wrappers will be sent the channel.
	GetInterchainTxWrapper(ctx context.Context, begin, end uint64, ch chan *pb.InterchainTxWrapper) 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)

	GetInterchainMeta() (*rpcx.Interchain, 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.Relay) (*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) GetBlockHeader

func (agent *BxhAgent) GetBlockHeader(ctx context.Context, begin, end uint64, ch chan *pb.BlockHeader) error

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

func (agent *BxhAgent) GetInterchainMeta() (*rpcx.Interchain, error)

func (*BxhAgent) GetInterchainTxWrapper

func (agent *BxhAgent) GetInterchainTxWrapper(ctx context.Context, begin, end uint64, ch chan *pb.InterchainTxWrapper) error

GetInterchainTxWrapper 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) SyncBlockHeader

func (agent *BxhAgent) SyncBlockHeader(ctx context.Context, headerCh chan *pb.BlockHeader) error

func (*BxhAgent) SyncInterchainTxWrapper

func (agent *BxhAgent) SyncInterchainTxWrapper(ctx context.Context, txCh chan *pb.InterchainTxWrapper) error

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