Documentation
¶
Index ¶
Constants ¶
const ( // SubModuleName defines the IBC port name SubModuleName = "routing" // StoreKey is the store key string for IBC ports StoreKey = SubModuleName // RouterKey is the message route for IBC ports RouterKey = SubModuleName // QuerierRoute is the querier route for IBC ports QuerierRoute = SubModuleName )
const RulePattern = "^([^.]{1,50}\\.){2}[^.]{1,50}$"
Variables ¶
var ( ErrInvalidRoute = sdkerrors.Register(moduleName, 2, "route not found") ErrInvalidRule = sdkerrors.Register(moduleName, 3, "invalid rule") ErrFailMarshalRules = sdkerrors.Register(moduleName, 4, "ailed to marshal rules") )
TIBC routing sentinel errors
Functions ¶
func GetModuleOwner ¶
GetModuleOwner enforces that only IBC and the module bound to port can own the capability while future implementations may allow multiple modules to bind to a port, currently we only allow one module to be bound to a port at any given time
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
The router is a map from module name to the TIBCModule which contains all the module-defined callbacks required by TICS-26
func (*Router) AddRoute ¶
func (rtr *Router) AddRoute(port Port, cbs TIBCModule) *Router
AddRoute adds TIBCModule for a given module name. 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 Port) (TIBCModule, bool)
GetRoute returns a IBCModule for a given module.
func (*Router) HasRoute ¶
HasRoute returns true if the Router has a module registered or false otherwise.
type TIBCModule ¶
type TIBCModule interface { // OnRecvPacket must return the acknowledgement bytes // In the case of an asynchronous acknowledgement, nil should be returned. OnRecvPacket( ctx sdk.Context, packet packettypes.Packet, ) (*sdk.Result, []byte, error) OnAcknowledgementPacket( ctx sdk.Context, packet packettypes.Packet, acknowledgement []byte, ) (*sdk.Result, error) }
TIBCModule defines an interface that implements all the callbacks that modules must define as specified in TICS-26