middleware

package
v1.0.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2016 License: MIT Imports: 2 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOnewayInboundMiddleware

func ApplyOnewayInboundMiddleware(h transport.OnewayHandler, i OnewayInboundMiddleware) transport.OnewayHandler

ApplyOnewayInboundMiddleware applies the given OnewayInboundMiddleware to the given OnewayHandler.

func ApplyOnewayOutboundMiddleware

func ApplyOnewayOutboundMiddleware(o transport.OnewayOutbound, f OnewayOutboundMiddleware) transport.OnewayOutbound

ApplyOnewayOutboundMiddleware applies the given OnewayOutboundMiddleware to the given OnewayOutbound.

func ApplyUnaryInboundMiddleware

func ApplyUnaryInboundMiddleware(h transport.UnaryHandler, i UnaryInboundMiddleware) transport.UnaryHandler

ApplyUnaryInboundMiddleware applies the given InboundMiddleware to the given Handler.

func ApplyUnaryOutboundMiddleware

func ApplyUnaryOutboundMiddleware(o transport.UnaryOutbound, f UnaryOutboundMiddleware) transport.UnaryOutbound

ApplyUnaryOutboundMiddleware applies the given UnaryOutboundMiddleware to the given UnaryOutbound.

Types

type OnewayInboundMiddleware

type OnewayInboundMiddleware interface {
	HandleOneway(ctx context.Context, req *transport.Request, h transport.OnewayHandler) error
}

OnewayInboundMiddleware defines a transport-level middleware for `OnewayHandler`s.

OnewayInboundMiddleware MAY

- change the context - change the request - handle the returned error - call the given handler zero or more times

OnewayInboundMiddleware MUST be thread-safe.

OnewayInboundMiddleware is re-used across requests and MAY be called multiple times for the same request.

var NopOnewayInboundMiddleware OnewayInboundMiddleware = nopOnewayInboundMiddleware{}

NopOnewayInboundMiddleware is an inbound middleware that does not do anything special. It simply calls the underlying OnewayHandler.

type OnewayInboundMiddlewareFunc

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

OnewayInboundMiddlewareFunc adapts a function into a OnwayInboundMiddleware.

func (OnewayInboundMiddlewareFunc) HandleOneway

HandleOneway for OnewayInboundMiddlewareFunc

type OnewayOutboundMiddleware

type OnewayOutboundMiddleware interface {
	CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error)
}

OnewayOutboundMiddleware defines transport-level middleware for `OnewayOutbound`s.

OnewayOutboundMiddleware MAY

- change the context - change the request - change the returned ack - handle the returned error - call the given outbound zero or more times

OnewayOutboundMiddleware MUST

- always return an Ack (nil or not) or an error. - be thread-safe

OnewayOutboundMiddleware is re-used across requests and MAY be called multiple times on the same request.

var NopOnewayOutboundMiddleware OnewayOutboundMiddleware = nopOnewayOutboundMiddleware{}

NopOnewayOutboundMiddleware is a oneway outbound middleware that does not do anything special. It simply calls the underlying OnewayOutbound.

type OnewayOutboundMiddlewareFunc

type OnewayOutboundMiddlewareFunc func(context.Context, *transport.Request, transport.OnewayOutbound) (transport.Ack, error)

OnewayOutboundMiddlewareFunc adapts a function into a OnewayOutboundMiddleware.

func (OnewayOutboundMiddlewareFunc) CallOneway

CallOneway for OnewayOutboundMiddlewareFunc.

type UnaryInboundMiddleware

type UnaryInboundMiddleware interface {
	Handle(ctx context.Context, req *transport.Request, resw transport.ResponseWriter, h transport.UnaryHandler) error
}

UnaryInboundMiddleware defines a transport-level middleware for `UnaryHandler`s.

UnaryInboundMiddleware 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

UnaryInboundMiddleware MUST be thread-safe.

UnaryInboundMiddleware is re-used across requests and MAY be called multiple times for the same request.

var NopUnaryInboundMiddleware UnaryInboundMiddleware = nopUnaryInboundMiddleware{}

NopUnaryInboundMiddleware is a inbound middleware that does not do anything special. It simply calls the underlying Handler.

type UnaryInboundMiddlewareFunc

UnaryInboundMiddlewareFunc adapts a function into an InboundMiddleware.

func (UnaryInboundMiddlewareFunc) Handle

Handle for UnaryInboundMiddlewareFunc

type UnaryOutboundMiddleware

type UnaryOutboundMiddleware interface {
	Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error)
}

UnaryOutboundMiddleware defines transport-level middleware for `UnaryOutbound`s.

UnaryOutboundMiddleware MAY

- change the context - change the request - change the returned response - handle the returned error - call the given outbound zero or more times

UnaryOutboundMiddleware MUST

- always return a non-nil Response or error. - be thread-safe

UnaryOutboundMiddleware is re-used across requests and MAY be called multiple times on the same request.

var NopUnaryOutboundMiddleware UnaryOutboundMiddleware = nopUnaryOutboundMiddleware{}

NopUnaryOutboundMiddleware is a unary outbound middleware that does not do anything special. It simply calls the underlying UnaryOutbound.

type UnaryOutboundMiddlewareFunc

type UnaryOutboundMiddlewareFunc func(context.Context, *transport.Request, transport.UnaryOutbound) (*transport.Response, error)

UnaryOutboundMiddlewareFunc adapts a function into a UnaryOutboundMiddleware.

func (UnaryOutboundMiddlewareFunc) Call

Call for UnaryOutboundMiddlewareFunc.

Jump to

Keyboard shortcuts

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