middleware

package
v1.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2016 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 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

- 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

- 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

OnewayOutboundFunc adapts a function into a OnewayOutbound middleware.

func (OnewayOutboundFunc) CallOneway

CallOneway for OnewayOutboundFunc.

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

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

- 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.

type UnaryOutboundFunc

UnaryOutboundFunc adapts a function into a UnaryOutbound middleware.

func (UnaryOutboundFunc) Call

Call for UnaryOutboundFunc.

Jump to

Keyboard shortcuts

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