Documentation ¶
Index ¶
- Variables
- func InjectSessionID(sid uuid.UUID, ctx context.Context) context.Context
- type Client
- type ClientCodec
- type ClientOption
- type ClientRequestFunc
- type ContextKeySessionID
- type DecodeRequestFunc
- type DecodeResponseFunc
- type EncodeRequestFunc
- type EncodeResponseFunc
- type Server
- type ServerCodec
- type ServerOption
- type ServerRequestFunc
- type StreamClient
- type StreamClientOption
- type StreamServer
- type StreamServerOption
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSessionIDNotAssigned returned when no session is defined in context. ErrSessionIDNotDefined = errors.New("session id not defined") )
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a wirenet connection and provides a method that implements endpoint.Endpoint.
func NewClient ¶
func NewClient( wire wirenet.Wire, streamName string, enc EncodeRequestFunc, dec DecodeResponseFunc, options ...ClientOption, ) *Client
NewClient constructs a usable Client for a single remote endpoint.
type ClientCodec ¶
ClientCodec encodes and decodes the byte stream in the user-domain.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption sets an optional parameter for clients.
func ClientBefore ¶
func ClientBefore(before ...ClientRequestFunc) ClientOption
ClientBefore sets the RequestFuncs that are applied to the outgoing request before it's invoked.
type ClientRequestFunc ¶
ClientRequestFunc can take information from the context and use it to build the stream.
func SetSessionID ¶
func SetSessionID(sid uuid.UUID) ClientRequestFunc
SetSessionID returns a ClientRequestFunc that sets the session id.
type ContextKeySessionID ¶
type ContextKeySessionID struct{}
ContextKeySessionID used to inject into session context.
type DecodeRequestFunc ¶
type DecodeRequestFunc func(context.Context, io.ReadCloser) (request interface{}, err error)
DecodeRequestFunc extracts a user-domain request object from a wirenet request.
type DecodeResponseFunc ¶
type DecodeResponseFunc func(context.Context, io.ReadCloser) (response interface{}, err error)
DecodeResponseFunc extracts a user-domain response object from a wirenet response object.
type EncodeRequestFunc ¶
type EncodeRequestFunc func(context.Context, interface{}, io.WriteCloser) error
EncodeRequestFunc encodes the passed request object into the wirenet request object.
type EncodeResponseFunc ¶
type EncodeResponseFunc func(context.Context, interface{}, io.WriteCloser) error
EncodeResponseFunc encodes the passed response object to the wirenet response message.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an endpoint and implements wirenet.Handler.
func NewServer ¶
func NewServer( e endpoint.Endpoint, dec DecodeRequestFunc, enc EncodeResponseFunc, options ...ServerOption, ) *Server
NewStreamServer constructs a new server, which implements wraps the provided endpoint and implements the Handler interface.
type ServerCodec ¶
ServerCodec encodes and decodes the byte stream in the user-domain.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption sets an optional parameter for servers.
func ServerBefore ¶
func ServerBefore(before ...ServerRequestFunc) ServerOption
ServerBefore functions are executed on the stream request object before the request is decoded.
func ServerErrorHandler ¶
func ServerErrorHandler(errorHandler transport.ErrorHandler) ServerOption
ServerErrorHandler is used to handle non-terminal errors. By default, non-terminal errors are ignored. This is intended as a diagnostic measure.
type ServerRequestFunc ¶
ServerRequestFunc can take information from the context and use it to the handle stream.
type StreamClient ¶
type StreamClient struct {
// contains filtered or unexported fields
}
StreamClient wraps a wirenet connection and provides a method that implements endpoint.Endpoint.
func NewStreamClient ¶
func NewStreamClient( wire wirenet.Wire, streamName string, codec ClientCodec, options ...StreamClientOption, ) *StreamClient
NewStreamClient constructs a usable StreamClient for a single remote endpoint.
func (StreamClient) Endpoint ¶
func (c StreamClient) Endpoint() endpoint.Endpoint
Endpoint returns a usable endpoint that will invoke the wirenet specified by the client.
type StreamClientOption ¶
type StreamClientOption func(*StreamClient)
StreamClientOption sets an optional parameter for clients.
func StreamClientBefore ¶
func StreamClientBefore(before ...ClientRequestFunc) StreamClientOption
StreamClientBefore sets the RequestFuncs that are applied to the outgoing request before it's invoked.
type StreamServer ¶
type StreamServer struct {
// contains filtered or unexported fields
}
StreamServer wraps an endpoint and implements wirenet.Handler.
func NewStreamServer ¶
func NewStreamServer( e endpoint.Endpoint, codec ServerCodec, options ...StreamServerOption, ) *StreamServer
NewStreamServer constructs a new server, which implements wraps the provided endpoint and implements the Handler interface.
func (StreamServer) Handle ¶
func (s StreamServer) Handle(ctx context.Context, stream wirenet.Stream)
Handle implements the Handler interface.
type StreamServerOption ¶
type StreamServerOption func(*StreamServer)
StreamServerOption sets an optional parameter for servers.
func StreamServerBefore ¶
func StreamServerBefore(before ...ServerRequestFunc) StreamServerOption
StreamServerBefore functions are executed on the stream request object before the request is decoded.
func StreamServerErrorHandler ¶
func StreamServerErrorHandler(errorHandler transport.ErrorHandler) StreamServerOption
StreamServerErrorHandler is used to handle non-terminal errors. By default, non-terminal errors are ignored. This is intended as a diagnostic measure.