executor

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelExecutor

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

ChannelExecutor represents the necessary data for executing interchain txs in appchain

func New

func New(client plugins.Client, pierID string, storage storage.Storage, cryptor txcrypto.Cryptor, logger logrus.FieldLogger) (*ChannelExecutor, error)

New creates new instance of Executor. agent is for interacting with counterpart chain client is for interacting with appchain, meta is for recording interchain tx meta information and ds is for persisting some runtime messages

func (*ChannelExecutor) ExecuteIBTP added in v1.5.0

func (e *ChannelExecutor) ExecuteIBTP(wIbtp *model.WrappedIBTP) (*pb.IBTP, error)

ExecuteIBTP handles ibtps of any type, which can be categorized into: 1. ibtp for interchain operations, then a ibtp-encoded receipt will be returned. And this receipt should be sent back to counterparty. 2. ibtp for confirmation from counterparty. This kind of ibtp is used to confirm the status of ibtp invoked by this pier, and it will return nothing.

func (*ChannelExecutor) QueryCallbackMeta added in v1.5.0

func (e *ChannelExecutor) QueryCallbackMeta() map[string]uint64

func (*ChannelExecutor) QueryIBTPReceipt added in v1.5.0

func (e *ChannelExecutor) QueryIBTPReceipt(originalIBTP *pb.IBTP) (*pb.IBTP, error)

getReceipt only generates one receipt given source chain id and interchain tx index

func (*ChannelExecutor) QueryInterchainMeta added in v1.5.0

func (e *ChannelExecutor) QueryInterchainMeta() map[string]uint64

func (*ChannelExecutor) Rollback added in v1.6.1

func (e *ChannelExecutor) Rollback(ibtp *pb.IBTP, isSrcChain bool)

func (*ChannelExecutor) Start

func (e *ChannelExecutor) Start() error

Start implements Executor

func (*ChannelExecutor) Stop

func (e *ChannelExecutor) Stop() error

Stop implements Executor

type Executor

type Executor interface {
	// Start starts the service of executor
	Start() error

	// Stop stops the service of executor
	Stop() error

	// ExecuteIBTP handles interchain ibtps from other appchains
	// and return the receipt ibtp for ack or callback
	ExecuteIBTP(wIbtp *model.WrappedIBTP) (*pb.IBTP, error)

	// Rollback rollbacks ibtp on appchain
	Rollback(ibtp *pb.IBTP, isSrcChain bool)

	// QueryInterchainMeta queries latest index map of ibtps executed on appchain
	// For the returned map, key is the source chain ID,
	// and value is the latest index of tx executed on appchain
	QueryInterchainMeta() map[string]uint64

	// QueryCallbackMeta queries latest index map of ibtps callbacks executed on appchain
	// For the returned map, key is the destination chain ID,
	// and value is the latest index of callback executed on appchain
	QueryCallbackMeta() map[string]uint64

	// QueryIBTPReceipt query receipt for original interchain ibtp
	QueryIBTPReceipt(originalIBTP *pb.IBTP) (*pb.IBTP, error)
}

Directories

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

Jump to

Keyboard shortcuts

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