Documentation ¶
Overview ¶
Package thrift implements Thrift encoding support for YARPC.
Usually, end users will not consume this package directly. It will be used by code generated by TODO, and the generated code will be consumed by end users.
Index ¶
Constants ¶
const Encoding transport.Encoding = "thrift"
Encoding is the name of this encoding.
Variables ¶
var DisableEnvelopingForTransport transport.Options
DisableEnvelopingForTransport allows a transport to disable Thrift request and response enveloping.
Use this from a transport implementation that wishes to disable Thrift enveloping.
func (myOutbound) Options() transport.Options { return otherOptions.Merge(thrift.DisableEnvelopingForTransport) }
Functions ¶
Types ¶
type Client ¶
type Client interface { // Call the given Thrift method. Call(ctx context.Context, reqMeta yarpc.CallReqMeta, reqBody envelope.Enveloper) (wire.Value, yarpc.CallResMeta, error) }
Client is a generic Thrift client. It speaks in raw Thrift payloads. The code generator is responsible for putting a pretty interface in front of it.
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption customizes the behavior of a Thrift client.
type Config ¶
type Config struct { // Name of the Thrift service. This is the name used in the Thrift file // with the 'service' keyword. Service string // Channel through which requests will be sent. Required. Channel transport.Channel // Thrift encoding protocol. Defaults to Binary if nil. Protocol protocol.Protocol }
Config contains the configuration for the Client.
type Handler ¶
type Handler interface {
Handle(ctx context.Context, reqMeta yarpc.ReqMeta, body wire.Value) (Response, error)
}
Handler represents a Thrift request handler.
type HandlerFunc ¶
HandlerFunc is a convenience type alias for functions that implement that act as Handlers.
type Option ¶
type Option interface { ClientOption RegisterOption }
Option unifies options that apply to both, Thrift clients and handlers.
var DisableEnveloping Option = disableEnvelopingOption{}
DisableEnveloping is an option that disables enveloping of Thrift requests and responses.
It may be specified on the client side when the client is constructed.
client := myserviceclient.New(channel, thrift.DisableEnveloping)
It may be specified on the server side when the handler is registered.
thrift.Register(dispatch, myserviceserver.New(handler), thrift.DisableEnveloping)
type RegisterOption ¶
type RegisterOption interface {
// contains filtered or unexported methods
}
RegisterOption customizes the behavior of a Thrift handler during registration.
type Service ¶
type Service interface { // Name of the Thrift service. Name() string // Protocol to use for requests and responses of this service. Protocol() protocol.Protocol // Map of method name to Handler for all methods of this service. Handlers() map[string]Handler }
Service represents a Thrift service implementation.