middleware

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2017 License: MIT Imports: 3 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOnewayInbound

ApplyOnewayInbound applies the given OnewayInbound middleware to the given OnewayHandler.

func ApplyOnewayOutbound

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

ApplyUnaryInbound applies the given InboundMiddleware to the given Handler.

func ApplyUnaryOutbound

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 do zero or more of the following: 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

type OnewayInboundFunc func(context.Context, *transport.Request, transport.OnewayHandler) error

OnewayInboundFunc adapts a function into a OnewayInbound Middleware.

func (OnewayInboundFunc) HandleOneway

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 do zero or more of the following: 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, and they MUST 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

OnewayOutboundFunc adapts a function into a OnewayOutbound middleware.

func (OnewayOutboundFunc) CallOneway

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 do zero or more of the following: 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

UnaryInboundFunc adapts a function into an InboundMiddleware.

func (UnaryInboundFunc) Handle

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 do zero or more of the following: 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, and they MUST 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.

type UnaryOutboundFunc

UnaryOutboundFunc adapts a function into a UnaryOutbound middleware.

func (UnaryOutboundFunc) Call

Call for UnaryOutboundFunc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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