id
int32 0
167k
| repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
listlengths 21
1.41k
| docstring
stringlengths 6
2.61k
| docstring_tokens
listlengths 3
215
| sha
stringlengths 40
40
| url
stringlengths 85
252
|
---|---|---|---|---|---|---|---|---|---|---|---|
10,900 |
yarpc/yarpc-go
|
transport/http/transport.go
|
buildClient
|
func buildClient(f func(*transportOptions) *http.Client) TransportOption {
return func(options *transportOptions) {
options.buildClient = f
}
}
|
go
|
func buildClient(f func(*transportOptions) *http.Client) TransportOption {
return func(options *transportOptions) {
options.buildClient = f
}
}
|
[
"func",
"buildClient",
"(",
"f",
"func",
"(",
"*",
"transportOptions",
")",
"*",
"http",
".",
"Client",
")",
"TransportOption",
"{",
"return",
"func",
"(",
"options",
"*",
"transportOptions",
")",
"{",
"options",
".",
"buildClient",
"=",
"f",
"\n",
"}",
"\n",
"}"
] |
// Hidden option to override the buildHTTPClient function. This is used only
// for testing.
|
[
"Hidden",
"option",
"to",
"override",
"the",
"buildHTTPClient",
"function",
".",
"This",
"is",
"used",
"only",
"for",
"testing",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/transport/http/transport.go#L205-L209
|
10,901 |
yarpc/yarpc-go
|
transport/http/transport.go
|
NewTransport
|
func NewTransport(opts ...TransportOption) *Transport {
options := newTransportOptions()
for _, opt := range opts {
opt(&options)
}
return options.newTransport()
}
|
go
|
func NewTransport(opts ...TransportOption) *Transport {
options := newTransportOptions()
for _, opt := range opts {
opt(&options)
}
return options.newTransport()
}
|
[
"func",
"NewTransport",
"(",
"opts",
"...",
"TransportOption",
")",
"*",
"Transport",
"{",
"options",
":=",
"newTransportOptions",
"(",
")",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"&",
"options",
")",
"\n",
"}",
"\n",
"return",
"options",
".",
"newTransport",
"(",
")",
"\n",
"}"
] |
// NewTransport creates a new HTTP transport for managing peers and sending requests
|
[
"NewTransport",
"creates",
"a",
"new",
"HTTP",
"transport",
"for",
"managing",
"peers",
"and",
"sending",
"requests"
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/transport/http/transport.go#L212-L218
|
10,902 |
yarpc/yarpc-go
|
transport/http/transport.go
|
Stop
|
func (a *Transport) Stop() error {
return a.once.Stop(func() error {
a.connectorsGroup.Wait()
return nil
})
}
|
go
|
func (a *Transport) Stop() error {
return a.once.Stop(func() error {
a.connectorsGroup.Wait()
return nil
})
}
|
[
"func",
"(",
"a",
"*",
"Transport",
")",
"Stop",
"(",
")",
"error",
"{",
"return",
"a",
".",
"once",
".",
"Stop",
"(",
"func",
"(",
")",
"error",
"{",
"a",
".",
"connectorsGroup",
".",
"Wait",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
// Stop stops the HTTP transport.
|
[
"Stop",
"stops",
"the",
"HTTP",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/transport/http/transport.go#L289-L294
|
10,903 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
StartupWait
|
func StartupWait(t time.Duration) HeapOption {
return func(c *heapConfig) {
c.startupWait = t
}
}
|
go
|
func StartupWait(t time.Duration) HeapOption {
return func(c *heapConfig) {
c.startupWait = t
}
}
|
[
"func",
"StartupWait",
"(",
"t",
"time",
".",
"Duration",
")",
"HeapOption",
"{",
"return",
"func",
"(",
"c",
"*",
"heapConfig",
")",
"{",
"c",
".",
"startupWait",
"=",
"t",
"\n",
"}",
"\n",
"}"
] |
// StartupWait specifies how long updates to the heap will block
// before the list heap been started
//
// Defaults to 5 seconds.
|
[
"StartupWait",
"specifies",
"how",
"long",
"updates",
"to",
"the",
"heap",
"will",
"block",
"before",
"the",
"list",
"heap",
"been",
"started",
"Defaults",
"to",
"5",
"seconds",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L58-L62
|
10,904 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
New
|
func New(transport peer.Transport, opts ...HeapOption) *List {
cfg := defaultHeapConfig
for _, o := range opts {
o(&cfg)
}
return &List{
once: lifecycle.NewOnce(),
transport: transport,
byIdentifier: make(map[string]*peerScore),
peerAvailableEvent: make(chan struct{}, 1),
startupWait: cfg.startupWait,
}
}
|
go
|
func New(transport peer.Transport, opts ...HeapOption) *List {
cfg := defaultHeapConfig
for _, o := range opts {
o(&cfg)
}
return &List{
once: lifecycle.NewOnce(),
transport: transport,
byIdentifier: make(map[string]*peerScore),
peerAvailableEvent: make(chan struct{}, 1),
startupWait: cfg.startupWait,
}
}
|
[
"func",
"New",
"(",
"transport",
"peer",
".",
"Transport",
",",
"opts",
"...",
"HeapOption",
")",
"*",
"List",
"{",
"cfg",
":=",
"defaultHeapConfig",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"o",
"(",
"&",
"cfg",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"List",
"{",
"once",
":",
"lifecycle",
".",
"NewOnce",
"(",
")",
",",
"transport",
":",
"transport",
",",
"byIdentifier",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"peerScore",
")",
",",
"peerAvailableEvent",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"startupWait",
":",
"cfg",
".",
"startupWait",
",",
"}",
"\n",
"}"
] |
// New returns a new peer heap-chooser-list for the given transport.
|
[
"New",
"returns",
"a",
"new",
"peer",
"heap",
"-",
"chooser",
"-",
"list",
"for",
"the",
"given",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L97-L110
|
10,905 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
Update
|
func (pl *List) Update(updates peer.ListUpdates) error {
ctx, cancel := context.WithTimeout(context.Background(), pl.startupWait)
defer cancel()
if err := pl.once.WaitUntilRunning(ctx); err != nil {
return intyarpcerrors.AnnotateWithInfo(yarpcerrors.FromError(err), "%s peer list is not running", "peer heap")
}
var errs error
pl.mu.Lock()
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
}
|
go
|
func (pl *List) Update(updates peer.ListUpdates) error {
ctx, cancel := context.WithTimeout(context.Background(), pl.startupWait)
defer cancel()
if err := pl.once.WaitUntilRunning(ctx); err != nil {
return intyarpcerrors.AnnotateWithInfo(yarpcerrors.FromError(err), "%s peer list is not running", "peer heap")
}
var errs error
pl.mu.Lock()
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
}
|
[
"func",
"(",
"pl",
"*",
"List",
")",
"Update",
"(",
"updates",
"peer",
".",
"ListUpdates",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"pl",
".",
"startupWait",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"if",
"err",
":=",
"pl",
".",
"once",
".",
"WaitUntilRunning",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"intyarpcerrors",
".",
"AnnotateWithInfo",
"(",
"yarpcerrors",
".",
"FromError",
"(",
"err",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"errs",
"error",
"\n\n",
"pl",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pl",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"pid",
":=",
"range",
"updates",
".",
"Removals",
"{",
"errs",
"=",
"multierr",
".",
"Append",
"(",
"errs",
",",
"pl",
".",
"releasePeer",
"(",
"pid",
")",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"pid",
":=",
"range",
"updates",
".",
"Additions",
"{",
"errs",
"=",
"multierr",
".",
"Append",
"(",
"errs",
",",
"pl",
".",
"retainPeer",
"(",
"pid",
")",
")",
"\n",
"}",
"\n\n",
"return",
"errs",
"\n",
"}"
] |
// Update satisfies the peer.List interface, so a peer list updater can manage
// the retained peers.
|
[
"Update",
"satisfies",
"the",
"peer",
".",
"List",
"interface",
"so",
"a",
"peer",
"list",
"updater",
"can",
"manage",
"the",
"retained",
"peers",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L114-L135
|
10,906 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
retainPeer
|
func (pl *List) retainPeer(pid peer.Identifier) error {
if _, ok := pl.byIdentifier[pid.Identifier()]; ok {
return peer.ErrPeerAddAlreadyInList(pid.Identifier())
}
ps := &peerScore{id: pid, list: 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
}
|
go
|
func (pl *List) retainPeer(pid peer.Identifier) error {
if _, ok := pl.byIdentifier[pid.Identifier()]; ok {
return peer.ErrPeerAddAlreadyInList(pid.Identifier())
}
ps := &peerScore{id: pid, list: 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
}
|
[
"func",
"(",
"pl",
"*",
"List",
")",
"retainPeer",
"(",
"pid",
"peer",
".",
"Identifier",
")",
"error",
"{",
"if",
"_",
",",
"ok",
":=",
"pl",
".",
"byIdentifier",
"[",
"pid",
".",
"Identifier",
"(",
")",
"]",
";",
"ok",
"{",
"return",
"peer",
".",
"ErrPeerAddAlreadyInList",
"(",
"pid",
".",
"Identifier",
"(",
")",
")",
"\n",
"}",
"\n\n",
"ps",
":=",
"&",
"peerScore",
"{",
"id",
":",
"pid",
",",
"list",
":",
"pl",
"}",
"\n",
"p",
",",
"err",
":=",
"pl",
".",
"transport",
".",
"RetainPeer",
"(",
"pid",
",",
"ps",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ps",
".",
"peer",
"=",
"p",
"\n",
"ps",
".",
"score",
"=",
"scorePeer",
"(",
"p",
")",
"\n",
"ps",
".",
"boundFinish",
"=",
"ps",
".",
"finish",
"\n",
"pl",
".",
"byIdentifier",
"[",
"pid",
".",
"Identifier",
"(",
")",
"]",
"=",
"ps",
"\n",
"pl",
".",
"byScore",
".",
"pushPeer",
"(",
"ps",
")",
"\n",
"pl",
".",
"internalNotifyStatusChanged",
"(",
"ps",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
// retainPeer must be called with the mutex locked.
|
[
"retainPeer",
"must",
"be",
"called",
"with",
"the",
"mutex",
"locked",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L138-L156
|
10,907 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
releasePeer
|
func (pl *List) releasePeer(pid peer.Identifier) error {
ps, ok := pl.byIdentifier[pid.Identifier()]
if !ok {
return peer.ErrPeerRemoveNotInList(pid.Identifier())
}
if err := pl.byScore.validate(ps); err != nil {
return err
}
err := pl.transport.ReleasePeer(pid, ps)
delete(pl.byIdentifier, pid.Identifier())
pl.byScore.delete(ps.idx)
ps.list = nil
return err
}
|
go
|
func (pl *List) releasePeer(pid peer.Identifier) error {
ps, ok := pl.byIdentifier[pid.Identifier()]
if !ok {
return peer.ErrPeerRemoveNotInList(pid.Identifier())
}
if err := pl.byScore.validate(ps); err != nil {
return err
}
err := pl.transport.ReleasePeer(pid, ps)
delete(pl.byIdentifier, pid.Identifier())
pl.byScore.delete(ps.idx)
ps.list = nil
return err
}
|
[
"func",
"(",
"pl",
"*",
"List",
")",
"releasePeer",
"(",
"pid",
"peer",
".",
"Identifier",
")",
"error",
"{",
"ps",
",",
"ok",
":=",
"pl",
".",
"byIdentifier",
"[",
"pid",
".",
"Identifier",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"peer",
".",
"ErrPeerRemoveNotInList",
"(",
"pid",
".",
"Identifier",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"pl",
".",
"byScore",
".",
"validate",
"(",
"ps",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
":=",
"pl",
".",
"transport",
".",
"ReleasePeer",
"(",
"pid",
",",
"ps",
")",
"\n",
"delete",
"(",
"pl",
".",
"byIdentifier",
",",
"pid",
".",
"Identifier",
"(",
")",
")",
"\n",
"pl",
".",
"byScore",
".",
"delete",
"(",
"ps",
".",
"idx",
")",
"\n",
"ps",
".",
"list",
"=",
"nil",
"\n",
"return",
"err",
"\n",
"}"
] |
// releasePeer must be called with the mutex locked.
|
[
"releasePeer",
"must",
"be",
"called",
"with",
"the",
"mutex",
"locked",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L159-L174
|
10,908 |
yarpc/yarpc-go
|
peer/x/peerheap/list.go
|
NotifyStatusChanged
|
func (pl *List) NotifyStatusChanged(pid peer.Identifier) {
pl.mu.Lock()
ps := pl.byIdentifier[pid.Identifier()]
pl.mu.Unlock()
ps.NotifyStatusChanged(pid)
}
|
go
|
func (pl *List) NotifyStatusChanged(pid peer.Identifier) {
pl.mu.Lock()
ps := pl.byIdentifier[pid.Identifier()]
pl.mu.Unlock()
ps.NotifyStatusChanged(pid)
}
|
[
"func",
"(",
"pl",
"*",
"List",
")",
"NotifyStatusChanged",
"(",
"pid",
"peer",
".",
"Identifier",
")",
"{",
"pl",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"ps",
":=",
"pl",
".",
"byIdentifier",
"[",
"pid",
".",
"Identifier",
"(",
")",
"]",
"\n",
"pl",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"ps",
".",
"NotifyStatusChanged",
"(",
"pid",
")",
"\n",
"}"
] |
// NotifyStatusChanged receives notifications when a peer becomes available,
// connected, unavailable, or when its pending request count changes.
// This method satisfies peer.Subscriber and is only used for tests, since
// the peer heap has a subscriber for each invividual peer.
|
[
"NotifyStatusChanged",
"receives",
"notifications",
"when",
"a",
"peer",
"becomes",
"available",
"connected",
"unavailable",
"or",
"when",
"its",
"pending",
"request",
"count",
"changes",
".",
"This",
"method",
"satisfies",
"peer",
".",
"Subscriber",
"and",
"is",
"only",
"used",
"for",
"tests",
"since",
"the",
"peer",
"heap",
"has",
"a",
"subscriber",
"for",
"each",
"invividual",
"peer",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/peer/x/peerheap/list.go#L268-L273
|
10,909 |
yarpc/yarpc-go
|
internal/crossdock/client/echo/thrift.go
|
ThriftForTransport
|
func ThriftForTransport(t crossdock.T, transport string) {
t = createEchoT("thrift", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := echoclient.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
token := 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)
}
|
go
|
func ThriftForTransport(t crossdock.T, transport string) {
t = createEchoT("thrift", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := echoclient.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
token := 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)
}
|
[
"func",
"ThriftForTransport",
"(",
"t",
"crossdock",
".",
"T",
",",
"transport",
"string",
")",
"{",
"t",
"=",
"createEchoT",
"(",
"\"",
"\"",
",",
"transport",
",",
"t",
")",
"\n",
"fatals",
":=",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
"\n\n",
"dispatcher",
":=",
"disp",
".",
"CreateDispatcherForTransport",
"(",
"t",
",",
"transport",
")",
"\n",
"fatals",
".",
"NoError",
"(",
"dispatcher",
".",
"Start",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"defer",
"dispatcher",
".",
"Stop",
"(",
")",
"\n\n",
"client",
":=",
"echoclient",
".",
"New",
"(",
"dispatcher",
".",
"ClientConfig",
"(",
"\"",
"\"",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"token",
":=",
"random",
".",
"String",
"(",
"5",
")",
"\n\n",
"pong",
",",
"err",
":=",
"client",
".",
"Echo",
"(",
"ctx",
",",
"&",
"echo",
".",
"Ping",
"{",
"Beep",
":",
"token",
"}",
")",
"\n\n",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
".",
"NoError",
"(",
"err",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"crossdock",
".",
"Assert",
"(",
"t",
")",
".",
"Equal",
"(",
"token",
",",
"pong",
".",
"Boop",
",",
"\"",
"\"",
",",
"pong",
".",
"Boop",
")",
"\n",
"}"
] |
// ThriftForTransport implements the 'thrift' behavior for the given transport or behavior transport.
|
[
"ThriftForTransport",
"implements",
"the",
"thrift",
"behavior",
"for",
"the",
"given",
"transport",
"or",
"behavior",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/client/echo/thrift.go#L40-L58
|
10,910 |
yarpc/yarpc-go
|
internal/crossdock/client/echo/raw.go
|
RawForTransport
|
func RawForTransport(t crossdock.T, transport string) {
t = createEchoT("raw", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := raw.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
token := 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)
}
|
go
|
func RawForTransport(t crossdock.T, transport string) {
t = createEchoT("raw", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := raw.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
token := 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)
}
|
[
"func",
"RawForTransport",
"(",
"t",
"crossdock",
".",
"T",
",",
"transport",
"string",
")",
"{",
"t",
"=",
"createEchoT",
"(",
"\"",
"\"",
",",
"transport",
",",
"t",
")",
"\n",
"fatals",
":=",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
"\n\n",
"dispatcher",
":=",
"disp",
".",
"CreateDispatcherForTransport",
"(",
"t",
",",
"transport",
")",
"\n",
"fatals",
".",
"NoError",
"(",
"dispatcher",
".",
"Start",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"defer",
"dispatcher",
".",
"Stop",
"(",
")",
"\n\n",
"client",
":=",
"raw",
".",
"New",
"(",
"dispatcher",
".",
"ClientConfig",
"(",
"\"",
"\"",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"token",
":=",
"random",
".",
"Bytes",
"(",
"5",
")",
"\n",
"resBody",
",",
"err",
":=",
"client",
".",
"Call",
"(",
"ctx",
",",
"\"",
"\"",
",",
"token",
")",
"\n\n",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
".",
"NoError",
"(",
"err",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"crossdock",
".",
"Assert",
"(",
"t",
")",
".",
"True",
"(",
"bytes",
".",
"Equal",
"(",
"token",
",",
"resBody",
")",
",",
"\"",
"\"",
",",
"resBody",
")",
"\n",
"}"
] |
// RawForTransport implements the 'raw' behavior for the given transport or behavior transport.
|
[
"RawForTransport",
"implements",
"the",
"raw",
"behavior",
"for",
"the",
"given",
"transport",
"or",
"behavior",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/client/echo/raw.go#L40-L57
|
10,911 |
yarpc/yarpc-go
|
api/encoding/inbound_call.go
|
NewInboundCallWithOptions
|
func NewInboundCallWithOptions(ctx context.Context, opts ...InboundCallOption) (context.Context, *InboundCall) {
call := &InboundCall{}
for _, opt := range opts {
opt.apply(call)
}
return context.WithValue(ctx, inboundCallKey{}, call), call
}
|
go
|
func NewInboundCallWithOptions(ctx context.Context, opts ...InboundCallOption) (context.Context, *InboundCall) {
call := &InboundCall{}
for _, opt := range opts {
opt.apply(call)
}
return context.WithValue(ctx, inboundCallKey{}, call), call
}
|
[
"func",
"NewInboundCallWithOptions",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"...",
"InboundCallOption",
")",
"(",
"context",
".",
"Context",
",",
"*",
"InboundCall",
")",
"{",
"call",
":=",
"&",
"InboundCall",
"{",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
".",
"apply",
"(",
"call",
")",
"\n",
"}",
"\n",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"inboundCallKey",
"{",
"}",
",",
"call",
")",
",",
"call",
"\n",
"}"
] |
// NewInboundCallWithOptions builds a new InboundCall with the given context and
// options.
//
// A request context is returned and must be used in place of the original.
|
[
"NewInboundCallWithOptions",
"builds",
"a",
"new",
"InboundCall",
"with",
"the",
"given",
"context",
"and",
"options",
".",
"A",
"request",
"context",
"is",
"returned",
"and",
"must",
"be",
"used",
"in",
"place",
"of",
"the",
"original",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/inbound_call.go#L69-L75
|
10,912 |
yarpc/yarpc-go
|
api/encoding/inbound_call.go
|
getInboundCall
|
func getInboundCall(ctx context.Context) (*InboundCall, bool) {
call, ok := ctx.Value(inboundCallKey{}).(*InboundCall)
return call, ok
}
|
go
|
func getInboundCall(ctx context.Context) (*InboundCall, bool) {
call, ok := ctx.Value(inboundCallKey{}).(*InboundCall)
return call, ok
}
|
[
"func",
"getInboundCall",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"InboundCall",
",",
"bool",
")",
"{",
"call",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"inboundCallKey",
"{",
"}",
")",
".",
"(",
"*",
"InboundCall",
")",
"\n",
"return",
"call",
",",
"ok",
"\n",
"}"
] |
// getInboundCall returns the inbound call on this context or nil.
|
[
"getInboundCall",
"returns",
"the",
"inbound",
"call",
"on",
"this",
"context",
"or",
"nil",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/inbound_call.go#L78-L81
|
10,913 |
yarpc/yarpc-go
|
api/encoding/inbound_call.go
|
ReadFromRequest
|
func (ic *InboundCall) ReadFromRequest(req *transport.Request) error {
// TODO(abg): Maybe we should copy attributes over so that changes to the
// Request don't change the output.
ic.req = req
return nil
}
|
go
|
func (ic *InboundCall) ReadFromRequest(req *transport.Request) error {
// TODO(abg): Maybe we should copy attributes over so that changes to the
// Request don't change the output.
ic.req = req
return nil
}
|
[
"func",
"(",
"ic",
"*",
"InboundCall",
")",
"ReadFromRequest",
"(",
"req",
"*",
"transport",
".",
"Request",
")",
"error",
"{",
"// TODO(abg): Maybe we should copy attributes over so that changes to the",
"// Request don't change the output.",
"ic",
".",
"req",
"=",
"req",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ReadFromRequest reads information from the given request.
//
// This information may be queried on the context using functions like Caller,
// Service, Procedure, etc.
|
[
"ReadFromRequest",
"reads",
"information",
"from",
"the",
"given",
"request",
".",
"This",
"information",
"may",
"be",
"queried",
"on",
"the",
"context",
"using",
"functions",
"like",
"Caller",
"Service",
"Procedure",
"etc",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/inbound_call.go#L87-L92
|
10,914 |
yarpc/yarpc-go
|
api/encoding/inbound_call.go
|
ReadFromRequestMeta
|
func (ic *InboundCall) ReadFromRequestMeta(reqMeta *transport.RequestMeta) error {
ic.req = reqMeta.ToRequest()
return nil
}
|
go
|
func (ic *InboundCall) ReadFromRequestMeta(reqMeta *transport.RequestMeta) error {
ic.req = reqMeta.ToRequest()
return nil
}
|
[
"func",
"(",
"ic",
"*",
"InboundCall",
")",
"ReadFromRequestMeta",
"(",
"reqMeta",
"*",
"transport",
".",
"RequestMeta",
")",
"error",
"{",
"ic",
".",
"req",
"=",
"reqMeta",
".",
"ToRequest",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ReadFromRequestMeta reads information from the given request.
//
// This information may be queried on the context using functions like Caller,
// Service, Procedure, etc.
|
[
"ReadFromRequestMeta",
"reads",
"information",
"from",
"the",
"given",
"request",
".",
"This",
"information",
"may",
"be",
"queried",
"on",
"the",
"context",
"using",
"functions",
"like",
"Caller",
"Service",
"Procedure",
"etc",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/inbound_call.go#L98-L101
|
10,915 |
yarpc/yarpc-go
|
api/encoding/inbound_call.go
|
WriteToResponse
|
func (ic *InboundCall) WriteToResponse(resw transport.ResponseWriter) error {
var headers transport.Headers
for _, h := range ic.resHeaders {
headers = headers.With(h.k, h.v)
}
if headers.Len() > 0 {
resw.AddHeaders(headers)
}
return nil
}
|
go
|
func (ic *InboundCall) WriteToResponse(resw transport.ResponseWriter) error {
var headers transport.Headers
for _, h := range ic.resHeaders {
headers = headers.With(h.k, h.v)
}
if headers.Len() > 0 {
resw.AddHeaders(headers)
}
return nil
}
|
[
"func",
"(",
"ic",
"*",
"InboundCall",
")",
"WriteToResponse",
"(",
"resw",
"transport",
".",
"ResponseWriter",
")",
"error",
"{",
"var",
"headers",
"transport",
".",
"Headers",
"\n",
"for",
"_",
",",
"h",
":=",
"range",
"ic",
".",
"resHeaders",
"{",
"headers",
"=",
"headers",
".",
"With",
"(",
"h",
".",
"k",
",",
"h",
".",
"v",
")",
"\n",
"}",
"\n\n",
"if",
"headers",
".",
"Len",
"(",
")",
">",
"0",
"{",
"resw",
".",
"AddHeaders",
"(",
"headers",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
// WriteToResponse writes response information from the InboundCall onto the
// given ResponseWriter.
//
// If used, this must be called before writing the response body to the
// ResponseWriter.
|
[
"WriteToResponse",
"writes",
"response",
"information",
"from",
"the",
"InboundCall",
"onto",
"the",
"given",
"ResponseWriter",
".",
"If",
"used",
"this",
"must",
"be",
"called",
"before",
"writing",
"the",
"response",
"body",
"to",
"the",
"ResponseWriter",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/inbound_call.go#L108-L119
|
10,916 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
ExceptionType_Values
|
func ExceptionType_Values() []ExceptionType {
return []ExceptionType{
ExceptionTypeUnknown,
ExceptionTypeUnknownMethod,
ExceptionTypeInvalidMessageType,
ExceptionTypeWrongMethodName,
ExceptionTypeBadSequenceID,
ExceptionTypeMissingResult,
ExceptionTypeInternalError,
ExceptionTypeProtocolError,
ExceptionTypeInvalidTransform,
ExceptionTypeInvalidProtocol,
ExceptionTypeUnsupportedClientType,
}
}
|
go
|
func ExceptionType_Values() []ExceptionType {
return []ExceptionType{
ExceptionTypeUnknown,
ExceptionTypeUnknownMethod,
ExceptionTypeInvalidMessageType,
ExceptionTypeWrongMethodName,
ExceptionTypeBadSequenceID,
ExceptionTypeMissingResult,
ExceptionTypeInternalError,
ExceptionTypeProtocolError,
ExceptionTypeInvalidTransform,
ExceptionTypeInvalidProtocol,
ExceptionTypeUnsupportedClientType,
}
}
|
[
"func",
"ExceptionType_Values",
"(",
")",
"[",
"]",
"ExceptionType",
"{",
"return",
"[",
"]",
"ExceptionType",
"{",
"ExceptionTypeUnknown",
",",
"ExceptionTypeUnknownMethod",
",",
"ExceptionTypeInvalidMessageType",
",",
"ExceptionTypeWrongMethodName",
",",
"ExceptionTypeBadSequenceID",
",",
"ExceptionTypeMissingResult",
",",
"ExceptionTypeInternalError",
",",
"ExceptionTypeProtocolError",
",",
"ExceptionTypeInvalidTransform",
",",
"ExceptionTypeInvalidProtocol",
",",
"ExceptionTypeUnsupportedClientType",
",",
"}",
"\n",
"}"
] |
// ExceptionType_Values returns all recognized values of ExceptionType.
|
[
"ExceptionType_Values",
"returns",
"all",
"recognized",
"values",
"of",
"ExceptionType",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L55-L69
|
10,917 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
MarshalText
|
func (v ExceptionType) MarshalText() ([]byte, error) {
switch int32(v) {
case 0:
return []byte("UNKNOWN"), nil
case 1:
return []byte("UNKNOWN_METHOD"), nil
case 2:
return []byte("INVALID_MESSAGE_TYPE"), nil
case 3:
return []byte("WRONG_METHOD_NAME"), nil
case 4:
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("UNSUPPORTED_CLIENT_TYPE"), nil
}
return []byte(strconv.FormatInt(int64(v), 10)), nil
}
|
go
|
func (v ExceptionType) MarshalText() ([]byte, error) {
switch int32(v) {
case 0:
return []byte("UNKNOWN"), nil
case 1:
return []byte("UNKNOWN_METHOD"), nil
case 2:
return []byte("INVALID_MESSAGE_TYPE"), nil
case 3:
return []byte("WRONG_METHOD_NAME"), nil
case 4:
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("UNSUPPORTED_CLIENT_TYPE"), nil
}
return []byte(strconv.FormatInt(int64(v), 10)), nil
}
|
[
"func",
"(",
"v",
"ExceptionType",
")",
"MarshalText",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"1",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"2",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"3",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"4",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"5",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"6",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"7",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"8",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"9",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"case",
"10",
":",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"byte",
"(",
"strconv",
".",
"FormatInt",
"(",
"int64",
"(",
"v",
")",
",",
"10",
")",
")",
",",
"nil",
"\n",
"}"
] |
// MarshalText encodes ExceptionType to text.
//
// If the enum value is recognized, its name is returned. Otherwise,
// its integer value is returned.
//
// This implements the TextMarshaler interface.
|
[
"MarshalText",
"encodes",
"ExceptionType",
"to",
"text",
".",
"If",
"the",
"enum",
"value",
"is",
"recognized",
"its",
"name",
"is",
"returned",
".",
"Otherwise",
"its",
"integer",
"value",
"is",
"returned",
".",
"This",
"implements",
"the",
"TextMarshaler",
"interface",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L127-L153
|
10,918 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
String
|
func (v ExceptionType) String() string {
w := int32(v)
switch w {
case 0:
return "UNKNOWN"
case 1:
return "UNKNOWN_METHOD"
case 2:
return "INVALID_MESSAGE_TYPE"
case 3:
return "WRONG_METHOD_NAME"
case 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)
}
|
go
|
func (v ExceptionType) String() string {
w := int32(v)
switch w {
case 0:
return "UNKNOWN"
case 1:
return "UNKNOWN_METHOD"
case 2:
return "INVALID_MESSAGE_TYPE"
case 3:
return "WRONG_METHOD_NAME"
case 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)
}
|
[
"func",
"(",
"v",
"ExceptionType",
")",
"String",
"(",
")",
"string",
"{",
"w",
":=",
"int32",
"(",
"v",
")",
"\n",
"switch",
"w",
"{",
"case",
"0",
":",
"return",
"\"",
"\"",
"\n",
"case",
"1",
":",
"return",
"\"",
"\"",
"\n",
"case",
"2",
":",
"return",
"\"",
"\"",
"\n",
"case",
"3",
":",
"return",
"\"",
"\"",
"\n",
"case",
"4",
":",
"return",
"\"",
"\"",
"\n",
"case",
"5",
":",
"return",
"\"",
"\"",
"\n",
"case",
"6",
":",
"return",
"\"",
"\"",
"\n",
"case",
"7",
":",
"return",
"\"",
"\"",
"\n",
"case",
"8",
":",
"return",
"\"",
"\"",
"\n",
"case",
"9",
":",
"return",
"\"",
"\"",
"\n",
"case",
"10",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"w",
")",
"\n",
"}"
] |
// String returns a readable string representation of ExceptionType.
|
[
"String",
"returns",
"a",
"readable",
"string",
"representation",
"of",
"ExceptionType",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L221-L248
|
10,919 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
String
|
func (v *TApplicationException) String() string {
if v == nil {
return "<nil>"
}
var fields [2]string
i := 0
if v.Message != nil {
fields[i] = fmt.Sprintf("Message: %v", *(v.Message))
i++
}
if v.Type != nil {
fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
i++
}
return fmt.Sprintf("TApplicationException{%v}", strings.Join(fields[:i], ", "))
}
|
go
|
func (v *TApplicationException) String() string {
if v == nil {
return "<nil>"
}
var fields [2]string
i := 0
if v.Message != nil {
fields[i] = fmt.Sprintf("Message: %v", *(v.Message))
i++
}
if v.Type != nil {
fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
i++
}
return fmt.Sprintf("TApplicationException{%v}", strings.Join(fields[:i], ", "))
}
|
[
"func",
"(",
"v",
"*",
"TApplicationException",
")",
"String",
"(",
")",
"string",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"fields",
"[",
"2",
"]",
"string",
"\n",
"i",
":=",
"0",
"\n",
"if",
"v",
".",
"Message",
"!=",
"nil",
"{",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"(",
"v",
".",
"Message",
")",
")",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"if",
"v",
".",
"Type",
"!=",
"nil",
"{",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"(",
"v",
".",
"Type",
")",
")",
"\n",
"i",
"++",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fields",
"[",
":",
"i",
"]",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
// String returns a readable string representation of a TApplicationException
// struct.
|
[
"String",
"returns",
"a",
"readable",
"string",
"representation",
"of",
"a",
"TApplicationException",
"struct",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L434-L451
|
10,920 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
Equals
|
func (v *TApplicationException) Equals(rhs *TApplicationException) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !_String_EqualsPtr(v.Message, rhs.Message) {
return false
}
if !_ExceptionType_EqualsPtr(v.Type, rhs.Type) {
return false
}
return true
}
|
go
|
func (v *TApplicationException) Equals(rhs *TApplicationException) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !_String_EqualsPtr(v.Message, rhs.Message) {
return false
}
if !_ExceptionType_EqualsPtr(v.Type, rhs.Type) {
return false
}
return true
}
|
[
"func",
"(",
"v",
"*",
"TApplicationException",
")",
"Equals",
"(",
"rhs",
"*",
"TApplicationException",
")",
"bool",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"rhs",
"==",
"nil",
"\n",
"}",
"else",
"if",
"rhs",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"_String_EqualsPtr",
"(",
"v",
".",
"Message",
",",
"rhs",
".",
"Message",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"_ExceptionType_EqualsPtr",
"(",
"v",
".",
"Type",
",",
"rhs",
".",
"Type",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
// Equals returns true if all the fields of this TApplicationException match the
// provided TApplicationException.
//
// This function performs a deep comparison.
|
[
"Equals",
"returns",
"true",
"if",
"all",
"the",
"fields",
"of",
"this",
"TApplicationException",
"match",
"the",
"provided",
"TApplicationException",
".",
"This",
"function",
"performs",
"a",
"deep",
"comparison",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L477-L491
|
10,921 |
yarpc/yarpc-go
|
encoding/thrift/internal/types.go
|
MarshalLogObject
|
func (v *TApplicationException) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
if v.Message != nil {
enc.AddString("message", *v.Message)
}
if v.Type != nil {
err = multierr.Append(err, enc.AddObject("type", *v.Type))
}
return err
}
|
go
|
func (v *TApplicationException) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
if v.Message != nil {
enc.AddString("message", *v.Message)
}
if v.Type != nil {
err = multierr.Append(err, enc.AddObject("type", *v.Type))
}
return err
}
|
[
"func",
"(",
"v",
"*",
"TApplicationException",
")",
"MarshalLogObject",
"(",
"enc",
"zapcore",
".",
"ObjectEncoder",
")",
"(",
"err",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"v",
".",
"Message",
"!=",
"nil",
"{",
"enc",
".",
"AddString",
"(",
"\"",
"\"",
",",
"*",
"v",
".",
"Message",
")",
"\n",
"}",
"\n",
"if",
"v",
".",
"Type",
"!=",
"nil",
"{",
"err",
"=",
"multierr",
".",
"Append",
"(",
"err",
",",
"enc",
".",
"AddObject",
"(",
"\"",
"\"",
",",
"*",
"v",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of TApplicationException.
|
[
"MarshalLogObject",
"implements",
"zapcore",
".",
"ObjectMarshaler",
"enabling",
"fast",
"logging",
"of",
"TApplicationException",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/internal/types.go#L495-L506
|
10,922 |
yarpc/yarpc-go
|
encoding/thrift/inject.go
|
ClientBuilderOptions
|
func ClientBuilderOptions(_ transport.ClientConfig, f reflect.StructField) []ClientOption {
// Note that we don't use ClientConfig right now but since this code is
// called by generated code, we still accept it so that we can add logic
// based on it in the future without 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)
default:
// Ignore unknown options
}
}
return opts
}
|
go
|
func ClientBuilderOptions(_ transport.ClientConfig, f reflect.StructField) []ClientOption {
// Note that we don't use ClientConfig right now but since this code is
// called by generated code, we still accept it so that we can add logic
// based on it in the future without 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)
default:
// Ignore unknown options
}
}
return opts
}
|
[
"func",
"ClientBuilderOptions",
"(",
"_",
"transport",
".",
"ClientConfig",
",",
"f",
"reflect",
".",
"StructField",
")",
"[",
"]",
"ClientOption",
"{",
"// Note that we don't use ClientConfig right now but since this code is",
"// called by generated code, we still accept it so that we can add logic",
"// based on it in the future without breaking the API (and thus, all",
"// generated code).",
"optionList",
":=",
"strings",
".",
"Split",
"(",
"f",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"\n",
"var",
"opts",
"[",
"]",
"ClientOption",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"optionList",
"{",
"switch",
"strings",
".",
"ToLower",
"(",
"opt",
")",
"{",
"case",
"\"",
"\"",
":",
"opts",
"=",
"append",
"(",
"opts",
",",
"Multiplexed",
")",
"\n",
"case",
"\"",
"\"",
":",
"opts",
"=",
"append",
"(",
"opts",
",",
"Enveloped",
")",
"\n",
"default",
":",
"// Ignore unknown options",
"}",
"\n",
"}",
"\n",
"return",
"opts",
"\n",
"}"
] |
// ClientBuilderOptions returns ClientOptions that InjectClients should use
// for a specific Thrift client given information about the field into which
// the client is being injected. This API will usually not be used directly by
// users but by the generated code.
|
[
"ClientBuilderOptions",
"returns",
"ClientOptions",
"that",
"InjectClients",
"should",
"use",
"for",
"a",
"specific",
"Thrift",
"client",
"given",
"information",
"about",
"the",
"field",
"into",
"which",
"the",
"client",
"is",
"being",
"injected",
".",
"This",
"API",
"will",
"usually",
"not",
"be",
"used",
"directly",
"by",
"users",
"but",
"by",
"the",
"generated",
"code",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/thrift/inject.go#L34-L53
|
10,923 |
yarpc/yarpc-go
|
x/debug/options.go
|
Logger
|
func Logger(logger *zap.Logger) Option {
return optionFunc(func(opts *options) {
opts.logger = logger
})
}
|
go
|
func Logger(logger *zap.Logger) Option {
return optionFunc(func(opts *options) {
opts.logger = logger
})
}
|
[
"func",
"Logger",
"(",
"logger",
"*",
"zap",
".",
"Logger",
")",
"Option",
"{",
"return",
"optionFunc",
"(",
"func",
"(",
"opts",
"*",
"options",
")",
"{",
"opts",
".",
"logger",
"=",
"logger",
"\n",
"}",
")",
"\n",
"}"
] |
// Logger specifies the logger that should be used to log.
// Default value is noop zap logger.
|
[
"Logger",
"specifies",
"the",
"logger",
"that",
"should",
"be",
"used",
"to",
"log",
".",
"Default",
"value",
"is",
"noop",
"zap",
"logger",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/x/debug/options.go#L40-L44
|
10,924 |
yarpc/yarpc-go
|
x/debug/options.go
|
tmpl
|
func tmpl(tmpl templateIface) Option {
return optionFunc(func(opts *options) {
opts.tmpl = tmpl
})
}
|
go
|
func tmpl(tmpl templateIface) Option {
return optionFunc(func(opts *options) {
opts.tmpl = tmpl
})
}
|
[
"func",
"tmpl",
"(",
"tmpl",
"templateIface",
")",
"Option",
"{",
"return",
"optionFunc",
"(",
"func",
"(",
"opts",
"*",
"options",
")",
"{",
"opts",
".",
"tmpl",
"=",
"tmpl",
"\n",
"}",
")",
"\n",
"}"
] |
// tmpl specifies the template to use.
// It is only used for testing.
|
[
"tmpl",
"specifies",
"the",
"template",
"to",
"use",
".",
"It",
"is",
"only",
"used",
"for",
"testing",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/x/debug/options.go#L48-L52
|
10,925 |
yarpc/yarpc-go
|
x/debug/options.go
|
applyOptions
|
func applyOptions(opts ...Option) options {
options := options{
logger: zap.NewNop(),
tmpl: _defaultTmpl,
}
for _, opt := range opts {
opt.apply(&options)
}
return options
}
|
go
|
func applyOptions(opts ...Option) options {
options := options{
logger: zap.NewNop(),
tmpl: _defaultTmpl,
}
for _, opt := range opts {
opt.apply(&options)
}
return options
}
|
[
"func",
"applyOptions",
"(",
"opts",
"...",
"Option",
")",
"options",
"{",
"options",
":=",
"options",
"{",
"logger",
":",
"zap",
".",
"NewNop",
"(",
")",
",",
"tmpl",
":",
"_defaultTmpl",
",",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
".",
"apply",
"(",
"&",
"options",
")",
"\n",
"}",
"\n",
"return",
"options",
"\n",
"}"
] |
// applyOptions creates new opts based on the given options.
|
[
"applyOptions",
"creates",
"new",
"opts",
"based",
"on",
"the",
"given",
"options",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/x/debug/options.go#L56-L65
|
10,926 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
ApplyUnaryOutbound
|
func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound {
if f == nil {
return o
}
return unaryOutboundWithMiddleware{o: o, f: f}
}
|
go
|
func ApplyUnaryOutbound(o transport.UnaryOutbound, f UnaryOutbound) transport.UnaryOutbound {
if f == nil {
return o
}
return unaryOutboundWithMiddleware{o: o, f: f}
}
|
[
"func",
"ApplyUnaryOutbound",
"(",
"o",
"transport",
".",
"UnaryOutbound",
",",
"f",
"UnaryOutbound",
")",
"transport",
".",
"UnaryOutbound",
"{",
"if",
"f",
"==",
"nil",
"{",
"return",
"o",
"\n",
"}",
"\n",
"return",
"unaryOutboundWithMiddleware",
"{",
"o",
":",
"o",
",",
"f",
":",
"f",
"}",
"\n",
"}"
] |
// ApplyUnaryOutbound applies the given UnaryOutbound middleware to
// the given UnaryOutbound transport.
|
[
"ApplyUnaryOutbound",
"applies",
"the",
"given",
"UnaryOutbound",
"middleware",
"to",
"the",
"given",
"UnaryOutbound",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L52-L57
|
10,927 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
Call
|
func (f UnaryOutboundFunc) Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error) {
return f(ctx, request, out)
}
|
go
|
func (f UnaryOutboundFunc) Call(ctx context.Context, request *transport.Request, out transport.UnaryOutbound) (*transport.Response, error) {
return f(ctx, request, out)
}
|
[
"func",
"(",
"f",
"UnaryOutboundFunc",
")",
"Call",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"transport",
".",
"Request",
",",
"out",
"transport",
".",
"UnaryOutbound",
")",
"(",
"*",
"transport",
".",
"Response",
",",
"error",
")",
"{",
"return",
"f",
"(",
"ctx",
",",
"request",
",",
"out",
")",
"\n",
"}"
] |
// Call for UnaryOutboundFunc.
|
[
"Call",
"for",
"UnaryOutboundFunc",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L63-L65
|
10,928 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
ApplyOnewayOutbound
|
func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound {
if f == nil {
return o
}
return onewayOutboundWithMiddleware{o: o, f: f}
}
|
go
|
func ApplyOnewayOutbound(o transport.OnewayOutbound, f OnewayOutbound) transport.OnewayOutbound {
if f == nil {
return o
}
return onewayOutboundWithMiddleware{o: o, f: f}
}
|
[
"func",
"ApplyOnewayOutbound",
"(",
"o",
"transport",
".",
"OnewayOutbound",
",",
"f",
"OnewayOutbound",
")",
"transport",
".",
"OnewayOutbound",
"{",
"if",
"f",
"==",
"nil",
"{",
"return",
"o",
"\n",
"}",
"\n",
"return",
"onewayOutboundWithMiddleware",
"{",
"o",
":",
"o",
",",
"f",
":",
"f",
"}",
"\n",
"}"
] |
// ApplyOnewayOutbound applies the given OnewayOutbound middleware to
// the given OnewayOutbound transport.
|
[
"ApplyOnewayOutbound",
"applies",
"the",
"given",
"OnewayOutbound",
"middleware",
"to",
"the",
"given",
"OnewayOutbound",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L126-L131
|
10,929 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
CallOneway
|
func (f OnewayOutboundFunc) CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error) {
return f(ctx, request, out)
}
|
go
|
func (f OnewayOutboundFunc) CallOneway(ctx context.Context, request *transport.Request, out transport.OnewayOutbound) (transport.Ack, error) {
return f(ctx, request, out)
}
|
[
"func",
"(",
"f",
"OnewayOutboundFunc",
")",
"CallOneway",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"transport",
".",
"Request",
",",
"out",
"transport",
".",
"OnewayOutbound",
")",
"(",
"transport",
".",
"Ack",
",",
"error",
")",
"{",
"return",
"f",
"(",
"ctx",
",",
"request",
",",
"out",
")",
"\n",
"}"
] |
// CallOneway for OnewayOutboundFunc.
|
[
"CallOneway",
"for",
"OnewayOutboundFunc",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L137-L139
|
10,930 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
ApplyStreamOutbound
|
func ApplyStreamOutbound(o transport.StreamOutbound, f StreamOutbound) transport.StreamOutbound {
if f == nil {
return o
}
return streamOutboundWithMiddleware{o: o, f: f}
}
|
go
|
func ApplyStreamOutbound(o transport.StreamOutbound, f StreamOutbound) transport.StreamOutbound {
if f == nil {
return o
}
return streamOutboundWithMiddleware{o: o, f: f}
}
|
[
"func",
"ApplyStreamOutbound",
"(",
"o",
"transport",
".",
"StreamOutbound",
",",
"f",
"StreamOutbound",
")",
"transport",
".",
"StreamOutbound",
"{",
"if",
"f",
"==",
"nil",
"{",
"return",
"o",
"\n",
"}",
"\n",
"return",
"streamOutboundWithMiddleware",
"{",
"o",
":",
"o",
",",
"f",
":",
"f",
"}",
"\n",
"}"
] |
// ApplyStreamOutbound applies the given StreamOutbound middleware to
// the given StreamOutbound transport.
|
[
"ApplyStreamOutbound",
"applies",
"the",
"given",
"StreamOutbound",
"middleware",
"to",
"the",
"given",
"StreamOutbound",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L201-L206
|
10,931 |
yarpc/yarpc-go
|
api/middleware/outbound.go
|
CallStream
|
func (f StreamOutboundFunc) CallStream(ctx context.Context, request *transport.StreamRequest, out transport.StreamOutbound) (*transport.ClientStream, error) {
return f(ctx, request, out)
}
|
go
|
func (f StreamOutboundFunc) CallStream(ctx context.Context, request *transport.StreamRequest, out transport.StreamOutbound) (*transport.ClientStream, error) {
return f(ctx, request, out)
}
|
[
"func",
"(",
"f",
"StreamOutboundFunc",
")",
"CallStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"transport",
".",
"StreamRequest",
",",
"out",
"transport",
".",
"StreamOutbound",
")",
"(",
"*",
"transport",
".",
"ClientStream",
",",
"error",
")",
"{",
"return",
"f",
"(",
"ctx",
",",
"request",
",",
"out",
")",
"\n",
"}"
] |
// CallStream for StreamOutboundFunc.
|
[
"CallStream",
"for",
"StreamOutboundFunc",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/outbound.go#L212-L214
|
10,932 |
yarpc/yarpc-go
|
yarpcconfig/decode.go
|
fill
|
func (l *logging) fill(cfg *yarpc.Config) {
cfg.Logging.Levels.ApplicationError = (*zapcore.Level)(l.Levels.ApplicationError)
}
|
go
|
func (l *logging) fill(cfg *yarpc.Config) {
cfg.Logging.Levels.ApplicationError = (*zapcore.Level)(l.Levels.ApplicationError)
}
|
[
"func",
"(",
"l",
"*",
"logging",
")",
"fill",
"(",
"cfg",
"*",
"yarpc",
".",
"Config",
")",
"{",
"cfg",
".",
"Logging",
".",
"Levels",
".",
"ApplicationError",
"=",
"(",
"*",
"zapcore",
".",
"Level",
")",
"(",
"l",
".",
"Levels",
".",
"ApplicationError",
")",
"\n",
"}"
] |
// Fills values from this object into the provided YARPC config.
|
[
"Fills",
"values",
"from",
"this",
"object",
"into",
"the",
"provided",
"YARPC",
"config",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/yarpcconfig/decode.go#L48-L50
|
10,933 |
yarpc/yarpc-go
|
yarpcconfig/decode.go
|
Decode
|
func (l *zapLevel) Decode(into mapdecode.Into) error {
var s string
if err := into(&s); err != nil {
return fmt.Errorf("could not 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
}
|
go
|
func (l *zapLevel) Decode(into mapdecode.Into) error {
var s string
if err := into(&s); err != nil {
return fmt.Errorf("could not 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
}
|
[
"func",
"(",
"l",
"*",
"zapLevel",
")",
"Decode",
"(",
"into",
"mapdecode",
".",
"Into",
")",
"error",
"{",
"var",
"s",
"string",
"\n",
"if",
"err",
":=",
"into",
"(",
"&",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"(",
"*",
"zapcore",
".",
"Level",
")",
"(",
"l",
")",
".",
"UnmarshalText",
"(",
"[",
"]",
"byte",
"(",
"s",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// mapdecode doesn't suport encoding.TextMarhsaler by default so we have to do
// this manually.
|
[
"mapdecode",
"doesn",
"t",
"suport",
"encoding",
".",
"TextMarhsaler",
"by",
"default",
"so",
"we",
"have",
"to",
"do",
"this",
"manually",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/yarpcconfig/decode.go#L56-L67
|
10,934 |
yarpc/yarpc-go
|
internal/observability/extractor.go
|
NewNopContextExtractor
|
func NewNopContextExtractor() ContextExtractor {
return ContextExtractor(func(_ context.Context) zapcore.Field { return zap.Skip() })
}
|
go
|
func NewNopContextExtractor() ContextExtractor {
return ContextExtractor(func(_ context.Context) zapcore.Field { return zap.Skip() })
}
|
[
"func",
"NewNopContextExtractor",
"(",
")",
"ContextExtractor",
"{",
"return",
"ContextExtractor",
"(",
"func",
"(",
"_",
"context",
".",
"Context",
")",
"zapcore",
".",
"Field",
"{",
"return",
"zap",
".",
"Skip",
"(",
")",
"}",
")",
"\n",
"}"
] |
// NewNopContextExtractor returns a no-op ContextExtractor.
|
[
"NewNopContextExtractor",
"returns",
"a",
"no",
"-",
"op",
"ContextExtractor",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/observability/extractor.go#L35-L37
|
10,935 |
yarpc/yarpc-go
|
api/encoding/outbound_call.go
|
NewOutboundCall
|
func NewOutboundCall(options ...CallOption) *OutboundCall {
var call OutboundCall
for _, opt := range options {
opt.apply(&call)
}
return &call
}
|
go
|
func NewOutboundCall(options ...CallOption) *OutboundCall {
var call OutboundCall
for _, opt := range options {
opt.apply(&call)
}
return &call
}
|
[
"func",
"NewOutboundCall",
"(",
"options",
"...",
"CallOption",
")",
"*",
"OutboundCall",
"{",
"var",
"call",
"OutboundCall",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"options",
"{",
"opt",
".",
"apply",
"(",
"&",
"call",
")",
"\n",
"}",
"\n",
"return",
"&",
"call",
"\n",
"}"
] |
// NewOutboundCall constructs a new OutboundCall with the given options.
|
[
"NewOutboundCall",
"constructs",
"a",
"new",
"OutboundCall",
"with",
"the",
"given",
"options",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/outbound_call.go#L47-L53
|
10,936 |
yarpc/yarpc-go
|
api/encoding/outbound_call.go
|
NewStreamOutboundCall
|
func NewStreamOutboundCall(options ...CallOption) (*OutboundCall, error) {
call := NewOutboundCall(options...)
if call.responseHeaders != nil {
return nil, yarpcerrors.InvalidArgumentErrorf("response headers are not supported for streams")
}
return call, nil
}
|
go
|
func NewStreamOutboundCall(options ...CallOption) (*OutboundCall, error) {
call := NewOutboundCall(options...)
if call.responseHeaders != nil {
return nil, yarpcerrors.InvalidArgumentErrorf("response headers are not supported for streams")
}
return call, nil
}
|
[
"func",
"NewStreamOutboundCall",
"(",
"options",
"...",
"CallOption",
")",
"(",
"*",
"OutboundCall",
",",
"error",
")",
"{",
"call",
":=",
"NewOutboundCall",
"(",
"options",
"...",
")",
"\n",
"if",
"call",
".",
"responseHeaders",
"!=",
"nil",
"{",
"return",
"nil",
",",
"yarpcerrors",
".",
"InvalidArgumentErrorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"call",
",",
"nil",
"\n",
"}"
] |
// NewStreamOutboundCall constructs a new OutboundCall with the given
// options and enforces the OutboundCall is valid for streams.
|
[
"NewStreamOutboundCall",
"constructs",
"a",
"new",
"OutboundCall",
"with",
"the",
"given",
"options",
"and",
"enforces",
"the",
"OutboundCall",
"is",
"valid",
"for",
"streams",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/outbound_call.go#L57-L63
|
10,937 |
yarpc/yarpc-go
|
api/encoding/outbound_call.go
|
WriteToRequest
|
func (c *OutboundCall) WriteToRequest(ctx context.Context, req *transport.Request) (context.Context, error) {
for _, h := range c.headers {
req.Headers = req.Headers.With(h.k, h.v)
}
if c.shardKey != nil {
req.ShardKey = *c.shardKey
}
if c.routingKey != nil {
req.RoutingKey = *c.routingKey
}
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
}
|
go
|
func (c *OutboundCall) WriteToRequest(ctx context.Context, req *transport.Request) (context.Context, error) {
for _, h := range c.headers {
req.Headers = req.Headers.With(h.k, h.v)
}
if c.shardKey != nil {
req.ShardKey = *c.shardKey
}
if c.routingKey != nil {
req.RoutingKey = *c.routingKey
}
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
}
|
[
"func",
"(",
"c",
"*",
"OutboundCall",
")",
"WriteToRequest",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"transport",
".",
"Request",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"for",
"_",
",",
"h",
":=",
"range",
"c",
".",
"headers",
"{",
"req",
".",
"Headers",
"=",
"req",
".",
"Headers",
".",
"With",
"(",
"h",
".",
"k",
",",
"h",
".",
"v",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"shardKey",
"!=",
"nil",
"{",
"req",
".",
"ShardKey",
"=",
"*",
"c",
".",
"shardKey",
"\n",
"}",
"\n",
"if",
"c",
".",
"routingKey",
"!=",
"nil",
"{",
"req",
".",
"RoutingKey",
"=",
"*",
"c",
".",
"routingKey",
"\n",
"}",
"\n",
"if",
"c",
".",
"routingDelegate",
"!=",
"nil",
"{",
"req",
".",
"RoutingDelegate",
"=",
"*",
"c",
".",
"routingDelegate",
"\n",
"}",
"\n\n",
"// 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",
"\n",
"}"
] |
// WriteToRequest fills the given request with request-specific options from
// the call.
//
// The context MAY be replaced by the OutboundCall.
|
[
"WriteToRequest",
"fills",
"the",
"given",
"request",
"with",
"request",
"-",
"specific",
"options",
"from",
"the",
"call",
".",
"The",
"context",
"MAY",
"be",
"replaced",
"by",
"the",
"OutboundCall",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/outbound_call.go#L69-L87
|
10,938 |
yarpc/yarpc-go
|
api/encoding/outbound_call.go
|
WriteToRequestMeta
|
func (c *OutboundCall) WriteToRequestMeta(ctx context.Context, reqMeta *transport.RequestMeta) (context.Context, error) {
for _, h := range c.headers {
reqMeta.Headers = reqMeta.Headers.With(h.k, h.v)
}
if c.shardKey != nil {
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.
return ctx, nil
}
|
go
|
func (c *OutboundCall) WriteToRequestMeta(ctx context.Context, reqMeta *transport.RequestMeta) (context.Context, error) {
for _, h := range c.headers {
reqMeta.Headers = reqMeta.Headers.With(h.k, h.v)
}
if c.shardKey != nil {
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.
return ctx, nil
}
|
[
"func",
"(",
"c",
"*",
"OutboundCall",
")",
"WriteToRequestMeta",
"(",
"ctx",
"context",
".",
"Context",
",",
"reqMeta",
"*",
"transport",
".",
"RequestMeta",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"for",
"_",
",",
"h",
":=",
"range",
"c",
".",
"headers",
"{",
"reqMeta",
".",
"Headers",
"=",
"reqMeta",
".",
"Headers",
".",
"With",
"(",
"h",
".",
"k",
",",
"h",
".",
"v",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"shardKey",
"!=",
"nil",
"{",
"reqMeta",
".",
"ShardKey",
"=",
"*",
"c",
".",
"shardKey",
"\n",
"}",
"\n",
"if",
"c",
".",
"routingKey",
"!=",
"nil",
"{",
"reqMeta",
".",
"RoutingKey",
"=",
"*",
"c",
".",
"routingKey",
"\n",
"}",
"\n",
"if",
"c",
".",
"routingDelegate",
"!=",
"nil",
"{",
"reqMeta",
".",
"RoutingDelegate",
"=",
"*",
"c",
".",
"routingDelegate",
"\n",
"}",
"\n\n",
"// 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",
"\n",
"}"
] |
// WriteToRequestMeta fills the given request with request-specific options from
// the call.
//
// The context MAY be replaced by the OutboundCall.
|
[
"WriteToRequestMeta",
"fills",
"the",
"given",
"request",
"with",
"request",
"-",
"specific",
"options",
"from",
"the",
"call",
".",
"The",
"context",
"MAY",
"be",
"replaced",
"by",
"the",
"OutboundCall",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/outbound_call.go#L93-L111
|
10,939 |
yarpc/yarpc-go
|
api/encoding/outbound_call.go
|
ReadFromResponse
|
func (c *OutboundCall) ReadFromResponse(ctx context.Context, res *transport.Response) (context.Context, error) {
// We're not using ctx right now but we may in the future.
if c.responseHeaders != nil && res.Headers.Len() > 0 {
// We make a copy of the response headers 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 or modify the context.
return ctx, nil
}
|
go
|
func (c *OutboundCall) ReadFromResponse(ctx context.Context, res *transport.Response) (context.Context, error) {
// We're not using ctx right now but we may in the future.
if c.responseHeaders != nil && res.Headers.Len() > 0 {
// We make a copy of the response headers 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 or modify the context.
return ctx, nil
}
|
[
"func",
"(",
"c",
"*",
"OutboundCall",
")",
"ReadFromResponse",
"(",
"ctx",
"context",
".",
"Context",
",",
"res",
"*",
"transport",
".",
"Response",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"// We're not using ctx right now but we may in the future.",
"if",
"c",
".",
"responseHeaders",
"!=",
"nil",
"&&",
"res",
".",
"Headers",
".",
"Len",
"(",
")",
">",
"0",
"{",
"// We make a copy of the response headers because Headers.Items() must",
"// never be mutated.",
"headers",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"res",
".",
"Headers",
".",
"Len",
"(",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"res",
".",
"Headers",
".",
"Items",
"(",
")",
"{",
"headers",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"*",
"c",
".",
"responseHeaders",
"=",
"headers",
"\n",
"}",
"\n\n",
"// 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",
"\n",
"}"
] |
// ReadFromResponse reads information from the response for this call.
//
// This should be called only if the request is unary.
|
[
"ReadFromResponse",
"reads",
"information",
"from",
"the",
"response",
"for",
"this",
"call",
".",
"This",
"should",
"be",
"called",
"only",
"if",
"the",
"request",
"is",
"unary",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/outbound_call.go#L116-L131
|
10,940 |
yarpc/yarpc-go
|
router.go
|
NewMapRouter
|
func NewMapRouter(defaultService string) MapRouter {
return MapRouter{
defaultService: defaultService,
serviceProcedures: make(map[serviceProcedure]transport.Procedure),
serviceProcedureEncodings: make(map[serviceProcedureEncoding]transport.Procedure),
supportedEncodings: make(map[serviceProcedure][]string),
serviceNames: map[string]struct{}{defaultService: {}},
}
}
|
go
|
func NewMapRouter(defaultService string) MapRouter {
return MapRouter{
defaultService: defaultService,
serviceProcedures: make(map[serviceProcedure]transport.Procedure),
serviceProcedureEncodings: make(map[serviceProcedureEncoding]transport.Procedure),
supportedEncodings: make(map[serviceProcedure][]string),
serviceNames: map[string]struct{}{defaultService: {}},
}
}
|
[
"func",
"NewMapRouter",
"(",
"defaultService",
"string",
")",
"MapRouter",
"{",
"return",
"MapRouter",
"{",
"defaultService",
":",
"defaultService",
",",
"serviceProcedures",
":",
"make",
"(",
"map",
"[",
"serviceProcedure",
"]",
"transport",
".",
"Procedure",
")",
",",
"serviceProcedureEncodings",
":",
"make",
"(",
"map",
"[",
"serviceProcedureEncoding",
"]",
"transport",
".",
"Procedure",
")",
",",
"supportedEncodings",
":",
"make",
"(",
"map",
"[",
"serviceProcedure",
"]",
"[",
"]",
"string",
")",
",",
"serviceNames",
":",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"defaultService",
":",
"{",
"}",
"}",
",",
"}",
"\n",
"}"
] |
// NewMapRouter builds a new MapRouter that uses the given name as the
// default service name.
|
[
"NewMapRouter",
"builds",
"a",
"new",
"MapRouter",
"that",
"uses",
"the",
"given",
"name",
"as",
"the",
"default",
"service",
"name",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/router.go#L62-L70
|
10,941 |
yarpc/yarpc-go
|
router.go
|
Register
|
func (m MapRouter) Register(rs []transport.Procedure) {
for _, r := range rs {
if r.Service == "" {
r.Service = m.defaultService
}
if r.Name == "" {
panic("Expected procedure name not to be empty string in registration")
}
m.serviceNames[r.Service] = struct{}{}
sp := serviceProcedure{
service: r.Service,
procedure: r.Name,
}
if r.Encoding == "" {
// Protect against masking encoding-specific routes.
if _, ok := m.serviceProcedures[sp]; ok {
panic(fmt.Sprintf("Cannot register multiple handlers for every encoding for service %q and procedure %q", sp.service, sp.procedure))
}
if se, ok := m.supportedEncodings[sp]; ok {
panic(fmt.Sprintf("Cannot register a handler for every encoding for service %q and procedure %q when there are already handlers for %s", sp.service, sp.procedure, humanize.QuotedJoin(se, "and", "no encodings")))
}
// This supports wild card encodings (for backward compatibility,
// since type models like Thrift were not previously required to
// specify the encoding of every procedure).
m.serviceProcedures[sp] = r
continue
}
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, encoding), specifically (%q, %q, %q)", r.Service, r.Name, r.Encoding))
}
// Route to individual handlers for unique combinations of service,
// procedure, and encoding. This shall henceforth be the
// recommended way for models to register procedures.
m.serviceProcedureEncodings[spe] = r
// Record supported encodings.
m.supportedEncodings[sp] = append(m.supportedEncodings[sp], string(r.Encoding))
}
}
|
go
|
func (m MapRouter) Register(rs []transport.Procedure) {
for _, r := range rs {
if r.Service == "" {
r.Service = m.defaultService
}
if r.Name == "" {
panic("Expected procedure name not to be empty string in registration")
}
m.serviceNames[r.Service] = struct{}{}
sp := serviceProcedure{
service: r.Service,
procedure: r.Name,
}
if r.Encoding == "" {
// Protect against masking encoding-specific routes.
if _, ok := m.serviceProcedures[sp]; ok {
panic(fmt.Sprintf("Cannot register multiple handlers for every encoding for service %q and procedure %q", sp.service, sp.procedure))
}
if se, ok := m.supportedEncodings[sp]; ok {
panic(fmt.Sprintf("Cannot register a handler for every encoding for service %q and procedure %q when there are already handlers for %s", sp.service, sp.procedure, humanize.QuotedJoin(se, "and", "no encodings")))
}
// This supports wild card encodings (for backward compatibility,
// since type models like Thrift were not previously required to
// specify the encoding of every procedure).
m.serviceProcedures[sp] = r
continue
}
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, encoding), specifically (%q, %q, %q)", r.Service, r.Name, r.Encoding))
}
// Route to individual handlers for unique combinations of service,
// procedure, and encoding. This shall henceforth be the
// recommended way for models to register procedures.
m.serviceProcedureEncodings[spe] = r
// Record supported encodings.
m.supportedEncodings[sp] = append(m.supportedEncodings[sp], string(r.Encoding))
}
}
|
[
"func",
"(",
"m",
"MapRouter",
")",
"Register",
"(",
"rs",
"[",
"]",
"transport",
".",
"Procedure",
")",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"rs",
"{",
"if",
"r",
".",
"Service",
"==",
"\"",
"\"",
"{",
"r",
".",
"Service",
"=",
"m",
".",
"defaultService",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"Name",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"m",
".",
"serviceNames",
"[",
"r",
".",
"Service",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n\n",
"sp",
":=",
"serviceProcedure",
"{",
"service",
":",
"r",
".",
"Service",
",",
"procedure",
":",
"r",
".",
"Name",
",",
"}",
"\n\n",
"if",
"r",
".",
"Encoding",
"==",
"\"",
"\"",
"{",
"// Protect against masking encoding-specific routes.",
"if",
"_",
",",
"ok",
":=",
"m",
".",
"serviceProcedures",
"[",
"sp",
"]",
";",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sp",
".",
"service",
",",
"sp",
".",
"procedure",
")",
")",
"\n",
"}",
"\n",
"if",
"se",
",",
"ok",
":=",
"m",
".",
"supportedEncodings",
"[",
"sp",
"]",
";",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sp",
".",
"service",
",",
"sp",
".",
"procedure",
",",
"humanize",
".",
"QuotedJoin",
"(",
"se",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
")",
"\n",
"}",
"\n",
"// This supports wild card encodings (for backward compatibility,",
"// since type models like Thrift were not previously required to",
"// specify the encoding of every procedure).",
"m",
".",
"serviceProcedures",
"[",
"sp",
"]",
"=",
"r",
"\n",
"continue",
"\n",
"}",
"\n\n",
"spe",
":=",
"serviceProcedureEncoding",
"{",
"service",
":",
"r",
".",
"Service",
",",
"procedure",
":",
"r",
".",
"Name",
",",
"encoding",
":",
"r",
".",
"Encoding",
",",
"}",
"\n\n",
"// Protect against overriding wildcards",
"if",
"_",
",",
"ok",
":=",
"m",
".",
"serviceProcedures",
"[",
"sp",
"]",
";",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Service",
",",
"r",
".",
"Name",
",",
"r",
".",
"Encoding",
")",
")",
"\n",
"}",
"\n",
"// Route to individual handlers for unique combinations of service,",
"// procedure, and encoding. This shall henceforth be the",
"// recommended way for models to register procedures.",
"m",
".",
"serviceProcedureEncodings",
"[",
"spe",
"]",
"=",
"r",
"\n",
"// Record supported encodings.",
"m",
".",
"supportedEncodings",
"[",
"sp",
"]",
"=",
"append",
"(",
"m",
".",
"supportedEncodings",
"[",
"sp",
"]",
",",
"string",
"(",
"r",
".",
"Encoding",
")",
")",
"\n",
"}",
"\n",
"}"
] |
// Register registers the procedure with the MapRouter.
// If the procedure does not specify its service name, the procedure will
// inherit the default service name of the router.
// Procedures should specify their encoding, and multiple procedures with the
// same name and service name can exist if they handle different encodings.
// If a procedure does not specify an encoding, it can only support one handler.
// The router will select that handler regardless of the encoding.
|
[
"Register",
"registers",
"the",
"procedure",
"with",
"the",
"MapRouter",
".",
"If",
"the",
"procedure",
"does",
"not",
"specify",
"its",
"service",
"name",
"the",
"procedure",
"will",
"inherit",
"the",
"default",
"service",
"name",
"of",
"the",
"router",
".",
"Procedures",
"should",
"specify",
"their",
"encoding",
"and",
"multiple",
"procedures",
"with",
"the",
"same",
"name",
"and",
"service",
"name",
"can",
"exist",
"if",
"they",
"handle",
"different",
"encodings",
".",
"If",
"a",
"procedure",
"does",
"not",
"specify",
"an",
"encoding",
"it",
"can",
"only",
"support",
"one",
"handler",
".",
"The",
"router",
"will",
"select",
"that",
"handler",
"regardless",
"of",
"the",
"encoding",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/router.go#L79-L128
|
10,942 |
yarpc/yarpc-go
|
router.go
|
Procedures
|
func (m MapRouter) Procedures() []transport.Procedure {
procs := make([]transport.Procedure, 0, len(m.serviceProcedures)+len(m.serviceProcedureEncodings))
for _, v := range m.serviceProcedures {
procs = append(procs, v)
}
for _, v := range m.serviceProcedureEncodings {
procs = append(procs, v)
}
sort.Sort(sortableProcedures(procs))
return procs
}
|
go
|
func (m MapRouter) Procedures() []transport.Procedure {
procs := make([]transport.Procedure, 0, len(m.serviceProcedures)+len(m.serviceProcedureEncodings))
for _, v := range m.serviceProcedures {
procs = append(procs, v)
}
for _, v := range m.serviceProcedureEncodings {
procs = append(procs, v)
}
sort.Sort(sortableProcedures(procs))
return procs
}
|
[
"func",
"(",
"m",
"MapRouter",
")",
"Procedures",
"(",
")",
"[",
"]",
"transport",
".",
"Procedure",
"{",
"procs",
":=",
"make",
"(",
"[",
"]",
"transport",
".",
"Procedure",
",",
"0",
",",
"len",
"(",
"m",
".",
"serviceProcedures",
")",
"+",
"len",
"(",
"m",
".",
"serviceProcedureEncodings",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"m",
".",
"serviceProcedures",
"{",
"procs",
"=",
"append",
"(",
"procs",
",",
"v",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"m",
".",
"serviceProcedureEncodings",
"{",
"procs",
"=",
"append",
"(",
"procs",
",",
"v",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"sortableProcedures",
"(",
"procs",
")",
")",
"\n",
"return",
"procs",
"\n",
"}"
] |
// Procedures returns a list procedures that
// have been registered so far.
|
[
"Procedures",
"returns",
"a",
"list",
"procedures",
"that",
"have",
"been",
"registered",
"so",
"far",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/router.go#L132-L142
|
10,943 |
yarpc/yarpc-go
|
router.go
|
getAvailableServiceNames
|
func getAvailableServiceNames(svcMap map[string]struct{}) string {
var serviceNames []string
for key := range svcMap {
serviceNames = append(serviceNames, strconv.Quote(key))
}
// Sort the string array to generate consistent result
sort.Strings(serviceNames)
return strings.Join(serviceNames, ", ")
}
|
go
|
func getAvailableServiceNames(svcMap map[string]struct{}) string {
var serviceNames []string
for key := range svcMap {
serviceNames = append(serviceNames, strconv.Quote(key))
}
// Sort the string array to generate consistent result
sort.Strings(serviceNames)
return strings.Join(serviceNames, ", ")
}
|
[
"func",
"getAvailableServiceNames",
"(",
"svcMap",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"string",
"{",
"var",
"serviceNames",
"[",
"]",
"string",
"\n",
"for",
"key",
":=",
"range",
"svcMap",
"{",
"serviceNames",
"=",
"append",
"(",
"serviceNames",
",",
"strconv",
".",
"Quote",
"(",
"key",
")",
")",
"\n",
"}",
"\n",
"// Sort the string array to generate consistent result",
"sort",
".",
"Strings",
"(",
"serviceNames",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"serviceNames",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
// Extract keys from service names map and return a formatted string
|
[
"Extract",
"keys",
"from",
"service",
"names",
"map",
"and",
"return",
"a",
"formatted",
"string"
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/router.go#L209-L217
|
10,944 |
yarpc/yarpc-go
|
transport/tchannel/channel_inbound.go
|
NewInbound
|
func (t *ChannelTransport) NewInbound() *ChannelInbound {
return &ChannelInbound{
once: lifecycle.NewOnce(),
transport: t,
}
}
|
go
|
func (t *ChannelTransport) NewInbound() *ChannelInbound {
return &ChannelInbound{
once: lifecycle.NewOnce(),
transport: t,
}
}
|
[
"func",
"(",
"t",
"*",
"ChannelTransport",
")",
"NewInbound",
"(",
")",
"*",
"ChannelInbound",
"{",
"return",
"&",
"ChannelInbound",
"{",
"once",
":",
"lifecycle",
".",
"NewOnce",
"(",
")",
",",
"transport",
":",
"t",
",",
"}",
"\n",
"}"
] |
// NewInbound returns a new TChannel inbound backed by a shared TChannel
// transport. The returned ChannelInbound does not support peer.Chooser
// and uses TChannel's own internal load balancing peer selection.
// If you have a YARPC peer.Chooser, use the unqualified tchannel.NewInbound
// instead.
// There should only be one inbound for TChannel since all outbounds send the
// listening port over non-ephemeral connections so a service can deduplicate
// locally- and remotely-initiated persistent connections.
|
[
"NewInbound",
"returns",
"a",
"new",
"TChannel",
"inbound",
"backed",
"by",
"a",
"shared",
"TChannel",
"transport",
".",
"The",
"returned",
"ChannelInbound",
"does",
"not",
"support",
"peer",
".",
"Chooser",
"and",
"uses",
"TChannel",
"s",
"own",
"internal",
"load",
"balancing",
"peer",
"selection",
".",
"If",
"you",
"have",
"a",
"YARPC",
"peer",
".",
"Chooser",
"use",
"the",
"unqualified",
"tchannel",
".",
"NewInbound",
"instead",
".",
"There",
"should",
"only",
"be",
"one",
"inbound",
"for",
"TChannel",
"since",
"all",
"outbounds",
"send",
"the",
"listening",
"port",
"over",
"non",
"-",
"ephemeral",
"connections",
"so",
"a",
"service",
"can",
"deduplicate",
"locally",
"-",
"and",
"remotely",
"-",
"initiated",
"persistent",
"connections",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/transport/tchannel/channel_inbound.go#L48-L53
|
10,945 |
yarpc/yarpc-go
|
serialize/serialize.go
|
ToBytes
|
func ToBytes(tracer opentracing.Tracer, spanContext opentracing.SpanContext, req *transport.Request) ([]byte, error) {
spanBytes, err := spanContextToBytes(tracer, spanContext)
if err != nil {
return nil, err
}
body, err := ioutil.ReadAll(req.Body)
if err != nil {
return nil, err
}
rpc := internal.RPC{
SpanContext: spanBytes,
CallerName: req.Caller,
ServiceName: req.Service,
Encoding: string(req.Encoding),
Procedure: req.Procedure,
Headers: req.Headers.Items(),
ShardKey: &req.ShardKey,
RoutingKey: &req.RoutingKey,
RoutingDelegate: &req.RoutingDelegate,
Body: 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
}
|
go
|
func ToBytes(tracer opentracing.Tracer, spanContext opentracing.SpanContext, req *transport.Request) ([]byte, error) {
spanBytes, err := spanContextToBytes(tracer, spanContext)
if err != nil {
return nil, err
}
body, err := ioutil.ReadAll(req.Body)
if err != nil {
return nil, err
}
rpc := internal.RPC{
SpanContext: spanBytes,
CallerName: req.Caller,
ServiceName: req.Service,
Encoding: string(req.Encoding),
Procedure: req.Procedure,
Headers: req.Headers.Items(),
ShardKey: &req.ShardKey,
RoutingKey: &req.RoutingKey,
RoutingDelegate: &req.RoutingDelegate,
Body: 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
}
|
[
"func",
"ToBytes",
"(",
"tracer",
"opentracing",
".",
"Tracer",
",",
"spanContext",
"opentracing",
".",
"SpanContext",
",",
"req",
"*",
"transport",
".",
"Request",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"spanBytes",
",",
"err",
":=",
"spanContextToBytes",
"(",
"tracer",
",",
"spanContext",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"req",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rpc",
":=",
"internal",
".",
"RPC",
"{",
"SpanContext",
":",
"spanBytes",
",",
"CallerName",
":",
"req",
".",
"Caller",
",",
"ServiceName",
":",
"req",
".",
"Service",
",",
"Encoding",
":",
"string",
"(",
"req",
".",
"Encoding",
")",
",",
"Procedure",
":",
"req",
".",
"Procedure",
",",
"Headers",
":",
"req",
".",
"Headers",
".",
"Items",
"(",
")",
",",
"ShardKey",
":",
"&",
"req",
".",
"ShardKey",
",",
"RoutingKey",
":",
"&",
"req",
".",
"RoutingKey",
",",
"RoutingDelegate",
":",
"&",
"req",
".",
"RoutingDelegate",
",",
"Body",
":",
"body",
",",
"}",
"\n\n",
"wireValue",
",",
"err",
":=",
"rpc",
".",
"ToWire",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"writer",
"bytes",
".",
"Buffer",
"\n",
"// use the first byte to version the serialization",
"if",
"err",
":=",
"writer",
".",
"WriteByte",
"(",
"version",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"protocol",
".",
"Binary",
".",
"Encode",
"(",
"wireValue",
",",
"&",
"writer",
")",
"\n",
"return",
"writer",
".",
"Bytes",
"(",
")",
",",
"err",
"\n",
"}"
] |
// ToBytes encodes an opentracing.SpanContext and transport.Request into bytes
|
[
"ToBytes",
"encodes",
"an",
"opentracing",
".",
"SpanContext",
"and",
"transport",
".",
"Request",
"into",
"bytes"
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/serialize/serialize.go#L42-L79
|
10,946 |
yarpc/yarpc-go
|
serialize/serialize.go
|
FromBytes
|
func FromBytes(tracer opentracing.Tracer, request []byte) (opentracing.SpanContext, *transport.Request, error) {
if len(request) <= 1 {
return nil, nil, errors.New("cannot deserialize empty request")
}
// check valid thrift serialization byte
if request[0] != 0 {
return nil, nil,
fmt.Errorf(
"unsupported YARPC serialization version '%v' found during deserialization",
request[0])
}
reader := bytes.NewReader(request[1:])
wireValue, err := protocol.Binary.Decode(reader, wire.TStruct)
if err != nil {
return nil, nil, err
}
var rpc internal.RPC
if err = rpc.FromWire(wireValue); err != nil {
return nil, nil, err
}
req := transport.Request{
Caller: rpc.CallerName,
Service: rpc.ServiceName,
Encoding: transport.Encoding(rpc.Encoding),
Procedure: rpc.Procedure,
Headers: transport.HeadersFromMap(rpc.Headers),
Body: 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 != nil {
return nil, nil, err
}
return spanContext, &req, nil
}
|
go
|
func FromBytes(tracer opentracing.Tracer, request []byte) (opentracing.SpanContext, *transport.Request, error) {
if len(request) <= 1 {
return nil, nil, errors.New("cannot deserialize empty request")
}
// check valid thrift serialization byte
if request[0] != 0 {
return nil, nil,
fmt.Errorf(
"unsupported YARPC serialization version '%v' found during deserialization",
request[0])
}
reader := bytes.NewReader(request[1:])
wireValue, err := protocol.Binary.Decode(reader, wire.TStruct)
if err != nil {
return nil, nil, err
}
var rpc internal.RPC
if err = rpc.FromWire(wireValue); err != nil {
return nil, nil, err
}
req := transport.Request{
Caller: rpc.CallerName,
Service: rpc.ServiceName,
Encoding: transport.Encoding(rpc.Encoding),
Procedure: rpc.Procedure,
Headers: transport.HeadersFromMap(rpc.Headers),
Body: 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 != nil {
return nil, nil, err
}
return spanContext, &req, nil
}
|
[
"func",
"FromBytes",
"(",
"tracer",
"opentracing",
".",
"Tracer",
",",
"request",
"[",
"]",
"byte",
")",
"(",
"opentracing",
".",
"SpanContext",
",",
"*",
"transport",
".",
"Request",
",",
"error",
")",
"{",
"if",
"len",
"(",
"request",
")",
"<=",
"1",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// check valid thrift serialization byte",
"if",
"request",
"[",
"0",
"]",
"!=",
"0",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"request",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"reader",
":=",
"bytes",
".",
"NewReader",
"(",
"request",
"[",
"1",
":",
"]",
")",
"\n",
"wireValue",
",",
"err",
":=",
"protocol",
".",
"Binary",
".",
"Decode",
"(",
"reader",
",",
"wire",
".",
"TStruct",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"rpc",
"internal",
".",
"RPC",
"\n",
"if",
"err",
"=",
"rpc",
".",
"FromWire",
"(",
"wireValue",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
":=",
"transport",
".",
"Request",
"{",
"Caller",
":",
"rpc",
".",
"CallerName",
",",
"Service",
":",
"rpc",
".",
"ServiceName",
",",
"Encoding",
":",
"transport",
".",
"Encoding",
"(",
"rpc",
".",
"Encoding",
")",
",",
"Procedure",
":",
"rpc",
".",
"Procedure",
",",
"Headers",
":",
"transport",
".",
"HeadersFromMap",
"(",
"rpc",
".",
"Headers",
")",
",",
"Body",
":",
"bytes",
".",
"NewBuffer",
"(",
"rpc",
".",
"Body",
")",
",",
"}",
"\n\n",
"if",
"rpc",
".",
"ShardKey",
"!=",
"nil",
"{",
"req",
".",
"ShardKey",
"=",
"*",
"rpc",
".",
"ShardKey",
"\n",
"}",
"\n",
"if",
"rpc",
".",
"RoutingKey",
"!=",
"nil",
"{",
"req",
".",
"RoutingKey",
"=",
"*",
"rpc",
".",
"RoutingKey",
"\n",
"}",
"\n",
"if",
"rpc",
".",
"RoutingDelegate",
"!=",
"nil",
"{",
"req",
".",
"RoutingDelegate",
"=",
"*",
"rpc",
".",
"RoutingDelegate",
"\n",
"}",
"\n\n",
"spanContext",
",",
"err",
":=",
"spanContextFromBytes",
"(",
"tracer",
",",
"rpc",
".",
"SpanContext",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"spanContext",
",",
"&",
"req",
",",
"nil",
"\n",
"}"
] |
// FromBytes decodes bytes into a opentracing.SpanContext and transport.Request
|
[
"FromBytes",
"decodes",
"bytes",
"into",
"a",
"opentracing",
".",
"SpanContext",
"and",
"transport",
".",
"Request"
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/serialize/serialize.go#L82-L131
|
10,947 |
yarpc/yarpc-go
|
api/transport/stream.go
|
NewServerStream
|
func NewServerStream(s Stream, options ...ServerStreamOption) (*ServerStream, error) {
if s == nil {
return nil, yarpcerrors.InvalidArgumentErrorf("non-nil stream is required")
}
return &ServerStream{stream: s}, nil
}
|
go
|
func NewServerStream(s Stream, options ...ServerStreamOption) (*ServerStream, error) {
if s == nil {
return nil, yarpcerrors.InvalidArgumentErrorf("non-nil stream is required")
}
return &ServerStream{stream: s}, nil
}
|
[
"func",
"NewServerStream",
"(",
"s",
"Stream",
",",
"options",
"...",
"ServerStreamOption",
")",
"(",
"*",
"ServerStream",
",",
"error",
")",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"nil",
",",
"yarpcerrors",
".",
"InvalidArgumentErrorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"ServerStream",
"{",
"stream",
":",
"s",
"}",
",",
"nil",
"\n",
"}"
] |
// NewServerStream will create a new ServerStream.
|
[
"NewServerStream",
"will",
"create",
"a",
"new",
"ServerStream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/transport/stream.go#L43-L48
|
10,948 |
yarpc/yarpc-go
|
api/transport/stream.go
|
SendMessage
|
func (s *ServerStream) SendMessage(ctx context.Context, msg *StreamMessage) error {
return s.stream.SendMessage(ctx, msg)
}
|
go
|
func (s *ServerStream) SendMessage(ctx context.Context, msg *StreamMessage) error {
return s.stream.SendMessage(ctx, msg)
}
|
[
"func",
"(",
"s",
"*",
"ServerStream",
")",
"SendMessage",
"(",
"ctx",
"context",
".",
"Context",
",",
"msg",
"*",
"StreamMessage",
")",
"error",
"{",
"return",
"s",
".",
"stream",
".",
"SendMessage",
"(",
"ctx",
",",
"msg",
")",
"\n",
"}"
] |
// SendMessage sends a request over the stream. It blocks until the message
// has been sent. In certain implementations, the timeout on the context
// will be used to timeout the request.
|
[
"SendMessage",
"sends",
"a",
"request",
"over",
"the",
"stream",
".",
"It",
"blocks",
"until",
"the",
"message",
"has",
"been",
"sent",
".",
"In",
"certain",
"implementations",
"the",
"timeout",
"on",
"the",
"context",
"will",
"be",
"used",
"to",
"timeout",
"the",
"request",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/transport/stream.go#L68-L70
|
10,949 |
yarpc/yarpc-go
|
api/transport/stream.go
|
ReceiveMessage
|
func (s *ServerStream) ReceiveMessage(ctx context.Context) (*StreamMessage, error) {
return s.stream.ReceiveMessage(ctx)
}
|
go
|
func (s *ServerStream) ReceiveMessage(ctx context.Context) (*StreamMessage, error) {
return s.stream.ReceiveMessage(ctx)
}
|
[
"func",
"(",
"s",
"*",
"ServerStream",
")",
"ReceiveMessage",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"StreamMessage",
",",
"error",
")",
"{",
"return",
"s",
".",
"stream",
".",
"ReceiveMessage",
"(",
"ctx",
")",
"\n",
"}"
] |
// ReceiveMessage blocks until a message is received from the connection. It
// returns an io.Reader with the contents of the message.
|
[
"ReceiveMessage",
"blocks",
"until",
"a",
"message",
"is",
"received",
"from",
"the",
"connection",
".",
"It",
"returns",
"an",
"io",
".",
"Reader",
"with",
"the",
"contents",
"of",
"the",
"message",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/transport/stream.go#L74-L76
|
10,950 |
yarpc/yarpc-go
|
api/transport/stream.go
|
NewClientStream
|
func NewClientStream(s StreamCloser, options ...ClientStreamOption) (*ClientStream, error) {
if s == nil {
return nil, yarpcerrors.InvalidArgumentErrorf("non-nil stream with close is required")
}
return &ClientStream{stream: s}, nil
}
|
go
|
func NewClientStream(s StreamCloser, options ...ClientStreamOption) (*ClientStream, error) {
if s == nil {
return nil, yarpcerrors.InvalidArgumentErrorf("non-nil stream with close is required")
}
return &ClientStream{stream: s}, nil
}
|
[
"func",
"NewClientStream",
"(",
"s",
"StreamCloser",
",",
"options",
"...",
"ClientStreamOption",
")",
"(",
"*",
"ClientStream",
",",
"error",
")",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"nil",
",",
"yarpcerrors",
".",
"InvalidArgumentErrorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"ClientStream",
"{",
"stream",
":",
"s",
"}",
",",
"nil",
"\n",
"}"
] |
// NewClientStream will create a new ClientStream.
|
[
"NewClientStream",
"will",
"create",
"a",
"new",
"ClientStream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/transport/stream.go#L85-L90
|
10,951 |
yarpc/yarpc-go
|
api/transport/stream.go
|
Close
|
func (s *ClientStream) Close(ctx context.Context) error {
return s.stream.Close(ctx)
}
|
go
|
func (s *ClientStream) Close(ctx context.Context) error {
return s.stream.Close(ctx)
}
|
[
"func",
"(",
"s",
"*",
"ClientStream",
")",
"Close",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"s",
".",
"stream",
".",
"Close",
"(",
"ctx",
")",
"\n",
"}"
] |
// Close will close the connection. It blocks until the server has
// acknowledged the close. In certain implementations, the timeout on the
// context will be used to timeout the request. If the server timed out the
// connection will be forced closed by the client.
|
[
"Close",
"will",
"close",
"the",
"connection",
".",
"It",
"blocks",
"until",
"the",
"server",
"has",
"acknowledged",
"the",
"close",
".",
"In",
"certain",
"implementations",
"the",
"timeout",
"on",
"the",
"context",
"will",
"be",
"used",
"to",
"timeout",
"the",
"request",
".",
"If",
"the",
"server",
"timed",
"out",
"the",
"connection",
"will",
"be",
"forced",
"closed",
"by",
"the",
"client",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/transport/stream.go#L124-L126
|
10,952 |
yarpc/yarpc-go
|
internal/examples/thrift-hello/hello/echo/types.go
|
String
|
func (v *EchoResponse) String() string {
if v == nil {
return "<nil>"
}
var fields [2]string
i := 0
fields[i] = fmt.Sprintf("Message: %v", v.Message)
i++
fields[i] = fmt.Sprintf("Count: %v", v.Count)
i++
return fmt.Sprintf("EchoResponse{%v}", strings.Join(fields[:i], ", "))
}
|
go
|
func (v *EchoResponse) String() string {
if v == nil {
return "<nil>"
}
var fields [2]string
i := 0
fields[i] = fmt.Sprintf("Message: %v", v.Message)
i++
fields[i] = fmt.Sprintf("Count: %v", v.Count)
i++
return fmt.Sprintf("EchoResponse{%v}", strings.Join(fields[:i], ", "))
}
|
[
"func",
"(",
"v",
"*",
"EchoResponse",
")",
"String",
"(",
")",
"string",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"fields",
"[",
"2",
"]",
"string",
"\n",
"i",
":=",
"0",
"\n",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Message",
")",
"\n",
"i",
"++",
"\n",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Count",
")",
"\n",
"i",
"++",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fields",
"[",
":",
"i",
"]",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
// String returns a readable string representation of a EchoResponse
// struct.
|
[
"String",
"returns",
"a",
"readable",
"string",
"representation",
"of",
"a",
"EchoResponse",
"struct",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-hello/hello/echo/types.go#L302-L315
|
10,953 |
yarpc/yarpc-go
|
internal/examples/thrift-hello/hello/echo/types.go
|
Equals
|
func (v *EchoResponse) Equals(rhs *EchoResponse) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !(v.Message == rhs.Message) {
return false
}
if !(v.Count == rhs.Count) {
return false
}
return true
}
|
go
|
func (v *EchoResponse) Equals(rhs *EchoResponse) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !(v.Message == rhs.Message) {
return false
}
if !(v.Count == rhs.Count) {
return false
}
return true
}
|
[
"func",
"(",
"v",
"*",
"EchoResponse",
")",
"Equals",
"(",
"rhs",
"*",
"EchoResponse",
")",
"bool",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"rhs",
"==",
"nil",
"\n",
"}",
"else",
"if",
"rhs",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"(",
"v",
".",
"Message",
"==",
"rhs",
".",
"Message",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"(",
"v",
".",
"Count",
"==",
"rhs",
".",
"Count",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
// Equals returns true if all the fields of this EchoResponse match the
// provided EchoResponse.
//
// This function performs a deep comparison.
|
[
"Equals",
"returns",
"true",
"if",
"all",
"the",
"fields",
"of",
"this",
"EchoResponse",
"match",
"the",
"provided",
"EchoResponse",
".",
"This",
"function",
"performs",
"a",
"deep",
"comparison",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-hello/hello/echo/types.go#L321-L335
|
10,954 |
yarpc/yarpc-go
|
internal/examples/thrift-hello/hello/echo/types.go
|
MarshalLogObject
|
func (v *EchoResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
enc.AddString("message", v.Message)
enc.AddInt16("count", v.Count)
return err
}
|
go
|
func (v *EchoResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
enc.AddString("message", v.Message)
enc.AddInt16("count", v.Count)
return err
}
|
[
"func",
"(",
"v",
"*",
"EchoResponse",
")",
"MarshalLogObject",
"(",
"enc",
"zapcore",
".",
"ObjectEncoder",
")",
"(",
"err",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"enc",
".",
"AddString",
"(",
"\"",
"\"",
",",
"v",
".",
"Message",
")",
"\n",
"enc",
".",
"AddInt16",
"(",
"\"",
"\"",
",",
"v",
".",
"Count",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of EchoResponse.
|
[
"MarshalLogObject",
"implements",
"zapcore",
".",
"ObjectMarshaler",
"enabling",
"fast",
"logging",
"of",
"EchoResponse",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-hello/hello/echo/types.go#L339-L346
|
10,955 |
yarpc/yarpc-go
|
encoding/protobuf/protoc-gen-yarpc-go/internal/lib/lib.go
|
fileDescriptorClosureVarName
|
func fileDescriptorClosureVarName(f *protoplugin.File) (string, error) {
name := f.GetName()
if name == "" {
return "", fmt.Errorf("could not create fileDescriptorClosureVarName: %s has no name", f)
}
// Use a sha256 of the filename instead of the filename to prevent any 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
}
|
go
|
func fileDescriptorClosureVarName(f *protoplugin.File) (string, error) {
name := f.GetName()
if name == "" {
return "", fmt.Errorf("could not create fileDescriptorClosureVarName: %s has no name", f)
}
// Use a sha256 of the filename instead of the filename to prevent any 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
}
|
[
"func",
"fileDescriptorClosureVarName",
"(",
"f",
"*",
"protoplugin",
".",
"File",
")",
"(",
"string",
",",
"error",
")",
"{",
"name",
":=",
"f",
".",
"GetName",
"(",
")",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
")",
"\n",
"}",
"\n\n",
"// Use a sha256 of the filename instead of the filename to prevent any characters that are illegal",
"// as golang identifiers and to discourage external usage of this constant.",
"h",
":=",
"sha256",
".",
"Sum256",
"(",
"[",
"]",
"byte",
"(",
"name",
")",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hex",
".",
"EncodeToString",
"(",
"h",
"[",
":",
"8",
"]",
")",
")",
",",
"nil",
"\n",
"}"
] |
// fileDescriptorClosureVarName is used to refer to a variable that contains a closure of all encoded
// file descriptors required to interpret a specific proto file. It is used in the yarpc codebase to
// attach reflection information to services.
|
[
"fileDescriptorClosureVarName",
"is",
"used",
"to",
"refer",
"to",
"a",
"variable",
"that",
"contains",
"a",
"closure",
"of",
"all",
"encoded",
"file",
"descriptors",
"required",
"to",
"interpret",
"a",
"specific",
"proto",
"file",
".",
"It",
"is",
"used",
"in",
"the",
"yarpc",
"codebase",
"to",
"attach",
"reflection",
"information",
"to",
"services",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protoc-gen-yarpc-go/internal/lib/lib.go#L667-L677
|
10,956 |
yarpc/yarpc-go
|
internal/grpcctx/grpcctx.go
|
Wrap
|
func (c *ContextWrapper) Wrap(ctx context.Context) context.Context {
return metadata.NewOutgoingContext(ctx, c.md)
}
|
go
|
func (c *ContextWrapper) Wrap(ctx context.Context) context.Context {
return metadata.NewOutgoingContext(ctx, c.md)
}
|
[
"func",
"(",
"c",
"*",
"ContextWrapper",
")",
"Wrap",
"(",
"ctx",
"context",
".",
"Context",
")",
"context",
".",
"Context",
"{",
"return",
"metadata",
".",
"NewOutgoingContext",
"(",
"ctx",
",",
"c",
".",
"md",
")",
"\n",
"}"
] |
// Wrap wraps the given context with the headers.
|
[
"Wrap",
"wraps",
"the",
"given",
"context",
"with",
"the",
"headers",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/grpcctx/grpcctx.go#L49-L51
|
10,957 |
yarpc/yarpc-go
|
internal/grpcctx/grpcctx.go
|
WithHeader
|
func (c *ContextWrapper) WithHeader(key, value string) *ContextWrapper {
return c.copyAndAdd(key, value)
}
|
go
|
func (c *ContextWrapper) WithHeader(key, value string) *ContextWrapper {
return c.copyAndAdd(key, value)
}
|
[
"func",
"(",
"c",
"*",
"ContextWrapper",
")",
"WithHeader",
"(",
"key",
",",
"value",
"string",
")",
"*",
"ContextWrapper",
"{",
"return",
"c",
".",
"copyAndAdd",
"(",
"key",
",",
"value",
")",
"\n",
"}"
] |
// WithHeader returns a new ContextWrapper with the given header.
|
[
"WithHeader",
"returns",
"a",
"new",
"ContextWrapper",
"with",
"the",
"given",
"header",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/grpcctx/grpcctx.go#L84-L86
|
10,958 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/types.go
|
String
|
func (v *SinkRequest) String() string {
if v == nil {
return "<nil>"
}
var fields [1]string
i := 0
fields[i] = fmt.Sprintf("Message: %v", v.Message)
i++
return fmt.Sprintf("SinkRequest{%v}", strings.Join(fields[:i], ", "))
}
|
go
|
func (v *SinkRequest) String() string {
if v == nil {
return "<nil>"
}
var fields [1]string
i := 0
fields[i] = fmt.Sprintf("Message: %v", v.Message)
i++
return fmt.Sprintf("SinkRequest{%v}", strings.Join(fields[:i], ", "))
}
|
[
"func",
"(",
"v",
"*",
"SinkRequest",
")",
"String",
"(",
")",
"string",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"fields",
"[",
"1",
"]",
"string",
"\n",
"i",
":=",
"0",
"\n",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Message",
")",
"\n",
"i",
"++",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fields",
"[",
":",
"i",
"]",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
// String returns a readable string representation of a SinkRequest
// struct.
|
[
"String",
"returns",
"a",
"readable",
"string",
"representation",
"of",
"a",
"SinkRequest",
"struct",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/types.go#L115-L126
|
10,959 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/types.go
|
Equals
|
func (v *SinkRequest) Equals(rhs *SinkRequest) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !(v.Message == rhs.Message) {
return false
}
return true
}
|
go
|
func (v *SinkRequest) Equals(rhs *SinkRequest) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !(v.Message == rhs.Message) {
return false
}
return true
}
|
[
"func",
"(",
"v",
"*",
"SinkRequest",
")",
"Equals",
"(",
"rhs",
"*",
"SinkRequest",
")",
"bool",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"rhs",
"==",
"nil",
"\n",
"}",
"else",
"if",
"rhs",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"(",
"v",
".",
"Message",
"==",
"rhs",
".",
"Message",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
// Equals returns true if all the fields of this SinkRequest match the
// provided SinkRequest.
//
// This function performs a deep comparison.
|
[
"Equals",
"returns",
"true",
"if",
"all",
"the",
"fields",
"of",
"this",
"SinkRequest",
"match",
"the",
"provided",
"SinkRequest",
".",
"This",
"function",
"performs",
"a",
"deep",
"comparison",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/types.go#L132-L143
|
10,960 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/types.go
|
MarshalLogObject
|
func (v *SinkRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
enc.AddString("message", v.Message)
return err
}
|
go
|
func (v *SinkRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
enc.AddString("message", v.Message)
return err
}
|
[
"func",
"(",
"v",
"*",
"SinkRequest",
")",
"MarshalLogObject",
"(",
"enc",
"zapcore",
".",
"ObjectEncoder",
")",
"(",
"err",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"enc",
".",
"AddString",
"(",
"\"",
"\"",
",",
"v",
".",
"Message",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SinkRequest.
|
[
"MarshalLogObject",
"implements",
"zapcore",
".",
"ObjectMarshaler",
"enabling",
"fast",
"logging",
"of",
"SinkRequest",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/types.go#L147-L153
|
10,961 |
yarpc/yarpc-go
|
internal/crossdock/client/httpserver/behavior.go
|
Run
|
func Run(t crossdock.T) {
fatals := crossdock.Fatals(t)
server := t.Param(params.HTTPServer)
fatals.NotEmpty(server, "server is required")
httpTransport := http.NewTransport()
disp := yarpc.NewDispatcher(yarpc.Config{
Name: "client",
Outbounds: yarpc.Outbounds{
"yarpc-test": {
Unary: httpTransport.NewSingleOutbound(fmt.Sprintf("http://%s:8085", server)),
},
},
})
fatals.NoError(disp.Start(), "could not start Dispatcher")
defer disp.Stop()
runRaw(t, disp)
}
|
go
|
func Run(t crossdock.T) {
fatals := crossdock.Fatals(t)
server := t.Param(params.HTTPServer)
fatals.NotEmpty(server, "server is required")
httpTransport := http.NewTransport()
disp := yarpc.NewDispatcher(yarpc.Config{
Name: "client",
Outbounds: yarpc.Outbounds{
"yarpc-test": {
Unary: httpTransport.NewSingleOutbound(fmt.Sprintf("http://%s:8085", server)),
},
},
})
fatals.NoError(disp.Start(), "could not start Dispatcher")
defer disp.Stop()
runRaw(t, disp)
}
|
[
"func",
"Run",
"(",
"t",
"crossdock",
".",
"T",
")",
"{",
"fatals",
":=",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
"\n\n",
"server",
":=",
"t",
".",
"Param",
"(",
"params",
".",
"HTTPServer",
")",
"\n",
"fatals",
".",
"NotEmpty",
"(",
"server",
",",
"\"",
"\"",
")",
"\n\n",
"httpTransport",
":=",
"http",
".",
"NewTransport",
"(",
")",
"\n",
"disp",
":=",
"yarpc",
".",
"NewDispatcher",
"(",
"yarpc",
".",
"Config",
"{",
"Name",
":",
"\"",
"\"",
",",
"Outbounds",
":",
"yarpc",
".",
"Outbounds",
"{",
"\"",
"\"",
":",
"{",
"Unary",
":",
"httpTransport",
".",
"NewSingleOutbound",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"server",
")",
")",
",",
"}",
",",
"}",
",",
"}",
")",
"\n\n",
"fatals",
".",
"NoError",
"(",
"disp",
".",
"Start",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"defer",
"disp",
".",
"Stop",
"(",
")",
"\n\n",
"runRaw",
"(",
"t",
",",
"disp",
")",
"\n",
"}"
] |
// Run exercise a yarpc client against a rigged httpserver.
|
[
"Run",
"exercise",
"a",
"yarpc",
"client",
"against",
"a",
"rigged",
"httpserver",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/client/httpserver/behavior.go#L37-L57
|
10,962 |
yarpc/yarpc-go
|
internal/crossdock/client/httpserver/behavior.go
|
runRaw
|
func runRaw(t crossdock.T, disp *yarpc.Dispatcher) {
assert := crossdock.Assert(t)
fatals := crossdock.Fatals(t)
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()
client := raw.New(disp.ClientConfig("yarpc-test"))
_, err := client.Call(ctx, "handlertimeout/raw", nil)
fatals.Error(err, "expected an error")
if yarpcerrors.FromError(err).Code() == yarpcerrors.CodeInvalidArgument {
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)
}
|
go
|
func runRaw(t crossdock.T, disp *yarpc.Dispatcher) {
assert := crossdock.Assert(t)
fatals := crossdock.Fatals(t)
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()
client := raw.New(disp.ClientConfig("yarpc-test"))
_, err := client.Call(ctx, "handlertimeout/raw", nil)
fatals.Error(err, "expected an error")
if yarpcerrors.FromError(err).Code() == yarpcerrors.CodeInvalidArgument {
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)
}
|
[
"func",
"runRaw",
"(",
"t",
"crossdock",
".",
"T",
",",
"disp",
"*",
"yarpc",
".",
"Dispatcher",
")",
"{",
"assert",
":=",
"crossdock",
".",
"Assert",
"(",
"t",
")",
"\n",
"fatals",
":=",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"100",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"client",
":=",
"raw",
".",
"New",
"(",
"disp",
".",
"ClientConfig",
"(",
"\"",
"\"",
")",
")",
"\n",
"_",
",",
"err",
":=",
"client",
".",
"Call",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
")",
"\n",
"fatals",
".",
"Error",
"(",
"err",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"yarpcerrors",
".",
"FromError",
"(",
"err",
")",
".",
"Code",
"(",
")",
"==",
"yarpcerrors",
".",
"CodeInvalidArgument",
"{",
"t",
".",
"Skipf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"assert",
".",
"Equal",
"(",
"yarpcerrors",
".",
"CodeDeadlineExceeded",
",",
"yarpcerrors",
".",
"FromError",
"(",
"err",
")",
".",
"Code",
"(",
")",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}"
] |
// runRaw tests if a yarpc client returns a remote timeout error behind the
// TimeoutError interface when a remote http handler returns a handler timeout.
|
[
"runRaw",
"tests",
"if",
"a",
"yarpc",
"client",
"returns",
"a",
"remote",
"timeout",
"error",
"behind",
"the",
"TimeoutError",
"interface",
"when",
"a",
"remote",
"http",
"handler",
"returns",
"a",
"handler",
"timeout",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/client/httpserver/behavior.go#L61-L78
|
10,963 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
BuildProcedures
|
func BuildProcedures(params BuildProceduresParams) []transport.Procedure {
procedures := make([]transport.Procedure, 0, 2*(len(params.UnaryHandlerParams)+len(params.OnewayHandlerParams)))
for _, unaryHandlerParams := range params.UnaryHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, unaryHandlerParams.MethodName),
HandlerSpec: transport.NewUnaryHandlerSpec(unaryHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, unaryHandlerParams.MethodName),
HandlerSpec: transport.NewUnaryHandlerSpec(unaryHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
for _, onewayHandlerParams := range params.OnewayHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, onewayHandlerParams.MethodName),
HandlerSpec: transport.NewOnewayHandlerSpec(onewayHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, onewayHandlerParams.MethodName),
HandlerSpec: transport.NewOnewayHandlerSpec(onewayHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
for _, streamHandlerParams := range params.StreamHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, streamHandlerParams.MethodName),
HandlerSpec: transport.NewStreamHandlerSpec(streamHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, streamHandlerParams.MethodName),
HandlerSpec: transport.NewStreamHandlerSpec(streamHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
return procedures
}
|
go
|
func BuildProcedures(params BuildProceduresParams) []transport.Procedure {
procedures := make([]transport.Procedure, 0, 2*(len(params.UnaryHandlerParams)+len(params.OnewayHandlerParams)))
for _, unaryHandlerParams := range params.UnaryHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, unaryHandlerParams.MethodName),
HandlerSpec: transport.NewUnaryHandlerSpec(unaryHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, unaryHandlerParams.MethodName),
HandlerSpec: transport.NewUnaryHandlerSpec(unaryHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
for _, onewayHandlerParams := range params.OnewayHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, onewayHandlerParams.MethodName),
HandlerSpec: transport.NewOnewayHandlerSpec(onewayHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, onewayHandlerParams.MethodName),
HandlerSpec: transport.NewOnewayHandlerSpec(onewayHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
for _, streamHandlerParams := range params.StreamHandlerParams {
procedures = append(
procedures,
transport.Procedure{
Name: procedure.ToName(params.ServiceName, streamHandlerParams.MethodName),
HandlerSpec: transport.NewStreamHandlerSpec(streamHandlerParams.Handler),
Encoding: Encoding,
},
transport.Procedure{
Name: procedure.ToName(params.ServiceName, streamHandlerParams.MethodName),
HandlerSpec: transport.NewStreamHandlerSpec(streamHandlerParams.Handler),
Encoding: JSONEncoding,
},
)
}
return procedures
}
|
[
"func",
"BuildProcedures",
"(",
"params",
"BuildProceduresParams",
")",
"[",
"]",
"transport",
".",
"Procedure",
"{",
"procedures",
":=",
"make",
"(",
"[",
"]",
"transport",
".",
"Procedure",
",",
"0",
",",
"2",
"*",
"(",
"len",
"(",
"params",
".",
"UnaryHandlerParams",
")",
"+",
"len",
"(",
"params",
".",
"OnewayHandlerParams",
")",
")",
")",
"\n",
"for",
"_",
",",
"unaryHandlerParams",
":=",
"range",
"params",
".",
"UnaryHandlerParams",
"{",
"procedures",
"=",
"append",
"(",
"procedures",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"unaryHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewUnaryHandlerSpec",
"(",
"unaryHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"Encoding",
",",
"}",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"unaryHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewUnaryHandlerSpec",
"(",
"unaryHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"JSONEncoding",
",",
"}",
",",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"onewayHandlerParams",
":=",
"range",
"params",
".",
"OnewayHandlerParams",
"{",
"procedures",
"=",
"append",
"(",
"procedures",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"onewayHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewOnewayHandlerSpec",
"(",
"onewayHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"Encoding",
",",
"}",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"onewayHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewOnewayHandlerSpec",
"(",
"onewayHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"JSONEncoding",
",",
"}",
",",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"streamHandlerParams",
":=",
"range",
"params",
".",
"StreamHandlerParams",
"{",
"procedures",
"=",
"append",
"(",
"procedures",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"streamHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewStreamHandlerSpec",
"(",
"streamHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"Encoding",
",",
"}",
",",
"transport",
".",
"Procedure",
"{",
"Name",
":",
"procedure",
".",
"ToName",
"(",
"params",
".",
"ServiceName",
",",
"streamHandlerParams",
".",
"MethodName",
")",
",",
"HandlerSpec",
":",
"transport",
".",
"NewStreamHandlerSpec",
"(",
"streamHandlerParams",
".",
"Handler",
")",
",",
"Encoding",
":",
"JSONEncoding",
",",
"}",
",",
")",
"\n",
"}",
"\n",
"return",
"procedures",
"\n",
"}"
] |
// BuildProcedures builds the transport.Procedures.
|
[
"BuildProcedures",
"builds",
"the",
"transport",
".",
"Procedures",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L77-L125
|
10,964 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
NewStreamClient
|
func NewStreamClient(params ClientParams) StreamClient {
return newClient(params.ServiceName, params.ClientConfig, params.Options...)
}
|
go
|
func NewStreamClient(params ClientParams) StreamClient {
return newClient(params.ServiceName, params.ClientConfig, params.Options...)
}
|
[
"func",
"NewStreamClient",
"(",
"params",
"ClientParams",
")",
"StreamClient",
"{",
"return",
"newClient",
"(",
"params",
".",
"ServiceName",
",",
"params",
".",
"ClientConfig",
",",
"params",
".",
"Options",
"...",
")",
"\n",
"}"
] |
// NewStreamClient creates a new stream client.
|
[
"NewStreamClient",
"creates",
"a",
"new",
"stream",
"client",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L173-L175
|
10,965 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
NewUnaryHandler
|
func NewUnaryHandler(params UnaryHandlerParams) transport.UnaryHandler {
return newUnaryHandler(params.Handle, params.NewRequest)
}
|
go
|
func NewUnaryHandler(params UnaryHandlerParams) transport.UnaryHandler {
return newUnaryHandler(params.Handle, params.NewRequest)
}
|
[
"func",
"NewUnaryHandler",
"(",
"params",
"UnaryHandlerParams",
")",
"transport",
".",
"UnaryHandler",
"{",
"return",
"newUnaryHandler",
"(",
"params",
".",
"Handle",
",",
"params",
".",
"NewRequest",
")",
"\n",
"}"
] |
// NewUnaryHandler returns a new UnaryHandler.
|
[
"NewUnaryHandler",
"returns",
"a",
"new",
"UnaryHandler",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L184-L186
|
10,966 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
NewOnewayHandler
|
func NewOnewayHandler(params OnewayHandlerParams) transport.OnewayHandler {
return newOnewayHandler(params.Handle, params.NewRequest)
}
|
go
|
func NewOnewayHandler(params OnewayHandlerParams) transport.OnewayHandler {
return newOnewayHandler(params.Handle, params.NewRequest)
}
|
[
"func",
"NewOnewayHandler",
"(",
"params",
"OnewayHandlerParams",
")",
"transport",
".",
"OnewayHandler",
"{",
"return",
"newOnewayHandler",
"(",
"params",
".",
"Handle",
",",
"params",
".",
"NewRequest",
")",
"\n",
"}"
] |
// NewOnewayHandler returns a new OnewayHandler.
|
[
"NewOnewayHandler",
"returns",
"a",
"new",
"OnewayHandler",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L195-L197
|
10,967 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
ClientBuilderOptions
|
func ClientBuilderOptions(_ transport.ClientConfig, structField reflect.StructField) []ClientOption {
var opts []ClientOption
for _, opt := range uniqueLowercaseStrings(strings.Split(structField.Tag.Get("proto"), ",")) {
switch opt {
case "json":
opts = append(opts, UseJSON)
}
}
return opts
}
|
go
|
func ClientBuilderOptions(_ transport.ClientConfig, structField reflect.StructField) []ClientOption {
var opts []ClientOption
for _, opt := range uniqueLowercaseStrings(strings.Split(structField.Tag.Get("proto"), ",")) {
switch opt {
case "json":
opts = append(opts, UseJSON)
}
}
return opts
}
|
[
"func",
"ClientBuilderOptions",
"(",
"_",
"transport",
".",
"ClientConfig",
",",
"structField",
"reflect",
".",
"StructField",
")",
"[",
"]",
"ClientOption",
"{",
"var",
"opts",
"[",
"]",
"ClientOption",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"uniqueLowercaseStrings",
"(",
"strings",
".",
"Split",
"(",
"structField",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
")",
"{",
"switch",
"opt",
"{",
"case",
"\"",
"\"",
":",
"opts",
"=",
"append",
"(",
"opts",
",",
"UseJSON",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"opts",
"\n",
"}"
] |
// ClientBuilderOptions returns ClientOptions that yarpc.InjectClients should use for a
// specific client given information about the field into which the client is being injected.
|
[
"ClientBuilderOptions",
"returns",
"ClientOptions",
"that",
"yarpc",
".",
"InjectClients",
"should",
"use",
"for",
"a",
"specific",
"client",
"given",
"information",
"about",
"the",
"field",
"into",
"which",
"the",
"client",
"is",
"being",
"injected",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L211-L220
|
10,968 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
CastError
|
func CastError(expectedType proto.Message, actualType proto.Message) error {
return yarpcerrors.Newf(yarpcerrors.CodeInternal, "expected proto.Message to have type %T but had type %T", expectedType, actualType)
}
|
go
|
func CastError(expectedType proto.Message, actualType proto.Message) error {
return yarpcerrors.Newf(yarpcerrors.CodeInternal, "expected proto.Message to have type %T but had type %T", expectedType, actualType)
}
|
[
"func",
"CastError",
"(",
"expectedType",
"proto",
".",
"Message",
",",
"actualType",
"proto",
".",
"Message",
")",
"error",
"{",
"return",
"yarpcerrors",
".",
"Newf",
"(",
"yarpcerrors",
".",
"CodeInternal",
",",
"\"",
"\"",
",",
"expectedType",
",",
"actualType",
")",
"\n",
"}"
] |
// CastError returns an error saying that generated code could not properly cast a proto.Message to it's expected type.
|
[
"CastError",
"returns",
"an",
"error",
"saying",
"that",
"generated",
"code",
"could",
"not",
"properly",
"cast",
"a",
"proto",
".",
"Message",
"to",
"it",
"s",
"expected",
"type",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L223-L225
|
10,969 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
Receive
|
func (c *ClientStream) Receive(newMessage func() proto.Message, options ...yarpc.StreamOption) (proto.Message, error) {
return readFromStream(context.Background(), c.stream, newMessage)
}
|
go
|
func (c *ClientStream) Receive(newMessage func() proto.Message, options ...yarpc.StreamOption) (proto.Message, error) {
return readFromStream(context.Background(), c.stream, newMessage)
}
|
[
"func",
"(",
"c",
"*",
"ClientStream",
")",
"Receive",
"(",
"newMessage",
"func",
"(",
")",
"proto",
".",
"Message",
",",
"options",
"...",
"yarpc",
".",
"StreamOption",
")",
"(",
"proto",
".",
"Message",
",",
"error",
")",
"{",
"return",
"readFromStream",
"(",
"context",
".",
"Background",
"(",
")",
",",
"c",
".",
"stream",
",",
"newMessage",
")",
"\n",
"}"
] |
// Receive will receive a protobuf message from the client stream.
|
[
"Receive",
"will",
"receive",
"a",
"protobuf",
"message",
"from",
"the",
"client",
"stream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L258-L260
|
10,970 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
Send
|
func (c *ClientStream) Send(message proto.Message, options ...yarpc.StreamOption) error {
return writeToStream(context.Background(), c.stream, message)
}
|
go
|
func (c *ClientStream) Send(message proto.Message, options ...yarpc.StreamOption) error {
return writeToStream(context.Background(), c.stream, message)
}
|
[
"func",
"(",
"c",
"*",
"ClientStream",
")",
"Send",
"(",
"message",
"proto",
".",
"Message",
",",
"options",
"...",
"yarpc",
".",
"StreamOption",
")",
"error",
"{",
"return",
"writeToStream",
"(",
"context",
".",
"Background",
"(",
")",
",",
"c",
".",
"stream",
",",
"message",
")",
"\n",
"}"
] |
// Send will send a protobuf message to the client stream.
|
[
"Send",
"will",
"send",
"a",
"protobuf",
"message",
"to",
"the",
"client",
"stream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L263-L265
|
10,971 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
Close
|
func (c *ClientStream) Close(options ...yarpc.StreamOption) error {
return c.stream.Close(context.Background())
}
|
go
|
func (c *ClientStream) Close(options ...yarpc.StreamOption) error {
return c.stream.Close(context.Background())
}
|
[
"func",
"(",
"c",
"*",
"ClientStream",
")",
"Close",
"(",
"options",
"...",
"yarpc",
".",
"StreamOption",
")",
"error",
"{",
"return",
"c",
".",
"stream",
".",
"Close",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"}"
] |
// Close will close the protobuf stream.
|
[
"Close",
"will",
"close",
"the",
"protobuf",
"stream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L268-L270
|
10,972 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
Receive
|
func (s *ServerStream) Receive(newMessage func() proto.Message, options ...yarpc.StreamOption) (proto.Message, error) {
return readFromStream(context.Background(), s.stream, newMessage)
}
|
go
|
func (s *ServerStream) Receive(newMessage func() proto.Message, options ...yarpc.StreamOption) (proto.Message, error) {
return readFromStream(context.Background(), s.stream, newMessage)
}
|
[
"func",
"(",
"s",
"*",
"ServerStream",
")",
"Receive",
"(",
"newMessage",
"func",
"(",
")",
"proto",
".",
"Message",
",",
"options",
"...",
"yarpc",
".",
"StreamOption",
")",
"(",
"proto",
".",
"Message",
",",
"error",
")",
"{",
"return",
"readFromStream",
"(",
"context",
".",
"Background",
"(",
")",
",",
"s",
".",
"stream",
",",
"newMessage",
")",
"\n",
"}"
] |
// Receive will receive a protobuf message from the server stream.
|
[
"Receive",
"will",
"receive",
"a",
"protobuf",
"message",
"from",
"the",
"server",
"stream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L284-L286
|
10,973 |
yarpc/yarpc-go
|
encoding/protobuf/protobuf.go
|
Send
|
func (s *ServerStream) Send(message proto.Message, options ...yarpc.StreamOption) error {
return writeToStream(context.Background(), s.stream, message)
}
|
go
|
func (s *ServerStream) Send(message proto.Message, options ...yarpc.StreamOption) error {
return writeToStream(context.Background(), s.stream, message)
}
|
[
"func",
"(",
"s",
"*",
"ServerStream",
")",
"Send",
"(",
"message",
"proto",
".",
"Message",
",",
"options",
"...",
"yarpc",
".",
"StreamOption",
")",
"error",
"{",
"return",
"writeToStream",
"(",
"context",
".",
"Background",
"(",
")",
",",
"s",
".",
"stream",
",",
"message",
")",
"\n",
"}"
] |
// Send will send a protobuf message to the server stream.
|
[
"Send",
"will",
"send",
"a",
"protobuf",
"message",
"to",
"the",
"server",
"stream",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/encoding/protobuf/protobuf.go#L289-L291
|
10,974 |
yarpc/yarpc-go
|
internal/whitespace/expand.go
|
Expand
|
func Expand(s string) string {
lines := strings.Split(s, "\n")
for i, l := range lines {
lines[i] = expandLine(l)
}
return strings.Join(lines, "\n")
}
|
go
|
func Expand(s string) string {
lines := strings.Split(s, "\n")
for i, l := range lines {
lines[i] = expandLine(l)
}
return strings.Join(lines, "\n")
}
|
[
"func",
"Expand",
"(",
"s",
"string",
")",
"string",
"{",
"lines",
":=",
"strings",
".",
"Split",
"(",
"s",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"lines",
"{",
"lines",
"[",
"i",
"]",
"=",
"expandLine",
"(",
"l",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"lines",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}"
] |
// Expand converts leading tabs to two spaces, such that YAML accepts the whole
// block.
|
[
"Expand",
"converts",
"leading",
"tabs",
"to",
"two",
"spaces",
"such",
"that",
"YAML",
"accepts",
"the",
"whole",
"block",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/whitespace/expand.go#L27-L33
|
10,975 |
yarpc/yarpc-go
|
internal/crossdock/crossdockpb/crossdock.pb.yarpc.go
|
NewEchoYARPCClient
|
func NewEchoYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) EchoYARPCClient {
return &_EchoYARPCCaller{protobuf.NewStreamClient(
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Echo",
ClientConfig: clientConfig,
Options: options,
},
)}
}
|
go
|
func NewEchoYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) EchoYARPCClient {
return &_EchoYARPCCaller{protobuf.NewStreamClient(
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Echo",
ClientConfig: clientConfig,
Options: options,
},
)}
}
|
[
"func",
"NewEchoYARPCClient",
"(",
"clientConfig",
"transport",
".",
"ClientConfig",
",",
"options",
"...",
"protobuf",
".",
"ClientOption",
")",
"EchoYARPCClient",
"{",
"return",
"&",
"_EchoYARPCCaller",
"{",
"protobuf",
".",
"NewStreamClient",
"(",
"protobuf",
".",
"ClientParams",
"{",
"ServiceName",
":",
"\"",
"\"",
",",
"ClientConfig",
":",
"clientConfig",
",",
"Options",
":",
"options",
",",
"}",
",",
")",
"}",
"\n",
"}"
] |
// NewEchoYARPCClient builds a new YARPC client for the Echo service.
|
[
"NewEchoYARPCClient",
"builds",
"a",
"new",
"YARPC",
"client",
"for",
"the",
"Echo",
"service",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/crossdockpb/crossdock.pb.yarpc.go#L49-L57
|
10,976 |
yarpc/yarpc-go
|
internal/crossdock/crossdockpb/crossdock.pb.yarpc.go
|
BuildEchoYARPCProcedures
|
func BuildEchoYARPCProcedures(server EchoYARPCServer) []transport.Procedure {
handler := &_EchoYARPCHandler{server}
return protobuf.BuildProcedures(
protobuf.BuildProceduresParams{
ServiceName: "uber.yarpc.internal.crossdock.Echo",
UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{
{
MethodName: "Echo",
Handler: protobuf.NewUnaryHandler(
protobuf.UnaryHandlerParams{
Handle: handler.Echo,
NewRequest: newEchoServiceEchoYARPCRequest,
},
),
},
},
OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
}
|
go
|
func BuildEchoYARPCProcedures(server EchoYARPCServer) []transport.Procedure {
handler := &_EchoYARPCHandler{server}
return protobuf.BuildProcedures(
protobuf.BuildProceduresParams{
ServiceName: "uber.yarpc.internal.crossdock.Echo",
UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{
{
MethodName: "Echo",
Handler: protobuf.NewUnaryHandler(
protobuf.UnaryHandlerParams{
Handle: handler.Echo,
NewRequest: newEchoServiceEchoYARPCRequest,
},
),
},
},
OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
}
|
[
"func",
"BuildEchoYARPCProcedures",
"(",
"server",
"EchoYARPCServer",
")",
"[",
"]",
"transport",
".",
"Procedure",
"{",
"handler",
":=",
"&",
"_EchoYARPCHandler",
"{",
"server",
"}",
"\n",
"return",
"protobuf",
".",
"BuildProcedures",
"(",
"protobuf",
".",
"BuildProceduresParams",
"{",
"ServiceName",
":",
"\"",
"\"",
",",
"UnaryHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresUnaryHandlerParams",
"{",
"{",
"MethodName",
":",
"\"",
"\"",
",",
"Handler",
":",
"protobuf",
".",
"NewUnaryHandler",
"(",
"protobuf",
".",
"UnaryHandlerParams",
"{",
"Handle",
":",
"handler",
".",
"Echo",
",",
"NewRequest",
":",
"newEchoServiceEchoYARPCRequest",
",",
"}",
",",
")",
",",
"}",
",",
"}",
",",
"OnewayHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresOnewayHandlerParams",
"{",
"}",
",",
"StreamHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresStreamHandlerParams",
"{",
"}",
",",
"}",
",",
")",
"\n",
"}"
] |
// BuildEchoYARPCProcedures prepares an implementation of the Echo service for YARPC registration.
|
[
"BuildEchoYARPCProcedures",
"prepares",
"an",
"implementation",
"of",
"the",
"Echo",
"service",
"for",
"YARPC",
"registration",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/crossdockpb/crossdock.pb.yarpc.go#L65-L85
|
10,977 |
yarpc/yarpc-go
|
internal/crossdock/crossdockpb/crossdock.pb.yarpc.go
|
NewOnewayYARPCClient
|
func NewOnewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) OnewayYARPCClient {
return &_OnewayYARPCCaller{protobuf.NewStreamClient(
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Oneway",
ClientConfig: clientConfig,
Options: options,
},
)}
}
|
go
|
func NewOnewayYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) OnewayYARPCClient {
return &_OnewayYARPCCaller{protobuf.NewStreamClient(
protobuf.ClientParams{
ServiceName: "uber.yarpc.internal.crossdock.Oneway",
ClientConfig: clientConfig,
Options: options,
},
)}
}
|
[
"func",
"NewOnewayYARPCClient",
"(",
"clientConfig",
"transport",
".",
"ClientConfig",
",",
"options",
"...",
"protobuf",
".",
"ClientOption",
")",
"OnewayYARPCClient",
"{",
"return",
"&",
"_OnewayYARPCCaller",
"{",
"protobuf",
".",
"NewStreamClient",
"(",
"protobuf",
".",
"ClientParams",
"{",
"ServiceName",
":",
"\"",
"\"",
",",
"ClientConfig",
":",
"clientConfig",
",",
"Options",
":",
"options",
",",
"}",
",",
")",
"}",
"\n",
"}"
] |
// NewOnewayYARPCClient builds a new YARPC client for the Oneway service.
|
[
"NewOnewayYARPCClient",
"builds",
"a",
"new",
"YARPC",
"client",
"for",
"the",
"Oneway",
"service",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/crossdockpb/crossdock.pb.yarpc.go#L222-L230
|
10,978 |
yarpc/yarpc-go
|
internal/crossdock/crossdockpb/crossdock.pb.yarpc.go
|
BuildOnewayYARPCProcedures
|
func BuildOnewayYARPCProcedures(server OnewayYARPCServer) []transport.Procedure {
handler := &_OnewayYARPCHandler{server}
return protobuf.BuildProcedures(
protobuf.BuildProceduresParams{
ServiceName: "uber.yarpc.internal.crossdock.Oneway",
UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{},
OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{
{
MethodName: "Echo",
Handler: protobuf.NewOnewayHandler(
protobuf.OnewayHandlerParams{
Handle: handler.Echo,
NewRequest: newOnewayServiceEchoYARPCRequest,
},
),
},
},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
}
|
go
|
func BuildOnewayYARPCProcedures(server OnewayYARPCServer) []transport.Procedure {
handler := &_OnewayYARPCHandler{server}
return protobuf.BuildProcedures(
protobuf.BuildProceduresParams{
ServiceName: "uber.yarpc.internal.crossdock.Oneway",
UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{},
OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{
{
MethodName: "Echo",
Handler: protobuf.NewOnewayHandler(
protobuf.OnewayHandlerParams{
Handle: handler.Echo,
NewRequest: newOnewayServiceEchoYARPCRequest,
},
),
},
},
StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
},
)
}
|
[
"func",
"BuildOnewayYARPCProcedures",
"(",
"server",
"OnewayYARPCServer",
")",
"[",
"]",
"transport",
".",
"Procedure",
"{",
"handler",
":=",
"&",
"_OnewayYARPCHandler",
"{",
"server",
"}",
"\n",
"return",
"protobuf",
".",
"BuildProcedures",
"(",
"protobuf",
".",
"BuildProceduresParams",
"{",
"ServiceName",
":",
"\"",
"\"",
",",
"UnaryHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresUnaryHandlerParams",
"{",
"}",
",",
"OnewayHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresOnewayHandlerParams",
"{",
"{",
"MethodName",
":",
"\"",
"\"",
",",
"Handler",
":",
"protobuf",
".",
"NewOnewayHandler",
"(",
"protobuf",
".",
"OnewayHandlerParams",
"{",
"Handle",
":",
"handler",
".",
"Echo",
",",
"NewRequest",
":",
"newOnewayServiceEchoYARPCRequest",
",",
"}",
",",
")",
",",
"}",
",",
"}",
",",
"StreamHandlerParams",
":",
"[",
"]",
"protobuf",
".",
"BuildProceduresStreamHandlerParams",
"{",
"}",
",",
"}",
",",
")",
"\n",
"}"
] |
// BuildOnewayYARPCProcedures prepares an implementation of the Oneway service for YARPC registration.
|
[
"BuildOnewayYARPCProcedures",
"prepares",
"an",
"implementation",
"of",
"the",
"Oneway",
"service",
"for",
"YARPC",
"registration",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/crossdockpb/crossdock.pb.yarpc.go#L238-L258
|
10,979 |
yarpc/yarpc-go
|
internal/crossdock/server/yarpc/error.go
|
BadResponse
|
func BadResponse(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error) {
// func is not serializable
result := map[string]interface{}{"foo": func() {}}
return result, nil
}
|
go
|
func BadResponse(ctx context.Context, body map[string]interface{}) (map[string]interface{}, error) {
// func is not serializable
result := map[string]interface{}{"foo": func() {}}
return result, nil
}
|
[
"func",
"BadResponse",
"(",
"ctx",
"context",
".",
"Context",
",",
"body",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"// func is not serializable",
"result",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"func",
"(",
")",
"{",
"}",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
// BadResponse returns an object that's not a valid JSON response.
|
[
"BadResponse",
"returns",
"an",
"object",
"that",
"s",
"not",
"a",
"valid",
"JSON",
"response",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/server/yarpc/error.go#L34-L38
|
10,980 |
yarpc/yarpc-go
|
internal/crossdock/server/oneway/echo.go
|
callHome
|
func (o *onewayHandler) callHome(ctx context.Context, callBackAddr string, body []byte, encoding transport.Encoding) {
// reduce the chance of a race condition
time.Sleep(time.Millisecond * 100)
if callBackAddr == "" {
panic("could not find callBackAddr in headers")
}
out := o.httpTransport.NewSingleOutbound("http://" + callBackAddr)
if err := out.Start(); err != nil {
panic(fmt.Sprintf("could not start outbound: %s", err))
}
defer out.Stop()
ctx, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()
_, err := 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))
}
}
|
go
|
func (o *onewayHandler) callHome(ctx context.Context, callBackAddr string, body []byte, encoding transport.Encoding) {
// reduce the chance of a race condition
time.Sleep(time.Millisecond * 100)
if callBackAddr == "" {
panic("could not find callBackAddr in headers")
}
out := o.httpTransport.NewSingleOutbound("http://" + callBackAddr)
if err := out.Start(); err != nil {
panic(fmt.Sprintf("could not start outbound: %s", err))
}
defer out.Stop()
ctx, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()
_, err := 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))
}
}
|
[
"func",
"(",
"o",
"*",
"onewayHandler",
")",
"callHome",
"(",
"ctx",
"context",
".",
"Context",
",",
"callBackAddr",
"string",
",",
"body",
"[",
"]",
"byte",
",",
"encoding",
"transport",
".",
"Encoding",
")",
"{",
"// reduce the chance of a race condition",
"time",
".",
"Sleep",
"(",
"time",
".",
"Millisecond",
"*",
"100",
")",
"\n\n",
"if",
"callBackAddr",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"out",
":=",
"o",
".",
"httpTransport",
".",
"NewSingleOutbound",
"(",
"\"",
"\"",
"+",
"callBackAddr",
")",
"\n",
"if",
"err",
":=",
"out",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"defer",
"out",
".",
"Stop",
"(",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"out",
".",
"CallOneway",
"(",
"ctx",
",",
"&",
"transport",
".",
"Request",
"{",
"Caller",
":",
"\"",
"\"",
",",
"Service",
":",
"\"",
"\"",
",",
"Procedure",
":",
"\"",
"\"",
",",
"Encoding",
":",
"raw",
".",
"Encoding",
",",
"Body",
":",
"bytes",
".",
"NewReader",
"(",
"body",
")",
",",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"}"
] |
// callHome extracts the call back address from headers, and makes a raw HTTP
// request using the same context and body
|
[
"callHome",
"extracts",
"the",
"call",
"back",
"address",
"from",
"headers",
"and",
"makes",
"a",
"raw",
"HTTP",
"request",
"using",
"the",
"same",
"context",
"and",
"body"
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/server/oneway/echo.go#L63-L90
|
10,981 |
yarpc/yarpc-go
|
api/middleware/router.go
|
ApplyRouteTable
|
func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable {
if m == nil {
return r
}
return routeTableWithMiddleware{r: r, m: m}
}
|
go
|
func ApplyRouteTable(r transport.RouteTable, m Router) transport.RouteTable {
if m == nil {
return r
}
return routeTableWithMiddleware{r: r, m: m}
}
|
[
"func",
"ApplyRouteTable",
"(",
"r",
"transport",
".",
"RouteTable",
",",
"m",
"Router",
")",
"transport",
".",
"RouteTable",
"{",
"if",
"m",
"==",
"nil",
"{",
"return",
"r",
"\n",
"}",
"\n",
"return",
"routeTableWithMiddleware",
"{",
"r",
":",
"r",
",",
"m",
":",
"m",
"}",
"\n",
"}"
] |
// ApplyRouteTable applies the given Router middleware to the given Router.
|
[
"ApplyRouteTable",
"applies",
"the",
"given",
"Router",
"middleware",
"to",
"the",
"given",
"Router",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/middleware/router.go#L42-L47
|
10,982 |
yarpc/yarpc-go
|
transport/http/config.go
|
TransportSpec
|
func TransportSpec(opts ...Option) yarpcconfig.TransportSpec {
var ts transportSpec
for _, o := range opts {
switch opt := o.(type) {
case TransportOption:
ts.TransportOptions = append(ts.TransportOptions, opt)
case InboundOption:
ts.InboundOptions = append(ts.InboundOptions, opt)
case OutboundOption:
ts.OutboundOptions = append(ts.OutboundOptions, opt)
default:
panic(fmt.Sprintf("unknown option of type %T: %v", o, o))
}
}
return ts.Spec()
}
|
go
|
func TransportSpec(opts ...Option) yarpcconfig.TransportSpec {
var ts transportSpec
for _, o := range opts {
switch opt := o.(type) {
case TransportOption:
ts.TransportOptions = append(ts.TransportOptions, opt)
case InboundOption:
ts.InboundOptions = append(ts.InboundOptions, opt)
case OutboundOption:
ts.OutboundOptions = append(ts.OutboundOptions, opt)
default:
panic(fmt.Sprintf("unknown option of type %T: %v", o, o))
}
}
return ts.Spec()
}
|
[
"func",
"TransportSpec",
"(",
"opts",
"...",
"Option",
")",
"yarpcconfig",
".",
"TransportSpec",
"{",
"var",
"ts",
"transportSpec",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"switch",
"opt",
":=",
"o",
".",
"(",
"type",
")",
"{",
"case",
"TransportOption",
":",
"ts",
".",
"TransportOptions",
"=",
"append",
"(",
"ts",
".",
"TransportOptions",
",",
"opt",
")",
"\n",
"case",
"InboundOption",
":",
"ts",
".",
"InboundOptions",
"=",
"append",
"(",
"ts",
".",
"InboundOptions",
",",
"opt",
")",
"\n",
"case",
"OutboundOption",
":",
"ts",
".",
"OutboundOptions",
"=",
"append",
"(",
"ts",
".",
"OutboundOptions",
",",
"opt",
")",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"o",
",",
"o",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ts",
".",
"Spec",
"(",
")",
"\n",
"}"
] |
// TransportSpec returns a TransportSpec for the HTTP transport.
//
// See TransportConfig, InboundConfig, and OutboundConfig for details on the
// different configuration parameters supported by this Transport.
//
// Any Transport, Inbound or Outbound option may be passed to this function.
// These options will be applied BEFORE configuration parameters are
// interpreted. This allows configuration parameters to override Option
// provided to TransportSpec.
|
[
"TransportSpec",
"returns",
"a",
"TransportSpec",
"for",
"the",
"HTTP",
"transport",
".",
"See",
"TransportConfig",
"InboundConfig",
"and",
"OutboundConfig",
"for",
"details",
"on",
"the",
"different",
"configuration",
"parameters",
"supported",
"by",
"this",
"Transport",
".",
"Any",
"Transport",
"Inbound",
"or",
"Outbound",
"option",
"may",
"be",
"passed",
"to",
"this",
"function",
".",
"These",
"options",
"will",
"be",
"applied",
"BEFORE",
"configuration",
"parameters",
"are",
"interpreted",
".",
"This",
"allows",
"configuration",
"parameters",
"to",
"override",
"Option",
"provided",
"to",
"TransportSpec",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/transport/http/config.go#L41-L56
|
10,983 |
yarpc/yarpc-go
|
internal/bufferpool/bufferpool.go
|
NewPool
|
func NewPool(opts ...Option) *Pool {
pool := &Pool{}
for _, opt := range opts {
opt(pool)
}
return pool
}
|
go
|
func NewPool(opts ...Option) *Pool {
pool := &Pool{}
for _, opt := range opts {
opt(pool)
}
return pool
}
|
[
"func",
"NewPool",
"(",
"opts",
"...",
"Option",
")",
"*",
"Pool",
"{",
"pool",
":=",
"&",
"Pool",
"{",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"pool",
")",
"\n",
"}",
"\n",
"return",
"pool",
"\n",
"}"
] |
// NewPool returns a pool that we can allocate buffers from.
|
[
"NewPool",
"returns",
"a",
"pool",
"that",
"we",
"can",
"allocate",
"buffers",
"from",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/bufferpool/bufferpool.go#L51-L57
|
10,984 |
yarpc/yarpc-go
|
internal/bufferpool/bufferpool.go
|
Get
|
func (p *Pool) Get() *Buffer {
buf, ok := p.pool.Get().(*Buffer)
if !ok {
buf = newBuffer(p)
} else {
buf.reuse()
}
return buf
}
|
go
|
func (p *Pool) Get() *Buffer {
buf, ok := p.pool.Get().(*Buffer)
if !ok {
buf = newBuffer(p)
} else {
buf.reuse()
}
return buf
}
|
[
"func",
"(",
"p",
"*",
"Pool",
")",
"Get",
"(",
")",
"*",
"Buffer",
"{",
"buf",
",",
"ok",
":=",
"p",
".",
"pool",
".",
"Get",
"(",
")",
".",
"(",
"*",
"Buffer",
")",
"\n",
"if",
"!",
"ok",
"{",
"buf",
"=",
"newBuffer",
"(",
"p",
")",
"\n",
"}",
"else",
"{",
"buf",
".",
"reuse",
"(",
")",
"\n",
"}",
"\n",
"return",
"buf",
"\n",
"}"
] |
// Get returns a buffer from the pool.
|
[
"Get",
"returns",
"a",
"buffer",
"from",
"the",
"pool",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/bufferpool/bufferpool.go#L68-L76
|
10,985 |
yarpc/yarpc-go
|
api/encoding/call_option.go
|
ResponseHeaders
|
func ResponseHeaders(h *map[string]string) CallOption {
return CallOption{func(o *OutboundCall) { o.responseHeaders = h }}
}
|
go
|
func ResponseHeaders(h *map[string]string) CallOption {
return CallOption{func(o *OutboundCall) { o.responseHeaders = h }}
}
|
[
"func",
"ResponseHeaders",
"(",
"h",
"*",
"map",
"[",
"string",
"]",
"string",
")",
"CallOption",
"{",
"return",
"CallOption",
"{",
"func",
"(",
"o",
"*",
"OutboundCall",
")",
"{",
"o",
".",
"responseHeaders",
"=",
"h",
"}",
"}",
"\n",
"}"
] |
// ResponseHeaders specifies that headers received in response to this request
// should replace the given map.
|
[
"ResponseHeaders",
"specifies",
"that",
"headers",
"received",
"in",
"response",
"to",
"this",
"request",
"should",
"replace",
"the",
"given",
"map",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/call_option.go#L33-L35
|
10,986 |
yarpc/yarpc-go
|
api/encoding/call_option.go
|
WithHeader
|
func WithHeader(k, v string) CallOption {
return CallOption{func(o *OutboundCall) {
o.headers = append(o.headers, keyValuePair{k: k, v: v})
}}
}
|
go
|
func WithHeader(k, v string) CallOption {
return CallOption{func(o *OutboundCall) {
o.headers = append(o.headers, keyValuePair{k: k, v: v})
}}
}
|
[
"func",
"WithHeader",
"(",
"k",
",",
"v",
"string",
")",
"CallOption",
"{",
"return",
"CallOption",
"{",
"func",
"(",
"o",
"*",
"OutboundCall",
")",
"{",
"o",
".",
"headers",
"=",
"append",
"(",
"o",
".",
"headers",
",",
"keyValuePair",
"{",
"k",
":",
"k",
",",
"v",
":",
"v",
"}",
")",
"\n",
"}",
"}",
"\n",
"}"
] |
// WithHeader adds a new header to the request.
|
[
"WithHeader",
"adds",
"a",
"new",
"header",
"to",
"the",
"request",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/call_option.go#L38-L42
|
10,987 |
yarpc/yarpc-go
|
api/encoding/call_option.go
|
WithShardKey
|
func WithShardKey(sk string) CallOption {
return CallOption{func(o *OutboundCall) { o.shardKey = &sk }}
}
|
go
|
func WithShardKey(sk string) CallOption {
return CallOption{func(o *OutboundCall) { o.shardKey = &sk }}
}
|
[
"func",
"WithShardKey",
"(",
"sk",
"string",
")",
"CallOption",
"{",
"return",
"CallOption",
"{",
"func",
"(",
"o",
"*",
"OutboundCall",
")",
"{",
"o",
".",
"shardKey",
"=",
"&",
"sk",
"}",
"}",
"\n",
"}"
] |
// WithShardKey sets the shard key for the request.
|
[
"WithShardKey",
"sets",
"the",
"shard",
"key",
"for",
"the",
"request",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/call_option.go#L45-L47
|
10,988 |
yarpc/yarpc-go
|
api/encoding/call_option.go
|
WithRoutingKey
|
func WithRoutingKey(rk string) CallOption {
return CallOption{func(o *OutboundCall) { o.routingKey = &rk }}
}
|
go
|
func WithRoutingKey(rk string) CallOption {
return CallOption{func(o *OutboundCall) { o.routingKey = &rk }}
}
|
[
"func",
"WithRoutingKey",
"(",
"rk",
"string",
")",
"CallOption",
"{",
"return",
"CallOption",
"{",
"func",
"(",
"o",
"*",
"OutboundCall",
")",
"{",
"o",
".",
"routingKey",
"=",
"&",
"rk",
"}",
"}",
"\n",
"}"
] |
// WithRoutingKey sets the routing key for the request.
|
[
"WithRoutingKey",
"sets",
"the",
"routing",
"key",
"for",
"the",
"request",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/call_option.go#L50-L52
|
10,989 |
yarpc/yarpc-go
|
api/encoding/call_option.go
|
WithRoutingDelegate
|
func WithRoutingDelegate(rd string) CallOption {
return CallOption{func(o *OutboundCall) { o.routingDelegate = &rd }}
}
|
go
|
func WithRoutingDelegate(rd string) CallOption {
return CallOption{func(o *OutboundCall) { o.routingDelegate = &rd }}
}
|
[
"func",
"WithRoutingDelegate",
"(",
"rd",
"string",
")",
"CallOption",
"{",
"return",
"CallOption",
"{",
"func",
"(",
"o",
"*",
"OutboundCall",
")",
"{",
"o",
".",
"routingDelegate",
"=",
"&",
"rd",
"}",
"}",
"\n",
"}"
] |
// WithRoutingDelegate sets the routing delegate for the request.
|
[
"WithRoutingDelegate",
"sets",
"the",
"routing",
"delegate",
"for",
"the",
"request",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/api/encoding/call_option.go#L55-L57
|
10,990 |
yarpc/yarpc-go
|
internal/crossdock/client/echo/json.go
|
JSONForTransport
|
func JSONForTransport(t crossdock.T, transport string) {
t = createEchoT("json", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := json.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
var response 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)
}
|
go
|
func JSONForTransport(t crossdock.T, transport string) {
t = createEchoT("json", transport, t)
fatals := crossdock.Fatals(t)
dispatcher := disp.CreateDispatcherForTransport(t, transport)
fatals.NoError(dispatcher.Start(), "could not start Dispatcher")
defer dispatcher.Stop()
client := json.New(dispatcher.ClientConfig("yarpc-test"))
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
var response 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)
}
|
[
"func",
"JSONForTransport",
"(",
"t",
"crossdock",
".",
"T",
",",
"transport",
"string",
")",
"{",
"t",
"=",
"createEchoT",
"(",
"\"",
"\"",
",",
"transport",
",",
"t",
")",
"\n",
"fatals",
":=",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
"\n\n",
"dispatcher",
":=",
"disp",
".",
"CreateDispatcherForTransport",
"(",
"t",
",",
"transport",
")",
"\n",
"fatals",
".",
"NoError",
"(",
"dispatcher",
".",
"Start",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"defer",
"dispatcher",
".",
"Stop",
"(",
")",
"\n\n",
"client",
":=",
"json",
".",
"New",
"(",
"dispatcher",
".",
"ClientConfig",
"(",
"\"",
"\"",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"var",
"response",
"jsonEcho",
"\n",
"token",
":=",
"random",
".",
"String",
"(",
"5",
")",
"\n",
"err",
":=",
"client",
".",
"Call",
"(",
"ctx",
",",
"\"",
"\"",
",",
"&",
"jsonEcho",
"{",
"Token",
":",
"token",
"}",
",",
"&",
"response",
")",
"\n",
"crossdock",
".",
"Fatals",
"(",
"t",
")",
".",
"NoError",
"(",
"err",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"crossdock",
".",
"Assert",
"(",
"t",
")",
".",
"Equal",
"(",
"token",
",",
"response",
".",
"Token",
",",
"\"",
"\"",
",",
"response",
".",
"Token",
")",
"\n",
"}"
] |
// JSONForTransport implements the 'json' behavior for the given transport or behavior transport.
|
[
"JSONForTransport",
"implements",
"the",
"json",
"behavior",
"for",
"the",
"given",
"transport",
"or",
"behavior",
"transport",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/crossdock/client/echo/json.go#L44-L61
|
10,991 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/hello_sink.go
|
String
|
func (v *Hello_Sink_Args) String() string {
if v == nil {
return "<nil>"
}
var fields [1]string
i := 0
if v.Snk != nil {
fields[i] = fmt.Sprintf("Snk: %v", v.Snk)
i++
}
return fmt.Sprintf("Hello_Sink_Args{%v}", strings.Join(fields[:i], ", "))
}
|
go
|
func (v *Hello_Sink_Args) String() string {
if v == nil {
return "<nil>"
}
var fields [1]string
i := 0
if v.Snk != nil {
fields[i] = fmt.Sprintf("Snk: %v", v.Snk)
i++
}
return fmt.Sprintf("Hello_Sink_Args{%v}", strings.Join(fields[:i], ", "))
}
|
[
"func",
"(",
"v",
"*",
"Hello_Sink_Args",
")",
"String",
"(",
")",
"string",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"fields",
"[",
"1",
"]",
"string",
"\n",
"i",
":=",
"0",
"\n",
"if",
"v",
".",
"Snk",
"!=",
"nil",
"{",
"fields",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Snk",
")",
"\n",
"i",
"++",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fields",
"[",
":",
"i",
"]",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
// String returns a readable string representation of a Hello_Sink_Args
// struct.
|
[
"String",
"returns",
"a",
"readable",
"string",
"representation",
"of",
"a",
"Hello_Sink_Args",
"struct",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/hello_sink.go#L120-L133
|
10,992 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/hello_sink.go
|
Equals
|
func (v *Hello_Sink_Args) Equals(rhs *Hello_Sink_Args) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !((v.Snk == nil && rhs.Snk == nil) || (v.Snk != nil && rhs.Snk != nil && v.Snk.Equals(rhs.Snk))) {
return false
}
return true
}
|
go
|
func (v *Hello_Sink_Args) Equals(rhs *Hello_Sink_Args) bool {
if v == nil {
return rhs == nil
} else if rhs == nil {
return false
}
if !((v.Snk == nil && rhs.Snk == nil) || (v.Snk != nil && rhs.Snk != nil && v.Snk.Equals(rhs.Snk))) {
return false
}
return true
}
|
[
"func",
"(",
"v",
"*",
"Hello_Sink_Args",
")",
"Equals",
"(",
"rhs",
"*",
"Hello_Sink_Args",
")",
"bool",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"rhs",
"==",
"nil",
"\n",
"}",
"else",
"if",
"rhs",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"(",
"(",
"v",
".",
"Snk",
"==",
"nil",
"&&",
"rhs",
".",
"Snk",
"==",
"nil",
")",
"||",
"(",
"v",
".",
"Snk",
"!=",
"nil",
"&&",
"rhs",
".",
"Snk",
"!=",
"nil",
"&&",
"v",
".",
"Snk",
".",
"Equals",
"(",
"rhs",
".",
"Snk",
")",
")",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
// Equals returns true if all the fields of this Hello_Sink_Args match the
// provided Hello_Sink_Args.
//
// This function performs a deep comparison.
|
[
"Equals",
"returns",
"true",
"if",
"all",
"the",
"fields",
"of",
"this",
"Hello_Sink_Args",
"match",
"the",
"provided",
"Hello_Sink_Args",
".",
"This",
"function",
"performs",
"a",
"deep",
"comparison",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/hello_sink.go#L139-L150
|
10,993 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/hello_sink.go
|
MarshalLogObject
|
func (v *Hello_Sink_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
if v.Snk != nil {
err = multierr.Append(err, enc.AddObject("snk", v.Snk))
}
return err
}
|
go
|
func (v *Hello_Sink_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
if v == nil {
return nil
}
if v.Snk != nil {
err = multierr.Append(err, enc.AddObject("snk", v.Snk))
}
return err
}
|
[
"func",
"(",
"v",
"*",
"Hello_Sink_Args",
")",
"MarshalLogObject",
"(",
"enc",
"zapcore",
".",
"ObjectEncoder",
")",
"(",
"err",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"v",
".",
"Snk",
"!=",
"nil",
"{",
"err",
"=",
"multierr",
".",
"Append",
"(",
"err",
",",
"enc",
".",
"AddObject",
"(",
"\"",
"\"",
",",
"v",
".",
"Snk",
")",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of Hello_Sink_Args.
|
[
"MarshalLogObject",
"implements",
"zapcore",
".",
"ObjectMarshaler",
"enabling",
"fast",
"logging",
"of",
"Hello_Sink_Args",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/hello_sink.go#L154-L162
|
10,994 |
yarpc/yarpc-go
|
internal/examples/thrift-oneway/sink/hello_sink.go
|
GetSnk
|
func (v *Hello_Sink_Args) GetSnk() (o *SinkRequest) {
if v != nil && v.Snk != nil {
return v.Snk
}
return
}
|
go
|
func (v *Hello_Sink_Args) GetSnk() (o *SinkRequest) {
if v != nil && v.Snk != nil {
return v.Snk
}
return
}
|
[
"func",
"(",
"v",
"*",
"Hello_Sink_Args",
")",
"GetSnk",
"(",
")",
"(",
"o",
"*",
"SinkRequest",
")",
"{",
"if",
"v",
"!=",
"nil",
"&&",
"v",
".",
"Snk",
"!=",
"nil",
"{",
"return",
"v",
".",
"Snk",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
// GetSnk returns the value of Snk if it is set or its
// zero value if it is unset.
|
[
"GetSnk",
"returns",
"the",
"value",
"of",
"Snk",
"if",
"it",
"is",
"set",
"or",
"its",
"zero",
"value",
"if",
"it",
"is",
"unset",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/examples/thrift-oneway/sink/hello_sink.go#L166-L172
|
10,995 |
yarpc/yarpc-go
|
internal/config/attributemap.go
|
PopString
|
func (m AttributeMap) PopString(name string) (string, error) {
var s string
_, err := m.Pop(name, &s)
return s, err
}
|
go
|
func (m AttributeMap) PopString(name string) (string, error) {
var s string
_, err := m.Pop(name, &s)
return s, err
}
|
[
"func",
"(",
"m",
"AttributeMap",
")",
"PopString",
"(",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"s",
"string",
"\n",
"_",
",",
"err",
":=",
"m",
".",
"Pop",
"(",
"name",
",",
"&",
"s",
")",
"\n",
"return",
"s",
",",
"err",
"\n",
"}"
] |
// PopString will pop a value from the attribute map and return the string
// it points to, or an error if it couldn't pop the value and decode.
|
[
"PopString",
"will",
"pop",
"a",
"value",
"from",
"the",
"attribute",
"map",
"and",
"return",
"the",
"string",
"it",
"points",
"to",
"or",
"an",
"error",
"if",
"it",
"couldn",
"t",
"pop",
"the",
"value",
"and",
"decode",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/config/attributemap.go#L35-L39
|
10,996 |
yarpc/yarpc-go
|
internal/config/attributemap.go
|
PopBool
|
func (m AttributeMap) PopBool(name string) (bool, error) {
var b bool
_, err := m.Pop(name, &b)
return b, err
}
|
go
|
func (m AttributeMap) PopBool(name string) (bool, error) {
var b bool
_, err := m.Pop(name, &b)
return b, err
}
|
[
"func",
"(",
"m",
"AttributeMap",
")",
"PopBool",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"b",
"bool",
"\n",
"_",
",",
"err",
":=",
"m",
".",
"Pop",
"(",
"name",
",",
"&",
"b",
")",
"\n",
"return",
"b",
",",
"err",
"\n",
"}"
] |
// PopBool will pop a value from the attribute map and return the bool
// it points to, or an error if it couldn't pop the value and decode.
|
[
"PopBool",
"will",
"pop",
"a",
"value",
"from",
"the",
"attribute",
"map",
"and",
"return",
"the",
"bool",
"it",
"points",
"to",
"or",
"an",
"error",
"if",
"it",
"couldn",
"t",
"pop",
"the",
"value",
"and",
"decode",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/config/attributemap.go#L43-L47
|
10,997 |
yarpc/yarpc-go
|
internal/config/attributemap.go
|
Pop
|
func (m AttributeMap) Pop(name string, dst interface{}, opts ...mapdecode.Option) (bool, error) {
ok, err := m.Get(name, dst, opts...)
if ok {
delete(m, name)
}
return ok, err
}
|
go
|
func (m AttributeMap) Pop(name string, dst interface{}, opts ...mapdecode.Option) (bool, error) {
ok, err := m.Get(name, dst, opts...)
if ok {
delete(m, name)
}
return ok, err
}
|
[
"func",
"(",
"m",
"AttributeMap",
")",
"Pop",
"(",
"name",
"string",
",",
"dst",
"interface",
"{",
"}",
",",
"opts",
"...",
"mapdecode",
".",
"Option",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ok",
",",
"err",
":=",
"m",
".",
"Get",
"(",
"name",
",",
"dst",
",",
"opts",
"...",
")",
"\n",
"if",
"ok",
"{",
"delete",
"(",
"m",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"ok",
",",
"err",
"\n",
"}"
] |
// Pop removes the named key from the AttributeMap and decodes the value into
// the dst interface.
|
[
"Pop",
"removes",
"the",
"named",
"key",
"from",
"the",
"AttributeMap",
"and",
"decodes",
"the",
"value",
"into",
"the",
"dst",
"interface",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/config/attributemap.go#L51-L57
|
10,998 |
yarpc/yarpc-go
|
internal/config/attributemap.go
|
Get
|
func (m AttributeMap) Get(name string, dst interface{}, opts ...mapdecode.Option) (bool, error) {
v, ok := m[name]
if !ok {
return ok, nil
}
err := DecodeInto(dst, v, opts...)
if err != nil {
err = fmt.Errorf("failed to read attribute %q: %v. got error: %s", name, v, err)
}
return true, err
}
|
go
|
func (m AttributeMap) Get(name string, dst interface{}, opts ...mapdecode.Option) (bool, error) {
v, ok := m[name]
if !ok {
return ok, nil
}
err := DecodeInto(dst, v, opts...)
if err != nil {
err = fmt.Errorf("failed to read attribute %q: %v. got error: %s", name, v, err)
}
return true, err
}
|
[
"func",
"(",
"m",
"AttributeMap",
")",
"Get",
"(",
"name",
"string",
",",
"dst",
"interface",
"{",
"}",
",",
"opts",
"...",
"mapdecode",
".",
"Option",
")",
"(",
"bool",
",",
"error",
")",
"{",
"v",
",",
"ok",
":=",
"m",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"ok",
",",
"nil",
"\n",
"}",
"\n\n",
"err",
":=",
"DecodeInto",
"(",
"dst",
",",
"v",
",",
"opts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"v",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"true",
",",
"err",
"\n",
"}"
] |
// Get grabs a value from the attribute map and decodes it into the dst
// interface.
|
[
"Get",
"grabs",
"a",
"value",
"from",
"the",
"attribute",
"map",
"and",
"decodes",
"it",
"into",
"the",
"dst",
"interface",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/config/attributemap.go#L61-L72
|
10,999 |
yarpc/yarpc-go
|
internal/config/attributemap.go
|
Keys
|
func (m AttributeMap) Keys() []string {
keys := make([]string, 0, len(m))
for key := range m {
keys = append(keys, key)
}
return keys
}
|
go
|
func (m AttributeMap) Keys() []string {
keys := make([]string, 0, len(m))
for key := range m {
keys = append(keys, key)
}
return keys
}
|
[
"func",
"(",
"m",
"AttributeMap",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"m",
")",
")",
"\n",
"for",
"key",
":=",
"range",
"m",
"{",
"keys",
"=",
"append",
"(",
"keys",
",",
"key",
")",
"\n",
"}",
"\n",
"return",
"keys",
"\n",
"}"
] |
// Keys returns all the keys of the attribute map.
|
[
"Keys",
"returns",
"all",
"the",
"keys",
"of",
"the",
"attribute",
"map",
"."
] |
bd70ffbd17e635243988ba62be97eebff738204d
|
https://github.com/yarpc/yarpc-go/blob/bd70ffbd17e635243988ba62be97eebff738204d/internal/config/attributemap.go#L75-L81
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.