tracker

package module
v0.0.0-...-3ad1f7d Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2018 License: MIT Imports: 5 Imported by: 0

README

thriftpy-like tracker for golang

Only support request header currently, response header is not so useful as request header.

Unlike example/, always use client/processor factory to avoid state race.

Requirements

A modified version of thrift compiler: https://github.com/eleme/thrift

$ git clone git@github.com:eleme/thrift.git
$ git checkout tracker
$ ./bootstrap.sh
$ ./configure --prefix=/usr/local/ --without-haskell --without-java --without-php --without-nodejs --without-python --without-cpp --without-lua --without-perl --without-ruby --without-erlang --without-rust
$ make
$ sudo make install  # Or, sudo cp compiler/cpp/thrift /usr/local/bin/tracker-thrift
$ # You can now use thrift compiler to generate go code, see example/

Documentation

Index

Constants

View Source
const (
	CtxKeySequenceID  ctxKey = "__thrift_tracking_sequence_id"
	CtxKeyRequestID   ctxKey = "__thrift_tracking_request_id"
	CtxKeyRequestMeta ctxKey = "__thrift_tracking_request_meta"
	// CtxKeyResponseMeta           ctxKey = "__thrift_tracking_response_meta"
	TrackingAPIName string = "__thriftpy_tracing_method_name__v2"
)

Variables

This section is empty.

Functions

func NewSimpleTrackerFactory

func NewSimpleTrackerFactory(name string) func() Tracker

Types

type HandShaker

type HandShaker interface {
	Negotiation(curSeqID int32, iprot, oprot thrift.TProtocol) error
	TryUpgrade(seqID int32, iprot, oprot thrift.TProtocol) (bool, thrift.TException)
	RequestHeaderSupported() bool
}

type NewTrackerFactoryFunc

type NewTrackerFactoryFunc func(name string) func() Tracker

type SimpleTracker

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

func (*SimpleTracker) Negotiation

func (t *SimpleTracker) Negotiation(curSeqID int32, iprot, oprot thrift.TProtocol) error

func (*SimpleTracker) RequestHeaderSupported

func (t *SimpleTracker) RequestHeaderSupported() bool

func (*SimpleTracker) RequestSeqIDFromCtx

func (t *SimpleTracker) RequestSeqIDFromCtx(ctx context.Context) (string, string)

func (*SimpleTracker) TryReadRequestHeader

func (t *SimpleTracker) TryReadRequestHeader(iprot thrift.TProtocol) (context.Context, error)

func (*SimpleTracker) TryUpgrade

func (t *SimpleTracker) TryUpgrade(seqID int32, iprot, oprot thrift.TProtocol) (bool, thrift.TException)

func (*SimpleTracker) TryWriteRequestHeader

func (t *SimpleTracker) TryWriteRequestHeader(ctx context.Context, oprot thrift.TProtocol) error

type Tracker

type Tracker interface {
	HandShaker

	RequestSeqIDFromCtx(ctx context.Context) (string, string)
	TryReadRequestHeader(iprot thrift.TProtocol) (context.Context, error) // context will pass into service handler
	TryWriteRequestHeader(ctx context.Context, oprot thrift.TProtocol) error
}

func NewSimpleTracker

func NewSimpleTracker(name string) Tracker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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