func (h *multiHopHandler) Handle(ctx context.Context, reqMeta yarpc.ReqMeta, body interface{}) (interface{}, yarpc.ResMeta, error) { if h.phoneClient == nil { panic("call SetClient() and SetTransport() first") } assertBaggageMatches(ctx, h.t, h.wantBaggage) span := opentracing.SpanFromContext(ctx) for key, value := range h.addBaggage { span.SetBaggageItem(key, value) } ctx = opentracing.ContextWithSpan(ctx, span) var resp js.RawMessage phoneResMeta, err := h.phoneClient.Call( ctx, yarpc.NewReqMeta().Procedure("phone").Headers(reqMeta.Headers()), &server.PhoneRequest{ Service: "ctxclient", Procedure: h.phoneCallTo, Transport: h.phoneCallTransport, Body: &js.RawMessage{'{', '}'}, }, &resp) resMeta := yarpc.NewResMeta().Headers(phoneResMeta.Headers()) return map[string]interface{}{}, resMeta, err }
func resMetaFromReqMeta(reqMeta yarpc.ReqMeta) yarpc.ResMeta { return yarpc.NewResMeta().Headers(reqMeta.Headers()) }
func (h helloHandler) Echo(ctx context.Context, reqMeta yarpc.ReqMeta, e *echo.EchoRequest) (*echo.EchoResponse, yarpc.ResMeta, error) { return &echo.EchoResponse{Message: e.Message, Count: e.Count + 1}, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil }
func yarpcEcho(ctx context.Context, reqMeta yarpc.ReqMeta, body []byte) ([]byte, yarpc.ResMeta, error) { return body, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil }
// Echo endpoint for the Echo service. func (EchoThrift) Echo(ctx context.Context, reqMeta yarpc.ReqMeta, ping *echo.Ping) (*echo.Pong, yarpc.ResMeta, error) { return &echo.Pong{Boop: ping.Beep}, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil }
// EchoJSON implements the echo procedure. func EchoJSON(ctx context.Context, reqMeta yarpc.ReqMeta, body map[string]interface{}) (map[string]interface{}, yarpc.ResMeta, error) { return body, yarpc.NewResMeta().Headers(reqMeta.Headers()), nil }
func (h *singleHopHandler) Handle(ctx context.Context, reqMeta yarpc.ReqMeta, body interface{}) (interface{}, yarpc.ResMeta, error) { assertBaggageMatches(ctx, h.t, h.wantBaggage) resMeta := yarpc.NewResMeta().Headers(reqMeta.Headers()) return map[string]interface{}{}, resMeta, nil }