thriftrpc

package
v0.0.0-...-673b0e9 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 3

README

Thrift-RPC-over-HTTP in Go

Tiny helper libraries for running Thrift RPC over HTTP -- putting the binary encoded messages in HTTP request/response bodies.

Standard Thrift RPC calls are encoded into byte buffers, which are sent as HTTP request/response bodies. This allows any off-the-shelf http tools (eg HAProxy) to interact with this thrift-RPC traffic.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLogging

func AddLogging(p HasProcessFunc, stats *report.Recorder, debug bool) thrift.TProcessor

func NewClientProts

func NewClientProts(url string, compact bool) (recv, send thrift.TProtocol)

pass these to the generated `NewFooClientProtocol(nil, recv, send)` method.

func NewDynamicClientProts

func NewDynamicClientProts(url func() string, compact bool) (recv, send thrift.TProtocol)

Types

type HasProcessFunc

type HasProcessFunc interface {
	GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool)
}

Thrift's generated Processors have `GetProcessorFunction` and satisfy this interface.

type LoggedProcessor

type LoggedProcessor struct {
	HasProcessFunc
	// contains filtered or unexported fields
}

Wraps a generated thrift Processor, providing a ServeHTTP method to serve thrift-over-http.

func (LoggedProcessor) Process

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

Mostly borrowed from generated thrift code `Process` method, but with timing added.

type ThriftOverHTTPHandler

type ThriftOverHTTPHandler struct {
	thrift.TProcessor
	// contains filtered or unexported fields
}

func NewThriftOverHTTPHandler

func NewThriftOverHTTPHandler(p thrift.TProcessor, stats *report.Recorder) *ThriftOverHTTPHandler

func (*ThriftOverHTTPHandler) ServeHTTP

func (h *ThriftOverHTTPHandler) ServeHTTP(out http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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