Documentation ¶
Index ¶
- Constants
- func GetServiceID(h HeaderI) (string, bool)
- func SetServiceID(h HeaderI, id string)
- type ACKHandlerFunc
- type ACKMiddlewareFunc
- type Handler
- type HandlerFunc
- type HeaderI
- type PacketDataI
- type PacketHandlerFunc
- type PacketI
- type PacketMiddlewareFunc
- type PacketSender
- type Route
- type Router
- func (r *Router) HandleFunc(path string, pf PacketHandlerFunc, af ACKHandlerFunc) *Route
- func (r *Router) NewRoute() *Route
- func (r Router) ServeACK(ctx sdk.Context, p PacketI, pd PacketDataI, ack []byte, sender PacketSender) (*sdk.Result, error)
- func (r Router) ServePacket(ctx sdk.Context, p PacketI, pd PacketDataI, sender PacketSender) (*sdk.Result, []byte, error)
- func (r *Router) UseACKMiddlewares(mwf ...ACKMiddlewareFunc)
- func (r *Router) UsePacketMiddlewares(mwf ...PacketMiddlewareFunc)
- type SendingPacketCallback
- type SendingPacketHandler
Constants ¶
const (
HeaderKeyServiceID = "@service"
)
Variables ¶
This section is empty.
Functions ¶
func GetServiceID ¶
GetServiceID returns a service ID from a given header
Types ¶
type ACKHandlerFunc ¶
type ACKHandlerFunc func(ctx sdk.Context, p PacketI, pd PacketDataI, ack []byte, sender PacketSender) (*sdk.Result, error)
type ACKMiddlewareFunc ¶
type ACKMiddlewareFunc func(ACKHandlerFunc) ACKHandlerFunc
ACKMiddlewareFunc is a function which receives a ACKHandlerFunc and returns another ACKHandlerFunc.
func (ACKMiddlewareFunc) Middleware ¶
func (mw ACKMiddlewareFunc) Middleware(handler ACKHandlerFunc) ACKHandlerFunc
Middleware allows MiddlewareFunc to implement the middleware interface.
type Handler ¶
type Handler interface { ServePacket(ctx sdk.Context, p PacketI, pd PacketDataI, sender PacketSender) (res *sdk.Result, ack []byte, err error) ServeACK(ctx sdk.Context, p PacketI, pd PacketDataI, ack []byte, sender PacketSender) (res *sdk.Result, err error) }
type HandlerFunc ¶
type HandlerFunc struct { PacketHandlerFunc PacketHandlerFunc ACKHandlerFunc ACKHandlerFunc }
func (HandlerFunc) ServeACK ¶
func (f HandlerFunc) ServeACK(ctx sdk.Context, p PacketI, pd PacketDataI, ack []byte, sender PacketSender) (*sdk.Result, error)
func (HandlerFunc) ServePacket ¶
func (f HandlerFunc) ServePacket(ctx sdk.Context, p PacketI, pd PacketDataI, sender PacketSender) (*sdk.Result, []byte, error)
type PacketDataI ¶
PacketDataI defines the standard packet data.
type PacketHandlerFunc ¶
type PacketHandlerFunc func(ctx sdk.Context, p PacketI, pd PacketDataI, sender PacketSender) (*sdk.Result, []byte, error)
type PacketI ¶
type PacketI interface { GetSequence() uint64 GetTimeoutHeight() uint64 GetTimeoutTimestamp() uint64 GetSourcePort() string GetSourceChannel() string GetDestPort() string GetDestChannel() string GetData() []byte ValidateBasic() error }
PacketI defines the standard interface for IBC packets
type PacketMiddlewareFunc ¶
type PacketMiddlewareFunc func(PacketHandlerFunc) PacketHandlerFunc
PacketMiddlewareFunc is a function which receives a PacketHandlerFunc and returns another PacketHandlerFunc.
func (PacketMiddlewareFunc) Middleware ¶
func (mw PacketMiddlewareFunc) Middleware(handler PacketHandlerFunc) PacketHandlerFunc
Middleware allows PacketHandlerFunc to implement the packetMiddleware interface.
type PacketSender ¶
type PacketSender interface { SendPacket( ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI, ) error }
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (*Route) HandlerFunc ¶
func (r *Route) HandlerFunc(f HandlerFunc) *Route
HandlerFunc sets a handler function for the route.
type Router ¶
type Router struct { // Configurable Handler to be used when no route matches. NotFoundHandler HandlerFunc // contains filtered or unexported fields }
func (*Router) HandleFunc ¶
func (r *Router) HandleFunc(path string, pf PacketHandlerFunc, af ACKHandlerFunc) *Route
func (Router) ServeACK ¶
func (r Router) ServeACK(ctx sdk.Context, p PacketI, pd PacketDataI, ack []byte, sender PacketSender) (*sdk.Result, error)
func (Router) ServePacket ¶
func (r Router) ServePacket(ctx sdk.Context, p PacketI, pd PacketDataI, sender PacketSender) (*sdk.Result, []byte, error)
func (*Router) UseACKMiddlewares ¶
func (r *Router) UseACKMiddlewares(mwf ...ACKMiddlewareFunc)
UseACKMiddlewares appends a ACKMiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
func (*Router) UsePacketMiddlewares ¶
func (r *Router) UsePacketMiddlewares(mwf ...PacketMiddlewareFunc)
UsePacketMiddlewares appends a PacketMiddlewareFunc to the chain. Middleware can be used to intercept or otherwise modify requests and/or responses, and are executed in the order that they are applied to the Router.
type SendingPacketCallback ¶
type SendingPacketCallback func( ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI, ) (exported.PacketI, error)
type SendingPacketHandler ¶
type SendingPacketHandler struct {
// contains filtered or unexported fields
}
func NewSendingPacketHandler ¶
func NewSendingPacketHandler(sender PacketSender, callback SendingPacketCallback) SendingPacketHandler
func (SendingPacketHandler) SendPacket ¶
func (h SendingPacketHandler) SendPacket( ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI, ) error