Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterInterceptor ¶ added in v0.12.0
func RegisterInterceptor(newRI RequestInterceptor) (restore func())
RegisterInterceptor sets the provided request interceptor to be used on future calls to ApplyInterceptor(). Calls to RegisterInterceptor() will overwrite previously registered interceptors; that is, only one interceptor is allowed at a time. Returns a function to undo the change made by this call.
Types ¶
type GRPCOptions ¶ added in v0.12.0
type GRPCOptions struct { Addresses []string Tracer opentracing.Tracer Caller string Encoding string RoutingKey string RoutingDelegate string }
GRPCOptions are used to create a GRPC transport.
type HTTPOptions ¶
type HTTPOptions struct { Method string URLs []string SourceService string TargetService string RoutingDelegate string RoutingKey string ShardKey string Encoding string Tracer opentracing.Tracer }
HTTPOptions are used to create a HTTP transport.
type Request ¶
type Request struct { TargetService string Method string Timeout time.Duration Headers map[string]string Baggage map[string]string TransportHeaders map[string]string ShardKey string Body []byte }
Request is the fields used to make an RPC.
type RequestInterceptor ¶ added in v0.12.0
type RequestInterceptor interface { // Apply mutates and returns the passed Request object. Apply(ctx context.Context, req *Request) (*Request, error) }
RequestInterceptor allows for its implementors to modify a pre-flight Request.
type Response ¶
type Response struct { Headers map[string]string Body []byte // TransportFields contains fields that are transport-specific. TransportFields map[string]interface{} }
Response represents the result of an RPC.
type TChannelOptions ¶
type TChannelOptions struct { // SourceService is the service name on the source side. SourceService string // TargetService is the service name being targeted. TargetService string // RoutingDelegate is a traffic group that overrides the routing key, // to redirect to an application layer traffic proxy. RoutingDelegate string // RoutingKey is a traffic group that overrides the service name, for a // proxy to redirect to a more specific traffic group than the service // proper. RoutingKey string // ShardKey is an opaque blob that clues where to direct a request to an // instance within a traffic group. ShardKey string // LogLevel overrides the default LogLevel (Warn). LogLevel *tchannel.LogLevel // Peers is a list of host:ports to add to the channel. Peers []string // Encoding is used to set the TChannel format ("as" header). Encoding string // TraceSampleRate sets the sample rate for tracing. TraceSampleRate float64 // TransportOpts are a list of options, mostly used to add or override // TChannel's transport headers. TransportOpts map[string]string // Tracer is an instance of an opentracing tracer for baggage propagation // and/or span submission. Tracer opentracing.Tracer }
TChannelOptions are used to create a TChannel transport.
type Transport ¶
type Transport interface { Call(ctx context.Context, request *Request) (*Response, error) Protocol() Protocol Tracer() opentracing.Tracer }
Transport defines the interface for the underlying transport over which calls are made.
func NewHTTP ¶
func NewHTTP(opts HTTPOptions) (Transport, error)
NewHTTP returns a transport that calls a HTTP service.
func NewTChannel ¶
func NewTChannel(opts TChannelOptions) (Transport, error)
NewTChannel returns a Transport that calls a TChannel service.
type TransportCloser ¶ added in v0.12.0
TransportCloser is a Transport that can be closed.
func NewGRPC ¶ added in v0.12.0
func NewGRPC(options GRPCOptions) (TransportCloser, error)
NewGRPC returns a transport that calls a GRPC service.