types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SubModuleName defines the XIBC port name
	SubModuleName = "routing"
)

Variables

View Source
var (
	ErrInvalidRoute = sdkerrors.Register(moduleName, 2, "route not found")
)

XIBC routing sentinel errors

Functions

This section is empty.

Types

type Router

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

The router is a map from module name to the XIBCModule which contains all the module-defined callbacks

func NewRouter

func NewRouter() *Router

func (*Router) AddRoute

func (rtr *Router) AddRoute(port string, cbs XIBCModule) *Router

AddRoute adds XIBCModule for a given port. It returns the Router so AddRoute calls can be linked. It will panic if the Router is sealed.

func (*Router) GetRoute

func (rtr *Router) GetRoute(port string) (XIBCModule, bool)

GetRoute returns a XIBCModule for a given port.

func (*Router) HasRoute

func (rtr *Router) HasRoute(port string) bool

HasRoute returns true if the Router has a module registered or false otherwise.

func (*Router) Seal

func (rtr *Router) Seal()

Seal prevents the Router from any subsequent route handlers to be registered. Seal will panic if called more than once.

func (Router) Sealed

func (rtr Router) Sealed() bool

Sealed returns a boolean signifying if the Router is sealed or not.

type XIBCModule

type XIBCModule interface {
	// OnRecvPacket must return the acknowledgement bytes
	// In the case of an asynchronous acknowledgement, nil should be returned.
	OnRecvPacket(ctx sdk.Context, packetData []byte) (res *sdk.Result, result packettypes.Result, err error)

	OnAcknowledgementPacket(ctx sdk.Context, packetData []byte, result []byte) (*sdk.Result, error)
}

XIBCModule defines an interface that implements all the callbacks

Jump to

Keyboard shortcuts

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