Documentation ¶
Index ¶
- type Channel
- type ChannelInbound
- func (i *ChannelInbound) Channel() Channel
- func (i *ChannelInbound) Introspect() introspection.InboundStatus
- func (i *ChannelInbound) IsRunning() bool
- func (i *ChannelInbound) SetRouter(router transport.Router)
- func (i *ChannelInbound) Start() error
- func (i *ChannelInbound) Stop() error
- func (i *ChannelInbound) Transports() []transport.Transport
- type ChannelOutbound
- func (o *ChannelOutbound) Call(ctx context.Context, req *transport.Request) (*transport.Response, error)
- func (o *ChannelOutbound) Introspect() introspection.OutboundStatus
- func (o *ChannelOutbound) IsRunning() bool
- func (o *ChannelOutbound) Start() error
- func (o *ChannelOutbound) Stop() error
- func (o *ChannelOutbound) Transports() []transport.Transport
- type ChannelTransport
- func (t *ChannelTransport) Channel() Channel
- func (t *ChannelTransport) IsRunning() bool
- func (t *ChannelTransport) ListenAddr() string
- func (t *ChannelTransport) NewInbound() *ChannelInbound
- func (t *ChannelTransport) NewOutbound() *ChannelOutbound
- func (t *ChannelTransport) NewSingleOutbound(addr string) *ChannelOutbound
- func (t *ChannelTransport) Start() error
- func (t *ChannelTransport) Stop() error
- type TransportOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶ added in v0.5.0
type Channel interface { BeginCall( ctx context.Context, hostPort, serviceName, methodName string, callOptions *tchannel.CallOptions, ) (*tchannel.OutboundCall, error) Close() GetSubChannel(serviceName string, opts ...tchannel.SubChannelOption) *tchannel.SubChannel ListenAndServe(hostPort string) error PeerInfo() tchannel.LocalPeerInfo ServiceName() string State() tchannel.ChannelState }
Channel is top-level TChannel.
See https://godoc.org/github.com/uber/tchannel-go#Channel for more information.
type ChannelInbound ¶ added in v1.0.0
type ChannelInbound struct {
// contains filtered or unexported fields
}
ChannelInbound is a TChannel Inbound backed by a pre-existing TChannel Channel.
func (*ChannelInbound) Channel ¶ added in v1.0.0
func (i *ChannelInbound) Channel() Channel
Channel returns the underlying Channel for this Inbound.
func (*ChannelInbound) Introspect ¶ added in v1.0.0
func (i *ChannelInbound) Introspect() introspection.InboundStatus
Introspect returns the state of the inbound for introspection purposes.
func (*ChannelInbound) IsRunning ¶ added in v1.0.0
func (i *ChannelInbound) IsRunning() bool
IsRunning returns whether the ChannelInbound is running.
func (*ChannelInbound) SetRouter ¶ added in v1.0.0
func (i *ChannelInbound) SetRouter(router transport.Router)
SetRouter configures a router to handle incoming requests. This satisfies the transport.Inbound interface, and would be called by a dispatcher when it starts.
func (*ChannelInbound) Start ¶ added in v1.0.0
func (i *ChannelInbound) Start() error
Start starts a TChannel inbound. This arranges for registration of the request handler based on the router given by SetRouter.
Start does not start listening sockets. That occurs when you Start the underlying ChannelTransport.
func (*ChannelInbound) Stop ¶ added in v1.0.0
func (i *ChannelInbound) Stop() error
Stop stops the TChannel outbound. This currently does nothing.
func (*ChannelInbound) Transports ¶ added in v1.0.0
func (i *ChannelInbound) Transports() []transport.Transport
Transports returns a slice containing the ChannelInbound's underlying ChannelTransport.
type ChannelOutbound ¶ added in v1.0.0
type ChannelOutbound struct {
// contains filtered or unexported fields
}
ChannelOutbound is an outbound transport using a shared TChannel.
func (*ChannelOutbound) Call ¶ added in v1.0.0
func (o *ChannelOutbound) Call(ctx context.Context, req *transport.Request) (*transport.Response, error)
Call sends an RPC over this TChannel outbound.
func (*ChannelOutbound) Introspect ¶ added in v1.0.0
func (o *ChannelOutbound) Introspect() introspection.OutboundStatus
Introspect returns basic status about this outbound.
func (*ChannelOutbound) IsRunning ¶ added in v1.0.0
func (o *ChannelOutbound) IsRunning() bool
IsRunning returns whether the ChannelOutbound is running.
func (*ChannelOutbound) Start ¶ added in v1.0.0
func (o *ChannelOutbound) Start() error
Start starts the TChannel outbound.
func (*ChannelOutbound) Stop ¶ added in v1.0.0
func (o *ChannelOutbound) Stop() error
Stop stops the TChannel outbound.
func (*ChannelOutbound) Transports ¶ added in v1.0.0
func (o *ChannelOutbound) Transports() []transport.Transport
Transports returns the underlying TChannel Transport for this outbound.
type ChannelTransport ¶ added in v1.0.0
type ChannelTransport struct {
// contains filtered or unexported fields
}
ChannelTransport maintains TChannel peers and creates inbounds and outbounds for TChannel.
In a future version, the channel will be suitable for managing peers in a peer.List or other peer.Chooser.
func NewChannelTransport ¶ added in v1.0.0
func NewChannelTransport(opts ...TransportOption) *ChannelTransport
NewChannelTransport creates a ChannelTransport, suitable for creating inbounds and outbounds with an existing, shared channel.
The ChannelTransport uses the underlying TChannel load balancing and peer management, so it is not suitable for use with a peer.Chooser. A future version of YARPC will add a NewTransport constructor that returns a transport suitable for custom peer selection.
func (*ChannelTransport) Channel ¶ added in v1.0.0
func (t *ChannelTransport) Channel() Channel
Channel returns the underlying TChannel "Channel" instance.
func (*ChannelTransport) IsRunning ¶ added in v1.0.0
func (t *ChannelTransport) IsRunning() bool
IsRunning returns whether the ChannelTransport is running.
func (*ChannelTransport) ListenAddr ¶ added in v1.0.0
func (t *ChannelTransport) ListenAddr() string
ListenAddr exposes the listen address of the transport.
func (*ChannelTransport) NewInbound ¶ added in v1.0.0
func (t *ChannelTransport) NewInbound() *ChannelInbound
NewInbound returns a new TChannel inbound backed by a shared TChannel transport. The returned ChannelInbound does not support peer.Chooser and uses TChannel's own internal load balancing peer selection.
func (*ChannelTransport) NewOutbound ¶ added in v1.0.0
func (t *ChannelTransport) NewOutbound() *ChannelOutbound
NewOutbound builds a new TChannel outbound using the transport's shared channel to make requests to any connected peer.
func (*ChannelTransport) NewSingleOutbound ¶ added in v1.0.0
func (t *ChannelTransport) NewSingleOutbound(addr string) *ChannelOutbound
NewSingleOutbound builds a new TChannel outbound using the transport's shared channel to a specific peer.
func (*ChannelTransport) Start ¶ added in v1.0.0
func (t *ChannelTransport) Start() error
Start starts a TChannel transport, opening listening sockets and accepting inbound requests, and opening connections to retained peers.
All inbounds must have been assigned a router to accept inbound requests.
func (*ChannelTransport) Stop ¶ added in v1.0.0
func (t *ChannelTransport) Stop() error
Stop stops a TChannel transport, closing listening sockets, rejecting inbound requests, draining pending requests, and closing all connections.
Stop blocks until the program can gracefully exit.
type TransportOption ¶ added in v1.0.0
type TransportOption func(*transportConfig)
TransportOption is for variadic arguments to NewChannelTransport.
TransportOption will eventually also be suitable for passing to NewTransport.
func ListenAddr ¶
func ListenAddr(addr string) TransportOption
ListenAddr informs a transport constructor what address (in the form of host:port) to listen on. This option does not apply to NewChannelTransport if it is called with WithChannel and a channel that is already listening.
func ServiceName ¶ added in v1.0.0
func ServiceName(name string) TransportOption
ServiceName informs the NewChannelTransport constructor which service name to use if it needs to construct a root Channel object, as when called without the WithChannel option.
func Tracer ¶ added in v1.0.0
func Tracer(tracer opentracing.Tracer) TransportOption
Tracer is an option that configures the tracer for a TChannel transport.
func WithChannel ¶ added in v1.0.0
func WithChannel(ch Channel) TransportOption
WithChannel informs NewChannelTransport that it should reuse an existing underlying TChannel Channel instance. This instance may already have handlers and be listening before this transport starts. Otherwise, The TransportChannel will listen on start, albeit with the default address ":0" (all interfaces, any port).