middleware

package
Version: v1.27.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: MIT Imports: 3 Imported by: 0

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 ApplyStreamInbound added in v1.27.0

ApplyStreamInbound applies the given StreamInbound middleware to the given StreamHandler.

func ApplyStreamOutbound added in v1.27.0

ApplyStreamOutbound applies the given StreamOutbound middleware to the given StreamOutbound 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 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 StreamInbound added in v1.27.0

type StreamInbound interface {
	HandleStream(s *transport.ServerStream, h transport.StreamHandler) error
}

StreamInbound defines a transport-level middleware for `StreamHandler`s.

StreamInbound middleware MAY do zero or more of the following: change the stream, handle the returned error, call the given handler zero or more times.

StreamInbound middleware MUST be thread-safe.

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

var NopStreamInbound StreamInbound = nopStreamInbound{}

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

type StreamInboundFunc added in v1.27.0

type StreamInboundFunc func(*transport.ServerStream, transport.StreamHandler) error

StreamInboundFunc adapts a function into a StreamInbound Middleware.

func (StreamInboundFunc) HandleStream added in v1.27.0

HandleStream for StreamInboundFunc

type StreamOutbound added in v1.27.0

type StreamOutbound interface {
	CallStream(ctx context.Context, request *transport.StreamRequest, out transport.StreamOutbound) (*transport.ClientStream, error)
}

StreamOutbound defines transport-level middleware for `StreamOutbound`s.

StreamOutbound middleware MAY do zero or more of the following: change the context, change the requestMeta, change the returned Stream, handle the returned error, call the given outbound zero or more times.

StreamOutbound middleware MUST always return a non-nil Stream or error, and they MUST be thread-safe

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

var NopStreamOutbound StreamOutbound = nopStreamOutbound{}

NopStreamOutbound is a stream outbound middleware that does not do anything special. It simply calls the underlying StreamOutbound.

type StreamOutboundFunc added in v1.27.0

StreamOutboundFunc adapts a function into a StreamOutbound middleware.

func (StreamOutboundFunc) CallStream added in v1.27.0

CallStream for StreamOutboundFunc.

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL