Documentation ¶
Overview ¶
Package ping is generated code used to make or handle TChannel calls using Thrift.
Index ¶
- Variables
- func NewTChanPingPongServiceInheritedClient(thriftService string, client thrift.TChanClient) *tchanPingPongServiceClient
- func NewTChanPingPongServiceServer(handler TChanPingPongService) thrift.TChanServer
- type Ping
- type PingPongService
- type PingPongServiceClient
- type PingPongServiceConfiguration
- type PingPongServicePingArgs
- type PingPongServicePingConfiguration
- type PingPongServicePingResult
- func (p *PingPongServicePingResult) GetSuccess() *Pong
- func (p *PingPongServicePingResult) IsSetSuccess() bool
- func (p *PingPongServicePingResult) Read(iprot thrift.TProtocol) error
- func (p *PingPongServicePingResult) String() string
- func (p *PingPongServicePingResult) Write(oprot thrift.TProtocol) error
- type PingPongServiceProcessor
- func (p *PingPongServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)
- func (p *PingPongServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)
- func (p *PingPongServiceProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)
- func (p *PingPongServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction
- type Pong
- type RingpopPingPongServiceAdapter
- type TChanPingPongService
Constants ¶
This section is empty.
Variables ¶
var GoUnusedProtection__ int
var Pong_Pheader_DEFAULT string
Functions ¶
func NewTChanPingPongServiceInheritedClient ¶
func NewTChanPingPongServiceInheritedClient(thriftService string, client thrift.TChanClient) *tchanPingPongServiceClient
func NewTChanPingPongServiceServer ¶
func NewTChanPingPongServiceServer(handler TChanPingPongService) thrift.TChanServer
NewTChanPingPongServiceServer wraps a handler for TChanPingPongService so it can be registered with a thrift.Server.
Types ¶
type Ping ¶
type Ping struct {
Key string `thrift:"key,1,required" json:"key"`
}
Attributes:
- Key
var PingPongServicePingArgs_Request_DEFAULT *Ping
type PingPongService ¶
type PingPongServiceClient ¶
type PingPongServiceClient struct { Transport thrift.TTransport ProtocolFactory thrift.TProtocolFactory InputProtocol thrift.TProtocol OutputProtocol thrift.TProtocol SeqId int32 }
func NewPingPongServiceClientFactory ¶
func NewPingPongServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *PingPongServiceClient
func NewPingPongServiceClientProtocol ¶
func NewPingPongServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PingPongServiceClient
type PingPongServiceConfiguration ¶
type PingPongServiceConfiguration struct { // Ping holds the forwarding configuration for the Ping endpoint defined in the service Ping *PingPongServicePingConfiguration }
PingPongServiceConfiguration contains the forwarding configuration for the PingPongService service. It has a field for every endpoint defined in the service. In this field the endpoint specific forward configuration can be stored. Populating these fields is optional, default behaviour is to call the service implementation locally to the process where the call came in.
type PingPongServicePingArgs ¶
type PingPongServicePingArgs struct {
Request *Ping `thrift:"request,1" json:"request"`
}
Attributes:
- Request
func NewPingPongServicePingArgs ¶
func NewPingPongServicePingArgs() *PingPongServicePingArgs
func (*PingPongServicePingArgs) GetRequest ¶
func (p *PingPongServicePingArgs) GetRequest() *Ping
func (*PingPongServicePingArgs) IsSetRequest ¶
func (p *PingPongServicePingArgs) IsSetRequest() bool
func (*PingPongServicePingArgs) Read ¶
func (p *PingPongServicePingArgs) Read(iprot thrift.TProtocol) error
func (*PingPongServicePingArgs) String ¶
func (p *PingPongServicePingArgs) String() string
type PingPongServicePingConfiguration ¶
type PingPongServicePingConfiguration struct { // Key is a closure that generates a routable key based on the parameters of the incomming request. Key func(ctx thrift.Context, request *Ping) (string, error) }
PingPongServicePingConfiguration contains the configuration on how to route calls to the thrift endpoint PingPongService::Ping.
type PingPongServicePingResult ¶
type PingPongServicePingResult struct {
Success *Pong `thrift:"success,0" json:"success,omitempty"`
}
Attributes:
- Success
func NewPingPongServicePingResult ¶
func NewPingPongServicePingResult() *PingPongServicePingResult
func (*PingPongServicePingResult) GetSuccess ¶
func (p *PingPongServicePingResult) GetSuccess() *Pong
func (*PingPongServicePingResult) IsSetSuccess ¶
func (p *PingPongServicePingResult) IsSetSuccess() bool
func (*PingPongServicePingResult) Read ¶
func (p *PingPongServicePingResult) Read(iprot thrift.TProtocol) error
func (*PingPongServicePingResult) String ¶
func (p *PingPongServicePingResult) String() string
type PingPongServiceProcessor ¶
type PingPongServiceProcessor struct {
// contains filtered or unexported fields
}
func NewPingPongServiceProcessor ¶
func NewPingPongServiceProcessor(handler PingPongService) *PingPongServiceProcessor
func (*PingPongServiceProcessor) AddToProcessorMap ¶
func (p *PingPongServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)
func (*PingPongServiceProcessor) GetProcessorFunction ¶
func (p *PingPongServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)
func (*PingPongServiceProcessor) Process ¶
func (p *PingPongServiceProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)
func (*PingPongServiceProcessor) ProcessorMap ¶
func (p *PingPongServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction
type Pong ¶
type Pong struct { Message string `thrift:"message,1,required" json:"message"` From_ string `thrift:"from_,2,required" json:"from_"` Pheader *string `thrift:"pheader,3" json:"pheader,omitempty"` }
Attributes:
- Message
- From_
- Pheader
var PingPongServicePingResult_Success_DEFAULT *Pong
func (*Pong) GetMessage ¶
func (*Pong) GetPheader ¶
func (*Pong) IsSetPheader ¶
type RingpopPingPongServiceAdapter ¶
type RingpopPingPongServiceAdapter struct {
// contains filtered or unexported fields
}
func (*RingpopPingPongServiceAdapter) GetLocalClient ¶
func (a *RingpopPingPongServiceAdapter) GetLocalClient() interface{}
GetLocalClient satisfies the ClientFactory interface of ringpop-go/router
func (*RingpopPingPongServiceAdapter) MakeRemoteClient ¶
func (a *RingpopPingPongServiceAdapter) MakeRemoteClient(client thrift.TChanClient) interface{}
MakeRemoteClient satisfies the ClientFactory interface of ringpop-go/router
func (*RingpopPingPongServiceAdapter) Ping ¶
func (a *RingpopPingPongServiceAdapter) Ping(ctx thrift.Context, request *Ping) (r *Pong, err error)
Ping satisfies the TChanPingPongService interface. This function uses the configuration for Ping to determine the host to execute the call on. When it decides the call needs to be executed in the current process it will forward the invocation to its local implementation.
type TChanPingPongService ¶
TChanPingPongService is the interface that defines the server handler and client interface.
func NewRingpopPingPongServiceAdapter ¶
func NewRingpopPingPongServiceAdapter( impl TChanPingPongService, rp ringpop.Interface, ch *tchannel.Channel, config PingPongServiceConfiguration, ) (TChanPingPongService, error)
NewRingpopPingPongServiceAdapter creates an implementation of the TChanPingPongService interface. This specific implementation will use to configuration provided during construction to deterministically route calls to nodes from a ringpop cluster. The channel should be the channel on which the service exposes its endpoints. Forwarded calls, calls to unconfigured endpoints and calls that already were executed on the right machine will be passed on the the implementation passed in during construction.
Example usage:
import "github.com/uber/tchannel-go/thrift" var server thrift.Server server = ... var handler TChanPingPongService handler = &YourImplementation{} adapter, _ := NewRingpopPingPongServiceAdapter(handler, ringpop, channel, PingPongServiceConfiguration{ Ping: &PingPongServicePingConfiguration: { Key: func(ctx thrift.Context, request *Ping) (shardKey string, err error) { return "calculated-shard-key", nil }, }, }, ) server.Register(NewTChanPingPongServiceServer(adapter))
func NewTChanPingPongServiceClient ¶
func NewTChanPingPongServiceClient(client thrift.TChanClient) TChanPingPongService
NewTChanPingPongServiceClient creates a client that can be used to make remote calls.