pingpong

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pingpong is generated code used to make or handle TChannel calls using Thrift.

Index

Constants

This section is empty.

Variables

View Source
var GoUnusedProtection__ int

Functions

func NewTChanPingPongInheritedClient

func NewTChanPingPongInheritedClient(thriftService string, client thrift.TChanClient) *tchanPingPongClient

func NewTChanPingPongServer

func NewTChanPingPongServer(handler TChanPingPong) thrift.TChanServer

NewTChanPingPongServer wraps a handler for TChanPingPong 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 PingPongPingArgs_Request_DEFAULT *Ping

func NewPing

func NewPing() *Ping

func (*Ping) GetKey

func (p *Ping) GetKey() string

func (*Ping) Read

func (p *Ping) Read(iprot thrift.TProtocol) error

func (*Ping) String

func (p *Ping) String() string

func (*Ping) Write

func (p *Ping) Write(oprot thrift.TProtocol) error

type PingPong

type PingPong interface {
	// Parameters:
	//  - Request
	Ping(request *Ping) (r *Pong, err error)
}

type PingPongClient

type PingPongClient struct {
	Transport       thrift.TTransport
	ProtocolFactory thrift.TProtocolFactory
	InputProtocol   thrift.TProtocol
	OutputProtocol  thrift.TProtocol
	SeqId           int32
}

func NewPingPongClientProtocol

func NewPingPongClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *PingPongClient

func (*PingPongClient) Ping

func (p *PingPongClient) Ping(request *Ping) (r *Pong, err error)

Parameters:

  • Request

type PingPongConfiguration

type PingPongConfiguration struct {
	// Ping holds the forwarding configuration for the Ping endpoint defined in the service
	Ping *PingPongPingConfiguration
}

PingPongConfiguration contains the forwarding configuration for the PingPong 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 PingPongPingArgs

type PingPongPingArgs struct {
	Request *Ping `thrift:"request,1" json:"request"`
}

Attributes:

  • Request

func NewPingPongPingArgs

func NewPingPongPingArgs() *PingPongPingArgs

func (*PingPongPingArgs) GetRequest

func (p *PingPongPingArgs) GetRequest() *Ping

func (*PingPongPingArgs) IsSetRequest

func (p *PingPongPingArgs) IsSetRequest() bool

func (*PingPongPingArgs) Read

func (p *PingPongPingArgs) Read(iprot thrift.TProtocol) error

func (*PingPongPingArgs) String

func (p *PingPongPingArgs) String() string

func (*PingPongPingArgs) Write

func (p *PingPongPingArgs) Write(oprot thrift.TProtocol) error

type PingPongPingConfiguration

type PingPongPingConfiguration 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)
}

PingPongPingConfiguration contains the configuration on how to route calls to the thrift endpoint PingPong::Ping.

type PingPongPingResult

type PingPongPingResult struct {
	Success *Pong `thrift:"success,0" json:"success,omitempty"`
}

Attributes:

  • Success

func NewPingPongPingResult

func NewPingPongPingResult() *PingPongPingResult

func (*PingPongPingResult) GetSuccess

func (p *PingPongPingResult) GetSuccess() *Pong

func (*PingPongPingResult) IsSetSuccess

func (p *PingPongPingResult) IsSetSuccess() bool

func (*PingPongPingResult) Read

func (p *PingPongPingResult) Read(iprot thrift.TProtocol) error

func (*PingPongPingResult) String

func (p *PingPongPingResult) String() string

func (*PingPongPingResult) Write

func (p *PingPongPingResult) Write(oprot thrift.TProtocol) error

type PingPongProcessor

type PingPongProcessor struct {
	// contains filtered or unexported fields
}

func NewPingPongProcessor

func NewPingPongProcessor(handler PingPong) *PingPongProcessor

func (*PingPongProcessor) AddToProcessorMap

func (p *PingPongProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction)

func (*PingPongProcessor) GetProcessorFunction

func (p *PingPongProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)

func (*PingPongProcessor) Process

func (p *PingPongProcessor) Process(iprot, oprot thrift.TProtocol) (success bool, err thrift.TException)

func (*PingPongProcessor) ProcessorMap

func (p *PingPongProcessor) ProcessorMap() map[string]thrift.TProcessorFunction

type Pong

type Pong struct {
	Source string `thrift:"source,1,required" json:"source"`
}

Attributes:

  • Source
var PingPongPingResult_Success_DEFAULT *Pong

func NewPong

func NewPong() *Pong

func (*Pong) GetSource

func (p *Pong) GetSource() string

func (*Pong) Read

func (p *Pong) Read(iprot thrift.TProtocol) error

func (*Pong) String

func (p *Pong) String() string

func (*Pong) Write

func (p *Pong) Write(oprot thrift.TProtocol) error

type RingpopPingPongAdapter

type RingpopPingPongAdapter struct {
	// contains filtered or unexported fields
}

func (*RingpopPingPongAdapter) GetLocalClient

func (a *RingpopPingPongAdapter) GetLocalClient() interface{}

GetLocalClient satisfies the ClientFactory interface of ringpop-go/router

func (*RingpopPingPongAdapter) MakeRemoteClient

func (a *RingpopPingPongAdapter) MakeRemoteClient(client thrift.TChanClient) interface{}

MakeRemoteClient satisfies the ClientFactory interface of ringpop-go/router

func (*RingpopPingPongAdapter) Ping

func (a *RingpopPingPongAdapter) Ping(ctx thrift.Context, request *Ping) (r *Pong, err error)

Ping satisfies the TChanPingPong 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 TChanPingPong

type TChanPingPong interface {
	Ping(ctx thrift.Context, request *Ping) (*Pong, error)
}

TChanPingPong is the interface that defines the server handler and client interface.

func NewRingpopPingPongAdapter

func NewRingpopPingPongAdapter(
	impl TChanPingPong,
	rp ringpop.Interface,
	ch *tchannel.Channel,
	config PingPongConfiguration,
) (TChanPingPong, error)

NewRingpopPingPongAdapter creates an implementation of the TChanPingPong 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 TChanPingPong
handler = &YourImplementation{}

adapter, _ := NewRingpopPingPongAdapter(handler, ringpop, channel,
  PingPongConfiguration{
    Ping: &PingPongPingConfiguration: {
      Key: func(ctx thrift.Context, request *Ping) (shardKey string, err error) {
        return "calculated-shard-key", nil
      },
    },
  },
)
server.Register(NewTChanPingPongServer(adapter))

func NewTChanPingPongClient

func NewTChanPingPongClient(client thrift.TChanClient) TChanPingPong

NewTChanPingPongClient creates a client that can be used to make remote calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL