Documentation ¶
Index ¶
- func ApplyOnewayInbound(h transport.OnewayHandler, i OnewayInbound) transport.OnewayHandler
- func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound
- func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable
- func ApplyUnaryInbound(h transport.UnaryHandler, i UnaryInbound) transport.UnaryHandler
- func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound
- type OnewayInbound
- type OnewayInboundFunc
- type OnewayOutbound
- type OnewayOutboundFunc
- type Router
- type UnaryInbound
- type UnaryInboundFunc
- type UnaryOutbound
- type UnaryOutboundFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyOnewayInbound ¶
func ApplyOnewayInbound(h transport.OnewayHandler, i OnewayInbound) transport.OnewayHandler
ApplyOnewayInbound applies the given OnewayInbound middleware to the given OnewayHandler.
func ApplyOnewayOutbound ¶
func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound
ApplyOnewayOutbound applies the given OnewayOutbound middleware to the given OnewayOutbound transport.
func ApplyRouteTable ¶ added in v1.2.0
func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable
ApplyRouteTable applies the given Router middleware to the given Router.
func ApplyUnaryInbound ¶
func ApplyUnaryInbound(h transport.UnaryHandler, i UnaryInbound) transport.UnaryHandler
ApplyUnaryInbound applies the given InboundMiddleware to the given Handler.
func ApplyUnaryOutbound ¶
func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound
ApplyUnaryOutbound applies the given UnaryOutbound middleware to the given UnaryOutbound transport.
Types ¶
type OnewayInbound ¶
type OnewayInbound interface {
HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
}
OnewayInbound defines a transport-level middleware for `OnewayHandler`s.
OnewayInbound middleware MAY ¶
- change the context - change the request - handle the returned error - call the given handler zero or more times
OnewayInbound middleware MUST be thread-safe.
OnewayInbound middleware is re-used across requests and MAY be called multiple times for the same request.
var NopOnewayInbound OnewayInbound = nopOnewayInbound{}
NopOnewayInbound is an inbound middleware that does not do anything special. It simply calls the underlying OnewayHandler.
type OnewayInboundFunc ¶
OnewayInboundFunc adapts a function into a OnewayInbound Middleware.
func (OnewayInboundFunc) HandleOneway ¶
func (f OnewayInboundFunc) HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
HandleOneway for OnewayInboundFunc
type OnewayOutbound ¶
type OnewayOutbound interface {
CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
}
OnewayOutbound defines transport-level middleware for `OnewayOutbound`s.
OnewayOutbound middleware MAY ¶
- change the context - change the request - change the returned ack - handle the returned error - call the given outbound zero or more times
OnewayOutbound middleware MUST ¶
- always return an Ack (nil or not) or an error. - be thread-safe
OnewayOutbound middleware is re-used across requests and MAY be called multiple times on the same request.
var NopOnewayOutbound OnewayOutbound = nopOnewayOutbound{}
NopOnewayOutbound is a oneway outbound middleware that does not do anything special. It simply calls the underlying OnewayOutbound transport.
type OnewayOutboundFunc ¶
type OnewayOutboundFunc func(context.Context, *transport.Request, transport.OnewayOutbound) (transport.Ack, error)
OnewayOutboundFunc adapts a function into a OnewayOutbound middleware.
func (OnewayOutboundFunc) CallOneway ¶
func (f OnewayOutboundFunc) CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
CallOneway for OnewayOutboundFunc.
type Router ¶ added in v1.2.0
type Router interface { // Procedures returns the list of procedures that can be called on this router. // Procedures SHOULD call into router that is passed in. Procedures(transport.Router) []transport.Procedure // Choose returns a HandlerSpec for the given request and transport. // If the Router cannot determine what to call it should call into the router that was // passed in. Choose(context.Context, *transport.Request, transport.Router) (transport.HandlerSpec, error) }
Router is a middleware for defining a customized routing experience for procedures
type UnaryInbound ¶
type UnaryInbound interface {
Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
}
UnaryInbound defines a transport-level middleware for `UnaryHandler`s.
UnaryInbound middleware MAY ¶
- change the context - change the request - call the ResponseWriter - modify the response body by wrapping the ResponseWriter - handle the returned error - call the given handler zero or more times
UnaryInbound middleware MUST be thread-safe.
UnaryInbound middleware is re-used across requests and MAY be called multiple times for the same request.
var NopUnaryInbound UnaryInbound = nopUnaryInbound{}
NopUnaryInbound is a inbound middleware that does not do anything special. It simply calls the underlying Handler.
type UnaryInboundFunc ¶
type UnaryInboundFunc func(context.Context, *transport.Request, transport.ResponseWriter, transport.UnaryHandler) error
UnaryInboundFunc adapts a function into an InboundMiddleware.
func (UnaryInboundFunc) Handle ¶
func (f UnaryInboundFunc) Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
Handle for UnaryInboundFunc
type UnaryOutbound ¶
type UnaryOutbound interface {
Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error)
}
UnaryOutbound defines transport-level middleware for `UnaryOutbound`s.
UnaryOutbound middleware MAY ¶
- change the context - change the request - change the returned response - handle the returned error - call the given outbound zero or more times
UnaryOutbound middleware MUST ¶
- always return a non-nil Response or error. - be thread-safe
UnaryOutbound middleware is re-used across requests and MAY be called multiple times on the same request.
var NopUnaryOutbound UnaryOutbound = nopUnaryOutbound{}
NopUnaryOutbound is a unary outbound middleware that does not do anything special. It simply calls the underlying UnaryOutbound.