relayer

package
v5.0.0-...-628dd20 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package relayer contains general functionality relevant to individual relayer implementations.

Subpackages under relayer provide implementations of the ibc.Relayer interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullCapabilities

func FullCapabilities() map[Capability]bool

FullCapabilities returns a mapping of all known relayer features to true, indicating that all features are supported. FullCapabilities returns a new map every time it is called, so callers are free to set one value to false if they support everything but one or two features.

Types

type Capability

type Capability int

Capability indicates a relayer's support of a given feature.

const (
	TimestampTimeout Capability = iota
	HeightTimeout

	// Whether the relayer supports a one-off flush packets or flush acknowledgements command.
	FlushPackets
	FlushAcknowledgements
)

The list of relayer capabilities that ibctest understands.

func (Capability) String

func (i Capability) String() string

type DockerRelayer

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

DockerRelayer provides a common base for relayer implementations that run on Docker.

func NewDockerRelayer

func NewDockerRelayer(ctx context.Context, log *zap.Logger, testName string, cli *client.Client, networkID string, c RelayerCommander, options ...RelayerOption) (*DockerRelayer, error)

NewDockerRelayer returns a new DockerRelayer.

func (*DockerRelayer) AddChainConfiguration

func (r *DockerRelayer) AddChainConfiguration(ctx context.Context, rep ibc.RelayerExecReporter, chainConfig ibc.ChainConfig, keyName, rpcAddr, grpcAddr string) error

func (*DockerRelayer) AddKey

func (r *DockerRelayer) AddKey(ctx context.Context, rep ibc.RelayerExecReporter, chainID, keyName string) (ibc.Wallet, error)

func (*DockerRelayer) Bind

func (r *DockerRelayer) Bind() []string

Bind returns the home folder bind point for running the node.

func (*DockerRelayer) CreateChannel

func (r *DockerRelayer) CreateChannel(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateChannelOptions) error

func (*DockerRelayer) CreateClients

func (r *DockerRelayer) CreateClients(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, opts ibc.CreateClientOptions) error

func (*DockerRelayer) CreateConnections

func (r *DockerRelayer) CreateConnections(ctx context.Context, rep ibc.RelayerExecReporter, pathName string) error

func (*DockerRelayer) Exec

func (*DockerRelayer) FlushAcknowledgements

func (r *DockerRelayer) FlushAcknowledgements(ctx context.Context, rep ibc.RelayerExecReporter, pathName, channelID string) error

func (*DockerRelayer) FlushPackets

func (r *DockerRelayer) FlushPackets(ctx context.Context, rep ibc.RelayerExecReporter, pathName, channelID string) error

func (*DockerRelayer) GeneratePath

func (r *DockerRelayer) GeneratePath(ctx context.Context, rep ibc.RelayerExecReporter, srcChainID, dstChainID, pathName string) error

func (*DockerRelayer) GetChannels

func (r *DockerRelayer) GetChannels(ctx context.Context, rep ibc.RelayerExecReporter, chainID string) ([]ibc.ChannelOutput, error)

func (*DockerRelayer) GetConnections

func (r *DockerRelayer) GetConnections(ctx context.Context, rep ibc.RelayerExecReporter, chainID string) (ibc.ConnectionOutputs, error)

func (*DockerRelayer) GetWallet

func (r *DockerRelayer) GetWallet(chainID string) (ibc.Wallet, bool)

func (*DockerRelayer) HomeDir

func (r *DockerRelayer) HomeDir() string

HomeDir returns the home directory of the relayer on the underlying Docker container's filesystem.

func (*DockerRelayer) HostName

func (r *DockerRelayer) HostName(pathName string) string

func (*DockerRelayer) LinkPath

func (r *DockerRelayer) LinkPath(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, channelOpts ibc.CreateChannelOptions, clientOpts ibc.CreateClientOptions) error

func (*DockerRelayer) Name

func (r *DockerRelayer) Name() string

func (*DockerRelayer) RestoreKey

func (r *DockerRelayer) RestoreKey(ctx context.Context, rep ibc.RelayerExecReporter, chainID, keyName, mnemonic string) error

func (*DockerRelayer) StartRelayer

func (r *DockerRelayer) StartRelayer(ctx context.Context, rep ibc.RelayerExecReporter, pathNames ...string) error

func (*DockerRelayer) StopRelayer

func (r *DockerRelayer) StopRelayer(ctx context.Context, rep ibc.RelayerExecReporter) error

func (*DockerRelayer) UpdateClients

func (r *DockerRelayer) UpdateClients(ctx context.Context, rep ibc.RelayerExecReporter, pathName string) error

func (*DockerRelayer) UpdatePath

func (r *DockerRelayer) UpdatePath(ctx context.Context, rep ibc.RelayerExecReporter, pathName string, filter ibc.ChannelFilter) error

func (*DockerRelayer) UseDockerNetwork

func (r *DockerRelayer) UseDockerNetwork() bool

type RelayerCommander

type RelayerCommander interface {
	// Name is the name of the relayer, e.g. "rly" or "hermes".
	Name() string

	DefaultContainerImage() string
	DefaultContainerVersion() string

	// The Docker user to use in created container.
	// For ibctest, must be of the format: uid:gid.
	DockerUser() string

	// ConfigContent generates the content of the config file that will be passed to AddChainConfiguration.
	ConfigContent(ctx context.Context, cfg ibc.ChainConfig, keyName, rpcAddr, grpcAddr string) ([]byte, error)

	// ParseAddKeyOutput processes the output of AddKey
	// to produce the wallet that was created.
	ParseAddKeyOutput(stdout, stderr string) (ibc.Wallet, error)

	// ParseRestoreKeyOutput extracts the address from the output of RestoreKey.
	ParseRestoreKeyOutput(stdout, stderr string) string

	// ParseGetChannelsOutput processes the output of GetChannels
	// to produce the channel output values.
	ParseGetChannelsOutput(stdout, stderr string) ([]ibc.ChannelOutput, error)

	// ParseGetConnectionsOutput processes the output of GetConnections
	// to produce the connection output values.
	ParseGetConnectionsOutput(stdout, stderr string) (ibc.ConnectionOutputs, error)

	// Init is the command to run on the first call to AddChainConfiguration.
	// If the returned command is nil or empty, nothing will be executed.
	Init(homeDir string) []string

	AddChainConfiguration(containerFilePath, homeDir string) []string
	AddKey(chainID, keyName, homeDir string) []string
	CreateChannel(pathName string, opts ibc.CreateChannelOptions, homeDir string) []string
	CreateClients(pathName string, opts ibc.CreateClientOptions, homeDir string) []string
	CreateConnections(pathName, homeDir string) []string
	FlushAcknowledgements(pathName, channelID, homeDir string) []string
	FlushPackets(pathName, channelID, homeDir string) []string
	GeneratePath(srcChainID, dstChainID, pathName, homeDir string) []string
	UpdatePath(pathName, homeDir string, filter ibc.ChannelFilter) []string
	GetChannels(chainID, homeDir string) []string
	GetConnections(chainID, homeDir string) []string
	LinkPath(pathName, homeDir string, channelOpts ibc.CreateChannelOptions, clientOpts ibc.CreateClientOptions) []string
	RestoreKey(chainID, keyName, mnemonic, homeDir string) []string
	StartRelayer(homeDir string, pathNames ...string) []string
	UpdateClients(pathName, homeDir string) []string
}

type RelayerOption

type RelayerOption interface {
	// contains filtered or unexported methods
}

RelayerOption is used to customize the relayer configuration, whether constructed with the RelayerFactory or with the more specific NewDockerRelayer or NewCosmosRelayer methods.

func CustomDockerImage

func CustomDockerImage(repository string, version string, uidGid string) RelayerOption

CustomDockerImage overrides the default relayer docker image. uidGid is the uid:gid format owner that should be used within the container. If uidGid is empty, root user will be assumed.

func ImagePull

func ImagePull(pull bool) RelayerOption

func StartupFlags

func StartupFlags(flags ...string) RelayerOption

StartupFlags appends additional flags when starting the relayer.

type RelayerOptionDockerImage

type RelayerOptionDockerImage struct {
	DockerImage ibc.DockerImage
}

type RelayerOptionExtraStartFlags

type RelayerOptionExtraStartFlags struct {
	Flags []string
}

type RelayerOptionImagePull

type RelayerOptionImagePull struct {
	Pull bool
}

type RelayerOptions

type RelayerOptions []RelayerOption

Directories

Path Synopsis
Package rly provides an interface to the cosmos relayer running in a Docker container.
Package rly provides an interface to the cosmos relayer running in a Docker container.

Jump to

Keyboard shortcuts

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