id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c10900 | *transportOptions) {
options.buildClient = f
}
} | |
c10901 |
opt(&options)
}
return options.newTransport()
} | |
c10902 | a.connectorsGroup.Wait()
return nil
})
} | |
c10903 | *heapConfig) {
c.startupWait = t
}
} | |
c10904 | make(map[string]*peerScore),
peerAvailableEvent: make(chan struct{}, 1),
startupWait: cfg.startupWait,
}
} | |
c10905 |
defer pl.mu.Unlock()
for _, pid := range updates.Removals {
errs = multierr.Append(errs, pl.releasePeer(pid))
}
for _, pid := range updates.Additions {
errs = multierr.Append(errs, pl.retainPeer(pid))
}
return errs
} | |
c10906 | pl}
p, err := pl.transport.RetainPeer(pid, ps)
if err != nil {
return err
}
ps.peer = p
ps.score = scorePeer(p)
ps.boundFinish = ps.finish
pl.byIdentifier[pid.Identifier()] = ps
pl.byScore.pushPeer(ps)
pl.internalNotifyStatusChanged(ps)
return nil
} | |
c10907 |
err := pl.transport.ReleasePeer(pid, ps)
delete(pl.byIdentifier, pid.Identifier())
pl.byScore.delete(ps.idx)
ps.list = nil
return err
} | |
c10908 |
ps := pl.byIdentifier[pid.Identifier()]
pl.mu.Unlock()
ps.NotifyStatusChanged(pid)
} | |
c10909 | random.String(5)
pong, err := client.Echo(ctx, &echo.Ping{Beep: token})
crossdock.Fatals(t).NoError(err, "call to Echo::echo failed: %v", err)
crossdock.Assert(t).Equal(token, pong.Boop, "server said: %v", pong.Boop)
} | |
c10910 | random.Bytes(5)
resBody, err := client.Call(ctx, "echo/raw", token)
crossdock.Fatals(t).NoError(err, "call to echo/raw failed: %v", err)
crossdock.Assert(t).True(bytes.Equal(token, resBody), "server said: %v", resBody)
} | |
c10911 |
call := &InboundCall{}
for _, opt := range opts {
opt.apply(call)
}
return context.WithValue(ctx, inboundCallKey{}, call), call
} | |
c10912 | ok := ctx.Value(inboundCallKey{}).(*InboundCall)
return call, ok
} | |
c10913 | to the
// Request don't change the output.
ic.req = req
return nil
} | |
c10914 | ic.req = reqMeta.ToRequest()
return nil
} | |
c10915 | headers = headers.With(h.k, h.v)
}
if headers.Len() > 0 {
resw.AddHeaders(headers)
}
return nil
} | |
c10916 |
ExceptionTypeProtocolError,
ExceptionTypeInvalidTransform,
ExceptionTypeInvalidProtocol,
ExceptionTypeUnsupportedClientType,
}
} | |
c10917 | return []byte("BAD_SEQUENCE_ID"), nil
case 5:
return []byte("MISSING_RESULT"), nil
case 6:
return []byte("INTERNAL_ERROR"), nil
case 7:
return []byte("PROTOCOL_ERROR"), nil
case 8:
return []byte("INVALID_TRANSFORM"), nil
case 9:
return []byte("INVALID_PROTOCOL"), nil
case 10:
return []byte("UNSUPPOR... | |
c10918 | 4:
return "BAD_SEQUENCE_ID"
case 5:
return "MISSING_RESULT"
case 6:
return "INTERNAL_ERROR"
case 7:
return "PROTOCOL_ERROR"
case 8:
return "INVALID_TRANSFORM"
case 9:
return "INVALID_PROTOCOL"
case 10:
return "UNSUPPORTED_CLIENT_TYPE"
}
return fmt.Sprintf("ExceptionType(%d)", w)
} | |
c10919 | = fmt.Sprintf("Type: %v", *(v.Type))
i++
}
return fmt.Sprintf("TApplicationException{%v}", strings.Join(fields[:i], ", "))
} | |
c10920 | nil {
return false
}
if !_String_EqualsPtr(v.Message, rhs.Message) {
return false
}
if !_ExceptionType_EqualsPtr(v.Type, rhs.Type) {
return false
}
return true
} | |
c10921 | != nil {
err = multierr.Append(err, enc.AddObject("type", *v.Type))
}
return err
} | |
c10922 | breaking the API (and thus, all
// generated code).
optionList := strings.Split(f.Tag.Get("thrift"), ",")
var opts []ClientOption
for _, opt := range optionList {
switch strings.ToLower(opt) {
case "multiplexed":
opts = append(opts, Multiplexed)
case "enveloped":
opts = append(opts, Enveloped)
defau... | |
c10923 | optionFunc(func(opts *options) {
opts.logger = logger
})
} | |
c10924 | optionFunc(func(opts *options) {
opts.tmpl = tmpl
})
} | |
c10925 |
for _, opt := range opts {
opt.apply(&options)
}
return options
} | |
c10926 | return o
}
return unaryOutboundWithMiddleware{o: o, f: f}
} | |
c10927 | (*transport.Response, error) {
return f(ctx, request, out)
} | |
c10928 | return o
}
return onewayOutboundWithMiddleware{o: o, f: f}
} | |
c10929 | (transport.Ack, error) {
return f(ctx, request, out)
} | |
c10930 | return o
}
return streamOutboundWithMiddleware{o: o, f: f}
} | |
c10931 | (*transport.ClientStream, error) {
return f(ctx, request, out)
} | |
c10932 | = (*zapcore.Level)(l.Levels.ApplicationError)
} | |
c10933 | decode Zap log level: %v", err)
}
err := (*zapcore.Level)(l).UnmarshalText([]byte(s))
if err != nil {
return fmt.Errorf("could not decode Zap log level: %v", err)
}
return err
} | |
c10934 | ContextExtractor(func(_ context.Context) zapcore.Field { return zap.Skip() })
} | |
c10935 | options {
opt.apply(&call)
}
return &call
} | |
c10936 | nil, yarpcerrors.InvalidArgumentErrorf("response headers are not supported for streams")
}
return call, nil
} | |
c10937 | if c.routingDelegate != nil {
req.RoutingDelegate = *c.routingDelegate
}
// NB(abg): context and error are unused for now but we want to leave room
// for CallOptions which can fail or modify the context.
return ctx, nil
} | |
c10938 | reqMeta.ShardKey = *c.shardKey
}
if c.routingKey != nil {
reqMeta.RoutingKey = *c.routingKey
}
if c.routingDelegate != nil {
reqMeta.RoutingDelegate = *c.routingDelegate
}
// NB(abg): context and error are unused for now but we want to leave room
// for CallOptions which can fail or modify the context.
r... | |
c10939 | because Headers.Items() must
// never be mutated.
headers := make(map[string]string, res.Headers.Len())
for k, v := range res.Headers.Items() {
headers[k] = v
}
*c.responseHeaders = headers
}
// NB(abg): context and error are unused for now but we want to leave room
// for CallOptions which can fail o... | |
c10940 |
supportedEncodings: make(map[serviceProcedure][]string),
serviceNames: map[string]struct{}{defaultService: {}},
}
} | |
c10941 | spe := serviceProcedureEncoding{
service: r.Service,
procedure: r.Name,
encoding: r.Encoding,
}
// Protect against overriding wildcards
if _, ok := m.serviceProcedures[sp]; ok {
panic(fmt.Sprintf("Cannot register a handler for both (service, procedure) on any * encoding and (service, procedure, ... | |
c10942 | _, v := range m.serviceProcedureEncodings {
procs = append(procs, v)
}
sort.Sort(sortableProcedures(procs))
return procs
} | |
c10943 | string array to generate consistent result
sort.Strings(serviceNames)
return strings.Join(serviceNames, ", ")
} | |
c10944 | lifecycle.NewOnce(),
transport: t,
}
} | |
c10945 | body,
}
wireValue, err := rpc.ToWire()
if err != nil {
return nil, err
}
var writer bytes.Buffer
// use the first byte to version the serialization
if err := writer.WriteByte(version); err != nil {
return nil, err
}
err = protocol.Binary.Encode(wireValue, &writer)
return writer.Bytes(), err
} | |
c10946 | bytes.NewBuffer(rpc.Body),
}
if rpc.ShardKey != nil {
req.ShardKey = *rpc.ShardKey
}
if rpc.RoutingKey != nil {
req.RoutingKey = *rpc.RoutingKey
}
if rpc.RoutingDelegate != nil {
req.RoutingDelegate = *rpc.RoutingDelegate
}
spanContext, err := spanContextFromBytes(tracer, rpc.SpanContext)
if err !... | |
c10947 | s == nil {
return nil, yarpcerrors.InvalidArgumentErrorf("non-nil stream is required")
}
return &ServerStream{stream: s}, nil
} | |
c10948 |
return s.stream.SendMessage(ctx, msg)
} | |
c10949 | return s.stream.ReceiveMessage(ctx)
} | |
c10950 | stream with close is required")
}
return &ClientStream{stream: s}, nil
} | |
c10951 | error {
return s.stream.Close(ctx)
} | |
c10952 | fmt.Sprintf("Count: %v", v.Count)
i++
return fmt.Sprintf("EchoResponse{%v}", strings.Join(fields[:i], ", "))
} | |
c10953 | return false
}
if !(v.Count == rhs.Count) {
return false
}
return true
} | |
c10954 | return nil
}
enc.AddString("message", v.Message)
enc.AddInt16("count", v.Count)
return err
} | |
c10955 | characters that are illegal
// as golang identifiers and to discourage external usage of this constant.
h := sha256.Sum256([]byte(name))
return fmt.Sprintf("yarpcFileDescriptorClosure%s", hex.EncodeToString(h[:8])), nil
} | |
c10956 | metadata.NewOutgoingContext(ctx, c.md)
} | |
c10957 | return c.copyAndAdd(key, value)
} | |
c10958 | v.Message)
i++
return fmt.Sprintf("SinkRequest{%v}", strings.Join(fields[:i], ", "))
} | |
c10959 | !(v.Message == rhs.Message) {
return false
}
return true
} | |
c10960 | error) {
if v == nil {
return nil
}
enc.AddString("message", v.Message)
return err
} | |
c10961 | httpTransport.NewSingleOutbound(fmt.Sprintf("http://%s:8085", server)),
},
},
})
fatals.NoError(disp.Start(), "could not start Dispatcher")
defer disp.Stop()
runRaw(t, disp)
} | |
c10962 | {
t.Skipf("handlertimeout/raw method not implemented: %v", err)
return
}
assert.Equal(yarpcerrors.CodeDeadlineExceeded, yarpcerrors.FromError(err).Code(), "is an error with code CodeDeadlineExceeded: %v", err)
} | |
c10963 | transport.NewOnewayHandlerSpec(onewayHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
for _, streamHandlerParams := range params.StreamHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, streamHandlerParams.MethodName),... | |
c10964 | params.ClientConfig, params.Options...)
} | |
c10965 | {
return newUnaryHandler(params.Handle, params.NewRequest)
} | |
c10966 | {
return newOnewayHandler(params.Handle, params.NewRequest)
} | |
c10967 |
for _, opt := range uniqueLowercaseStrings(strings.Split(structField.Tag.Get("proto"), ",")) {
switch opt {
case "json":
opts = append(opts, UseJSON)
}
}
return opts
} | |
c10968 | "expected proto.Message to have type %T but had type %T", expectedType, actualType)
} | |
c10969 | return readFromStream(context.Background(), c.stream, newMessage)
} | |
c10970 | writeToStream(context.Background(), c.stream, message)
} | |
c10971 | c.stream.Close(context.Background())
} | |
c10972 | return readFromStream(context.Background(), s.stream, newMessage)
} | |
c10973 | writeToStream(context.Background(), s.stream, message)
} | |
c10974 | lines[i] = expandLine(l)
}
return strings.Join(lines, "\n")
} | |
c10975 |
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Echo",
ClientConfig: clientConfig,
Options: options,
},
)}
} | |
c10976 | handler.Echo,
NewRequest: newEchoServiceEchoYARPCRequest,
},
),
},
},
OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
} | |
c10977 |
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Oneway",
ClientConfig: clientConfig,
Options: options,
},
)}
} | |
c10978 | Handler: protobuf.NewOnewayHandler(
protobuf.OnewayHandlerParams{
Handle: handler.Echo,
NewRequest: newOnewayServiceEchoYARPCRequest,
},
),
},
},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
} | |
c10979 | result := map[string]interface{}{"foo": func() {}}
return result, nil
} | |
c10980 | := out.CallOneway(ctx, &transport.Request{
Caller: "oneway-server",
Service: "oneway-client",
Procedure: "call-back",
Encoding: raw.Encoding,
Body: bytes.NewReader(body),
})
if err != nil {
panic(fmt.Sprintf("could not make call back to client: %s", err))
}
} | |
c10981 | return r
}
return routeTableWithMiddleware{r: r, m: m}
} | |
c10982 | ts.OutboundOptions = append(ts.OutboundOptions, opt)
default:
panic(fmt.Sprintf("unknown option of type %T: %v", o, o))
}
}
return ts.Spec()
} | |
c10983 | &Pool{}
for _, opt := range opts {
opt(pool)
}
return pool
} | |
c10984 |
if !ok {
buf = newBuffer(p)
} else {
buf.reuse()
}
return buf
} | |
c10985 | *OutboundCall) { o.responseHeaders = h }}
} | |
c10986 | o.headers = append(o.headers, keyValuePair{k: k, v: v})
}}
} | |
c10987 | *OutboundCall) { o.shardKey = &sk }}
} | |
c10988 | *OutboundCall) { o.routingKey = &rk }}
} | |
c10989 |
return CallOption{func(o *OutboundCall) { o.routingDelegate = &rd }}
} | |
c10990 | jsonEcho
token := random.String(5)
err := client.Call(ctx, "echo", &jsonEcho{Token: token}, &response)
crossdock.Fatals(t).NoError(err, "call to echo failed: %v", err)
crossdock.Assert(t).Equal(token, response.Token, "server said: %v", response.Token)
} | |
c10991 |
}
return fmt.Sprintf("Hello_Sink_Args{%v}", strings.Join(fields[:i], ", "))
} | |
c10992 | || (v.Snk != nil && rhs.Snk != nil && v.Snk.Equals(rhs.Snk))) {
return false
}
return true
} | |
c10993 |
err = multierr.Append(err, enc.AddObject("snk", v.Snk))
}
return err
} | |
c10994 | nil {
return v.Snk
}
return
} | |
c10995 | := m.Pop(name, &s)
return s, err
} | |
c10996 | := m.Pop(name, &b)
return b, err
} | |
c10997 | opts...)
if ok {
delete(m, name)
}
return ok, err
} | |
c10998 | != nil {
err = fmt.Errorf("failed to read attribute %q: %v. got error: %s", name, v, err)
}
return true, err
} | |
c10999 |
keys = append(keys, key)
}
return keys
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.