Documentation ¶
Index ¶
- Variables
- func NewClientDispatcher(transportType TransportType, config *DispatcherConfig, logger *zap.Logger) (*yarpc.Dispatcher, error)
- func NewServerDispatcher(procedures []transport.Procedure, config *DispatcherConfig, logger *zap.Logger) (*yarpc.Dispatcher, error)
- func WithClientInfo(serviceName string, procedures []transport.Procedure, ...) (err error)
- type ClientInfo
- type DispatcherConfig
- type TransportType
Constants ¶
This section is empty.
Variables ¶
var ( // AllTransportTypes are all TransportTypes, AllTransportTypes = []TransportType{ TransportTypeHTTP, TransportTypeTChannel, TransportTypeGRPC, } )
Functions ¶
func NewClientDispatcher ¶
func NewClientDispatcher(transportType TransportType, config *DispatcherConfig, logger *zap.Logger) (*yarpc.Dispatcher, error)
NewClientDispatcher returns a new client Dispatcher.
HTTP always will be configured as an outbound for Oneway. gRPC always will be configured as an outbound for Stream.
func NewServerDispatcher ¶
func NewServerDispatcher(procedures []transport.Procedure, config *DispatcherConfig, logger *zap.Logger) (*yarpc.Dispatcher, error)
NewServerDispatcher returns a new server Dispatcher.
func WithClientInfo ¶
func WithClientInfo(serviceName string, procedures []transport.Procedure, transportType TransportType, f func(*ClientInfo) error) (err error)
WithClientInfo wraps a function by setting up a client and server dispatcher and giving the function the client configuration to use in tests for the given TransportType.
The server dispatcher will be brought up using all TransportTypes and with the serviceName. The client dispatcher will be brought up using the given TransportType for Unary, HTTP for Oneway, and the serviceName with a "-client" suffix.
Types ¶
type ClientInfo ¶
type ClientInfo struct { ClientConfig transport.ClientConfig GRPCClientConn *ggrpc.ClientConn ContextWrapper *grpcctx.ContextWrapper }
ClientInfo holds the client info for testing.
type DispatcherConfig ¶
type DispatcherConfig struct {
// contains filtered or unexported fields
}
DispatcherConfig is the configuration for a Dispatcher.
func NewDispatcherConfig ¶
func NewDispatcherConfig(serviceName string) (*DispatcherConfig, error)
NewDispatcherConfig returns a new DispatcherConfig with assigned ports.
func (*DispatcherConfig) GetPort ¶
func (d *DispatcherConfig) GetPort(transportType TransportType) (uint16, error)
GetPort gets the port for the TransportType.
func (*DispatcherConfig) GetServiceName ¶
func (d *DispatcherConfig) GetServiceName() string
GetServiceName gets the service name.
type TransportType ¶
type TransportType int
TransportType is a transport type.
const ( // TransportTypeHTTP represents using HTTP. TransportTypeHTTP TransportType = iota // TransportTypeTChannel represents using TChannel. TransportTypeTChannel // TransportTypeGRPC represents using GRPC. TransportTypeGRPC )
func ParseTransportType ¶
func ParseTransportType(s string) (TransportType, error)
ParseTransportType parses a transport type from a string.
func (TransportType) String ¶
func (t TransportType) String() string
String returns a string representation of t.