Documentation ¶
Overview ¶
Package thriftbp provides Baseplate specific thrift related helpers.
Index ¶
Constants ¶
const ( // The Trace ID, a 64-bit integer encoded in decimal. HeaderTracingTrace = "Trace" // The Span ID, a 64-bit integer encoded in decimal. HeaderTracingSpan = "Span" // The Parent Span ID, a 64-bit integer encoded in decimal. HeaderTracingParent = "Parent" // The Sampled flag, an ASCII "1" (HeaderTracingSampledTrue) if true, otherwise false. // If not present, defaults to false. HeaderTracingSampled = "Sampled" // Trace flags, a 64-bit integer encoded in decimal. // If not present, defaults to null. HeaderTracingFlags = "Flags" )
Tracing related headers, as defined in https://pages.github.snooguts.net/'.spec/component-apis/thrift#tracing
const (
HeaderEdgeRequest = "Edge-Request"
)
Edge request context propagation related headers, as defined in https://pages.github.snooguts.net/'.spec/component-apis/thrift#edge-request-context-propagation
const HeaderTracingSampledTrue = "1"
HeaderTracingSampledTrue is the header value to indicate that this trace should be sampled.
Variables ¶
var HeadersToForward = []string{ HeaderEdgeRequest, HeaderTracingTrace, HeaderTracingSpan, HeaderTracingParent, HeaderTracingSampled, HeaderTracingFlags, }
HeadersToForward are the headers that should always be forwarded to upstream thrift servers, to be used in thrift.TSimpleServer.SetForwardHeaders.
Functions ¶
func Merge ¶
func Merge(processors ...MergeableTProcessor) thrift.TProcessor
Merge merges together the specified processors.
It's useful if the server need to support two separated thrift files.
It's kind of like Apache Thrift's TMultiplexedProcessor, the key difference is that TMultiplexedProcessor requires the client to also use TMultiplexedProtocol, while here the client didn't need any special handling.
Types ¶
type MergeableTProcessor ¶
type MergeableTProcessor interface { Process(ctx context.Context, in, out thrift.TProtocol) (bool, thrift.TException) AddToProcessorMap(key string, processor thrift.TProcessorFunction) ProcessorMap() map[string]thrift.TProcessorFunction }
MergeableTProcessor interface contains the functions needed to merge processors together.
It is used by the Merge function below.