repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
uber/tchannel-go
peer.go
BeginCall
func (p *Peer) BeginCall(ctx context.Context, serviceName, methodName string, callOptions *CallOptions) (*OutboundCall, error) { if callOptions == nil { callOptions = defaultCallOptions } callOptions.RequestState.AddSelectedPeer(p.HostPort()) if err := validateCall(ctx, serviceName, methodName, callOptions); err...
go
func (p *Peer) BeginCall(ctx context.Context, serviceName, methodName string, callOptions *CallOptions) (*OutboundCall, error) { if callOptions == nil { callOptions = defaultCallOptions } callOptions.RequestState.AddSelectedPeer(p.HostPort()) if err := validateCall(ctx, serviceName, methodName, callOptions); err...
[ "func", "(", "p", "*", "Peer", ")", "BeginCall", "(", "ctx", "context", ".", "Context", ",", "serviceName", ",", "methodName", "string", ",", "callOptions", "*", "CallOptions", ")", "(", "*", "OutboundCall", ",", "error", ")", "{", "if", "callOptions", "...
// BeginCall starts a new call to this specific peer, returning an OutboundCall that can // be used to write the arguments of the call.
[ "BeginCall", "starts", "a", "new", "call", "to", "this", "specific", "peer", "returning", "an", "OutboundCall", "that", "can", "be", "used", "to", "write", "the", "arguments", "of", "the", "call", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L540-L561
test
uber/tchannel-go
peer.go
NumConnections
func (p *Peer) NumConnections() (inbound int, outbound int) { p.RLock() inbound = len(p.inboundConnections) outbound = len(p.outboundConnections) p.RUnlock() return inbound, outbound }
go
func (p *Peer) NumConnections() (inbound int, outbound int) { p.RLock() inbound = len(p.inboundConnections) outbound = len(p.outboundConnections) p.RUnlock() return inbound, outbound }
[ "func", "(", "p", "*", "Peer", ")", "NumConnections", "(", ")", "(", "inbound", "int", ",", "outbound", "int", ")", "{", "p", ".", "RLock", "(", ")", "\n", "inbound", "=", "len", "(", "p", ".", "inboundConnections", ")", "\n", "outbound", "=", "len...
// NumConnections returns the number of inbound and outbound connections for this peer.
[ "NumConnections", "returns", "the", "number", "of", "inbound", "and", "outbound", "connections", "for", "this", "peer", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L564-L570
test
uber/tchannel-go
peer.go
NumPendingOutbound
func (p *Peer) NumPendingOutbound() int { count := 0 p.RLock() for _, c := range p.outboundConnections { count += c.outbound.count() } for _, c := range p.inboundConnections { count += c.outbound.count() } p.RUnlock() return count }
go
func (p *Peer) NumPendingOutbound() int { count := 0 p.RLock() for _, c := range p.outboundConnections { count += c.outbound.count() } for _, c := range p.inboundConnections { count += c.outbound.count() } p.RUnlock() return count }
[ "func", "(", "p", "*", "Peer", ")", "NumPendingOutbound", "(", ")", "int", "{", "count", ":=", "0", "\n", "p", ".", "RLock", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "p", ".", "outboundConnections", "{", "count", "+=", "c", ".", "outb...
// NumPendingOutbound returns the number of pending outbound calls.
[ "NumPendingOutbound", "returns", "the", "number", "of", "pending", "outbound", "calls", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L573-L585
test
uber/tchannel-go
peer.go
isEphemeralHostPort
func isEphemeralHostPort(hostPort string) bool { return hostPort == "" || hostPort == ephemeralHostPort || strings.HasSuffix(hostPort, ":0") }
go
func isEphemeralHostPort(hostPort string) bool { return hostPort == "" || hostPort == ephemeralHostPort || strings.HasSuffix(hostPort, ":0") }
[ "func", "isEphemeralHostPort", "(", "hostPort", "string", ")", "bool", "{", "return", "hostPort", "==", "\"\"", "||", "hostPort", "==", "ephemeralHostPort", "||", "strings", ".", "HasSuffix", "(", "hostPort", ",", "\":0\"", ")", "\n", "}" ]
// isEphemeralHostPort returns if hostPort is the default ephemeral hostPort.
[ "isEphemeralHostPort", "returns", "if", "hostPort", "is", "the", "default", "ephemeral", "hostPort", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/peer.go#L612-L614
test
uber/tchannel-go
examples/keyvalue/server/server.go
Get
func (h *kvHandler) Get(ctx thrift.Context, key string) (string, error) { if err := isValidKey(key); err != nil { return "", err } h.RLock() defer h.RUnlock() if val, ok := h.vals[key]; ok { return val, nil } return "", &keyvalue.KeyNotFound{Key: key} }
go
func (h *kvHandler) Get(ctx thrift.Context, key string) (string, error) { if err := isValidKey(key); err != nil { return "", err } h.RLock() defer h.RUnlock() if val, ok := h.vals[key]; ok { return val, nil } return "", &keyvalue.KeyNotFound{Key: key} }
[ "func", "(", "h", "*", "kvHandler", ")", "Get", "(", "ctx", "thrift", ".", "Context", ",", "key", "string", ")", "(", "string", ",", "error", ")", "{", "if", "err", ":=", "isValidKey", "(", "key", ")", ";", "err", "!=", "nil", "{", "return", "\"\...
// Get returns the value stored for the given key.
[ "Get", "returns", "the", "value", "stored", "for", "the", "given", "key", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/examples/keyvalue/server/server.go#L91-L104
test
uber/tchannel-go
examples/keyvalue/server/server.go
Set
func (h *kvHandler) Set(ctx thrift.Context, key, value string) error { if err := isValidKey(key); err != nil { return err } h.Lock() defer h.Unlock() h.vals[key] = value // Example of how to use response headers. Normally, these values should be passed via result structs. ctx.SetResponseHeaders(map[string]st...
go
func (h *kvHandler) Set(ctx thrift.Context, key, value string) error { if err := isValidKey(key); err != nil { return err } h.Lock() defer h.Unlock() h.vals[key] = value // Example of how to use response headers. Normally, these values should be passed via result structs. ctx.SetResponseHeaders(map[string]st...
[ "func", "(", "h", "*", "kvHandler", ")", "Set", "(", "ctx", "thrift", ".", "Context", ",", "key", ",", "value", "string", ")", "error", "{", "if", "err", ":=", "isValidKey", "(", "key", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}...
// Set sets the value for a given key.
[ "Set", "sets", "the", "value", "for", "a", "given", "key", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/examples/keyvalue/server/server.go#L107-L119
test
uber/tchannel-go
examples/keyvalue/server/server.go
ClearAll
func (h *kvHandler) ClearAll(ctx thrift.Context) error { if !isAdmin(ctx) { return &keyvalue.NotAuthorized{} } h.Lock() defer h.Unlock() h.vals = make(map[string]string) return nil }
go
func (h *kvHandler) ClearAll(ctx thrift.Context) error { if !isAdmin(ctx) { return &keyvalue.NotAuthorized{} } h.Lock() defer h.Unlock() h.vals = make(map[string]string) return nil }
[ "func", "(", "h", "*", "kvHandler", ")", "ClearAll", "(", "ctx", "thrift", ".", "Context", ")", "error", "{", "if", "!", "isAdmin", "(", "ctx", ")", "{", "return", "&", "keyvalue", ".", "NotAuthorized", "{", "}", "\n", "}", "\n", "h", ".", "Lock", ...
// ClearAll clears all the keys.
[ "ClearAll", "clears", "all", "the", "keys", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/examples/keyvalue/server/server.go#L127-L137
test
uber/tchannel-go
channel.go
NewChannel
func NewChannel(serviceName string, opts *ChannelOptions) (*Channel, error) { if serviceName == "" { return nil, ErrNoServiceName } if opts == nil { opts = &ChannelOptions{} } processName := opts.ProcessName if processName == "" { processName = fmt.Sprintf("%s[%d]", filepath.Base(os.Args[0]), os.Getpid())...
go
func NewChannel(serviceName string, opts *ChannelOptions) (*Channel, error) { if serviceName == "" { return nil, ErrNoServiceName } if opts == nil { opts = &ChannelOptions{} } processName := opts.ProcessName if processName == "" { processName = fmt.Sprintf("%s[%d]", filepath.Base(os.Args[0]), os.Getpid())...
[ "func", "NewChannel", "(", "serviceName", "string", ",", "opts", "*", "ChannelOptions", ")", "(", "*", "Channel", ",", "error", ")", "{", "if", "serviceName", "==", "\"\"", "{", "return", "nil", ",", "ErrNoServiceName", "\n", "}", "\n", "if", "opts", "==...
// NewChannel creates a new Channel. The new channel can be used to send outbound requests // to peers, but will not listen or handling incoming requests until one of ListenAndServe // or Serve is called. The local service name should be passed to serviceName.
[ "NewChannel", "creates", "a", "new", "Channel", ".", "The", "new", "channel", "can", "be", "used", "to", "send", "outbound", "requests", "to", "peers", "but", "will", "not", "listen", "or", "handling", "incoming", "requests", "until", "one", "of", "ListenAnd...
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L201-L304
test
uber/tchannel-go
channel.go
Serve
func (ch *Channel) Serve(l net.Listener) error { mutable := &ch.mutable mutable.Lock() defer mutable.Unlock() if mutable.l != nil { return errAlreadyListening } mutable.l = tnet.Wrap(l) if mutable.state != ChannelClient { return errInvalidStateForOp } mutable.state = ChannelListening mutable.peerInfo.H...
go
func (ch *Channel) Serve(l net.Listener) error { mutable := &ch.mutable mutable.Lock() defer mutable.Unlock() if mutable.l != nil { return errAlreadyListening } mutable.l = tnet.Wrap(l) if mutable.state != ChannelClient { return errInvalidStateForOp } mutable.state = ChannelListening mutable.peerInfo.H...
[ "func", "(", "ch", "*", "Channel", ")", "Serve", "(", "l", "net", ".", "Listener", ")", "error", "{", "mutable", ":=", "&", "ch", ".", "mutable", "\n", "mutable", ".", "Lock", "(", ")", "\n", "defer", "mutable", ".", "Unlock", "(", ")", "\n", "if...
// Serve serves incoming requests using the provided listener. // The local peer info is set synchronously, but the actual socket listening is done in // a separate goroutine.
[ "Serve", "serves", "incoming", "requests", "using", "the", "provided", "listener", ".", "The", "local", "peer", "info", "is", "set", "synchronously", "but", "the", "actual", "socket", "listening", "is", "done", "in", "a", "separate", "goroutine", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L314-L335
test
uber/tchannel-go
channel.go
ListenAndServe
func (ch *Channel) ListenAndServe(hostPort string) error { mutable := &ch.mutable mutable.RLock() if mutable.l != nil { mutable.RUnlock() return errAlreadyListening } l, err := net.Listen("tcp", hostPort) if err != nil { mutable.RUnlock() return err } mutable.RUnlock() return ch.Serve(l) }
go
func (ch *Channel) ListenAndServe(hostPort string) error { mutable := &ch.mutable mutable.RLock() if mutable.l != nil { mutable.RUnlock() return errAlreadyListening } l, err := net.Listen("tcp", hostPort) if err != nil { mutable.RUnlock() return err } mutable.RUnlock() return ch.Serve(l) }
[ "func", "(", "ch", "*", "Channel", ")", "ListenAndServe", "(", "hostPort", "string", ")", "error", "{", "mutable", ":=", "&", "ch", ".", "mutable", "\n", "mutable", ".", "RLock", "(", ")", "\n", "if", "mutable", ".", "l", "!=", "nil", "{", "mutable",...
// ListenAndServe listens on the given address and serves incoming requests. // The port may be 0, in which case the channel will use an OS assigned port // This method does not block as the handling of connections is done in a goroutine.
[ "ListenAndServe", "listens", "on", "the", "given", "address", "and", "serves", "incoming", "requests", ".", "The", "port", "may", "be", "0", "in", "which", "case", "the", "channel", "will", "use", "an", "OS", "assigned", "port", "This", "method", "does", "...
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L340-L357
test
uber/tchannel-go
channel.go
Register
func (ch *Channel) Register(h Handler, methodName string) { if _, ok := ch.handler.(channelHandler); !ok { panic("can't register handler when channel configured with alternate root handler") } ch.GetSubChannel(ch.PeerInfo().ServiceName).Register(h, methodName) }
go
func (ch *Channel) Register(h Handler, methodName string) { if _, ok := ch.handler.(channelHandler); !ok { panic("can't register handler when channel configured with alternate root handler") } ch.GetSubChannel(ch.PeerInfo().ServiceName).Register(h, methodName) }
[ "func", "(", "ch", "*", "Channel", ")", "Register", "(", "h", "Handler", ",", "methodName", "string", ")", "{", "if", "_", ",", "ok", ":=", "ch", ".", "handler", ".", "(", "channelHandler", ")", ";", "!", "ok", "{", "panic", "(", "\"can't register ha...
// Register registers a handler for a method. // // The handler is registered with the service name used when the Channel was // created. To register a handler with a different service name, obtain a // SubChannel for that service with GetSubChannel, and Register a handler // under that. You may also use SetHandler on ...
[ "Register", "registers", "a", "handler", "for", "a", "method", ".", "The", "handler", "is", "registered", "with", "the", "service", "name", "used", "when", "the", "Channel", "was", "created", ".", "To", "register", "a", "handler", "with", "a", "different", ...
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L392-L397
test
uber/tchannel-go
channel.go
PeerInfo
func (ch *Channel) PeerInfo() LocalPeerInfo { ch.mutable.RLock() peerInfo := ch.mutable.peerInfo ch.mutable.RUnlock() return peerInfo }
go
func (ch *Channel) PeerInfo() LocalPeerInfo { ch.mutable.RLock() peerInfo := ch.mutable.peerInfo ch.mutable.RUnlock() return peerInfo }
[ "func", "(", "ch", "*", "Channel", ")", "PeerInfo", "(", ")", "LocalPeerInfo", "{", "ch", ".", "mutable", ".", "RLock", "(", ")", "\n", "peerInfo", ":=", "ch", ".", "mutable", ".", "peerInfo", "\n", "ch", ".", "mutable", ".", "RUnlock", "(", ")", "...
// PeerInfo returns the current peer info for the channel
[ "PeerInfo", "returns", "the", "current", "peer", "info", "for", "the", "channel" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L400-L406
test
uber/tchannel-go
channel.go
GetSubChannel
func (ch *Channel) GetSubChannel(serviceName string, opts ...SubChannelOption) *SubChannel { sub, added := ch.subChannels.getOrAdd(serviceName, ch) if added { for _, opt := range opts { opt(sub) } } return sub }
go
func (ch *Channel) GetSubChannel(serviceName string, opts ...SubChannelOption) *SubChannel { sub, added := ch.subChannels.getOrAdd(serviceName, ch) if added { for _, opt := range opts { opt(sub) } } return sub }
[ "func", "(", "ch", "*", "Channel", ")", "GetSubChannel", "(", "serviceName", "string", ",", "opts", "...", "SubChannelOption", ")", "*", "SubChannel", "{", "sub", ",", "added", ":=", "ch", ".", "subChannels", ".", "getOrAdd", "(", "serviceName", ",", "ch",...
// GetSubChannel returns a SubChannel for the given service name. If the subchannel does not // exist, it is created.
[ "GetSubChannel", "returns", "a", "SubChannel", "for", "the", "given", "service", "name", ".", "If", "the", "subchannel", "does", "not", "exist", "it", "is", "created", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L424-L432
test
uber/tchannel-go
channel.go
serve
func (ch *Channel) serve() { acceptBackoff := 0 * time.Millisecond for { netConn, err := ch.mutable.l.Accept() if err != nil { // Backoff from new accepts if this is a temporary error if ne, ok := err.(net.Error); ok && ne.Temporary() { if acceptBackoff == 0 { acceptBackoff = 5 * time.Millisecond ...
go
func (ch *Channel) serve() { acceptBackoff := 0 * time.Millisecond for { netConn, err := ch.mutable.l.Accept() if err != nil { // Backoff from new accepts if this is a temporary error if ne, ok := err.(net.Error); ok && ne.Temporary() { if acceptBackoff == 0 { acceptBackoff = 5 * time.Millisecond ...
[ "func", "(", "ch", "*", "Channel", ")", "serve", "(", ")", "{", "acceptBackoff", ":=", "0", "*", "time", ".", "Millisecond", "\n", "for", "{", "netConn", ",", "err", ":=", "ch", ".", "mutable", ".", "l", ".", "Accept", "(", ")", "\n", "if", "err"...
// serve runs the listener to accept and manage new incoming connections, blocking // until the channel is closed.
[ "serve", "runs", "the", "listener", "to", "accept", "and", "manage", "new", "incoming", "connections", "blocking", "until", "the", "channel", "is", "closed", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L456-L503
test
uber/tchannel-go
channel.go
Ping
func (ch *Channel) Ping(ctx context.Context, hostPort string) error { peer := ch.RootPeers().GetOrAdd(hostPort) conn, err := peer.GetConnection(ctx) if err != nil { return err } return conn.ping(ctx) }
go
func (ch *Channel) Ping(ctx context.Context, hostPort string) error { peer := ch.RootPeers().GetOrAdd(hostPort) conn, err := peer.GetConnection(ctx) if err != nil { return err } return conn.ping(ctx) }
[ "func", "(", "ch", "*", "Channel", ")", "Ping", "(", "ctx", "context", ".", "Context", ",", "hostPort", "string", ")", "error", "{", "peer", ":=", "ch", ".", "RootPeers", "(", ")", ".", "GetOrAdd", "(", "hostPort", ")", "\n", "conn", ",", "err", ":...
// Ping sends a ping message to the given hostPort and waits for a response.
[ "Ping", "sends", "a", "ping", "message", "to", "the", "given", "hostPort", "and", "waits", "for", "a", "response", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L506-L514
test
uber/tchannel-go
channel.go
StatsTags
func (ch *Channel) StatsTags() map[string]string { m := make(map[string]string) for k, v := range ch.commonStatsTags { m[k] = v } return m }
go
func (ch *Channel) StatsTags() map[string]string { m := make(map[string]string) for k, v := range ch.commonStatsTags { m[k] = v } return m }
[ "func", "(", "ch", "*", "Channel", ")", "StatsTags", "(", ")", "map", "[", "string", "]", "string", "{", "m", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "for", "k", ",", "v", ":=", "range", "ch", ".", "commonStatsTags", "{...
// StatsTags returns the common tags that should be used when reporting stats. // It returns a new map for each call.
[ "StatsTags", "returns", "the", "common", "tags", "that", "should", "be", "used", "when", "reporting", "stats", ".", "It", "returns", "a", "new", "map", "for", "each", "call", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L528-L534
test
uber/tchannel-go
channel.go
Connect
func (ch *Channel) Connect(ctx context.Context, hostPort string) (*Connection, error) { switch state := ch.State(); state { case ChannelClient, ChannelListening: break default: ch.log.Debugf("Connect rejecting new connection as state is %v", state) return nil, errInvalidStateForOp } // The context timeout a...
go
func (ch *Channel) Connect(ctx context.Context, hostPort string) (*Connection, error) { switch state := ch.State(); state { case ChannelClient, ChannelListening: break default: ch.log.Debugf("Connect rejecting new connection as state is %v", state) return nil, errInvalidStateForOp } // The context timeout a...
[ "func", "(", "ch", "*", "Channel", ")", "Connect", "(", "ctx", "context", ".", "Context", ",", "hostPort", "string", ")", "(", "*", "Connection", ",", "error", ")", "{", "switch", "state", ":=", "ch", ".", "State", "(", ")", ";", "state", "{", "cas...
// Connect creates a new outbound connection to hostPort.
[ "Connect", "creates", "a", "new", "outbound", "connection", "to", "hostPort", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L542-L608
test
uber/tchannel-go
channel.go
exchangeUpdated
func (ch *Channel) exchangeUpdated(c *Connection) { if c.remotePeerInfo.HostPort == "" { // Hostport is unknown until we get init resp. return } p, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort) if !ok { return } ch.updatePeer(p) }
go
func (ch *Channel) exchangeUpdated(c *Connection) { if c.remotePeerInfo.HostPort == "" { // Hostport is unknown until we get init resp. return } p, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort) if !ok { return } ch.updatePeer(p) }
[ "func", "(", "ch", "*", "Channel", ")", "exchangeUpdated", "(", "c", "*", "Connection", ")", "{", "if", "c", ".", "remotePeerInfo", ".", "HostPort", "==", "\"\"", "{", "return", "\n", "}", "\n", "p", ",", "ok", ":=", "ch", ".", "RootPeers", "(", ")...
// exchangeUpdated updates the peer heap.
[ "exchangeUpdated", "updates", "the", "peer", "heap", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L611-L623
test
uber/tchannel-go
channel.go
updatePeer
func (ch *Channel) updatePeer(p *Peer) { ch.peers.onPeerChange(p) ch.subChannels.updatePeer(p) p.callOnUpdateComplete() }
go
func (ch *Channel) updatePeer(p *Peer) { ch.peers.onPeerChange(p) ch.subChannels.updatePeer(p) p.callOnUpdateComplete() }
[ "func", "(", "ch", "*", "Channel", ")", "updatePeer", "(", "p", "*", "Peer", ")", "{", "ch", ".", "peers", ".", "onPeerChange", "(", "p", ")", "\n", "ch", ".", "subChannels", ".", "updatePeer", "(", "p", ")", "\n", "p", ".", "callOnUpdateComplete", ...
// updatePeer updates the score of the peer and update it's position in heap as well.
[ "updatePeer", "updates", "the", "score", "of", "the", "peer", "and", "update", "it", "s", "position", "in", "heap", "as", "well", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L626-L630
test
uber/tchannel-go
channel.go
addConnection
func (ch *Channel) addConnection(c *Connection, direction connectionDirection) bool { ch.mutable.Lock() defer ch.mutable.Unlock() if c.readState() != connectionActive { return false } switch state := ch.mutable.state; state { case ChannelClient, ChannelListening: break default: return false } ch.mutab...
go
func (ch *Channel) addConnection(c *Connection, direction connectionDirection) bool { ch.mutable.Lock() defer ch.mutable.Unlock() if c.readState() != connectionActive { return false } switch state := ch.mutable.state; state { case ChannelClient, ChannelListening: break default: return false } ch.mutab...
[ "func", "(", "ch", "*", "Channel", ")", "addConnection", "(", "c", "*", "Connection", ",", "direction", "connectionDirection", ")", "bool", "{", "ch", ".", "mutable", ".", "Lock", "(", ")", "\n", "defer", "ch", ".", "mutable", ".", "Unlock", "(", ")", ...
// addConnection adds the connection to the channel's list of connection // if the channel is in a valid state to accept this connection. It returns // whether the connection was added.
[ "addConnection", "adds", "the", "connection", "to", "the", "channel", "s", "list", "of", "connection", "if", "the", "channel", "is", "in", "a", "valid", "state", "to", "accept", "this", "connection", ".", "It", "returns", "whether", "the", "connection", "was...
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L635-L652
test
uber/tchannel-go
channel.go
removeClosedConn
func (ch *Channel) removeClosedConn(c *Connection) { if c.readState() != connectionClosed { return } ch.mutable.Lock() delete(ch.mutable.conns, c.connID) ch.mutable.Unlock() }
go
func (ch *Channel) removeClosedConn(c *Connection) { if c.readState() != connectionClosed { return } ch.mutable.Lock() delete(ch.mutable.conns, c.connID) ch.mutable.Unlock() }
[ "func", "(", "ch", "*", "Channel", ")", "removeClosedConn", "(", "c", "*", "Connection", ")", "{", "if", "c", ".", "readState", "(", ")", "!=", "connectionClosed", "{", "return", "\n", "}", "\n", "ch", ".", "mutable", ".", "Lock", "(", ")", "\n", "...
// removeClosedConn removes a connection if it's closed. // Until a connection is fully closed, the channel must keep track of it.
[ "removeClosedConn", "removes", "a", "connection", "if", "it", "s", "closed", ".", "Until", "a", "connection", "is", "fully", "closed", "the", "channel", "must", "keep", "track", "of", "it", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L689-L697
test
uber/tchannel-go
channel.go
connectionCloseStateChange
func (ch *Channel) connectionCloseStateChange(c *Connection) { ch.removeClosedConn(c) if peer, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort); ok { peer.connectionCloseStateChange(c) ch.updatePeer(peer) } if c.outboundHP != "" && c.outboundHP != c.remotePeerInfo.HostPort { // Outbound connections may be ...
go
func (ch *Channel) connectionCloseStateChange(c *Connection) { ch.removeClosedConn(c) if peer, ok := ch.RootPeers().Get(c.remotePeerInfo.HostPort); ok { peer.connectionCloseStateChange(c) ch.updatePeer(peer) } if c.outboundHP != "" && c.outboundHP != c.remotePeerInfo.HostPort { // Outbound connections may be ...
[ "func", "(", "ch", "*", "Channel", ")", "connectionCloseStateChange", "(", "c", "*", "Connection", ")", "{", "ch", ".", "removeClosedConn", "(", "c", ")", "\n", "if", "peer", ",", "ok", ":=", "ch", ".", "RootPeers", "(", ")", ".", "Get", "(", "c", ...
// connectionCloseStateChange is called when a connection's close state changes.
[ "connectionCloseStateChange", "is", "called", "when", "a", "connection", "s", "close", "state", "changes", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L710-L759
test
uber/tchannel-go
channel.go
State
func (ch *Channel) State() ChannelState { ch.mutable.RLock() state := ch.mutable.state ch.mutable.RUnlock() return state }
go
func (ch *Channel) State() ChannelState { ch.mutable.RLock() state := ch.mutable.state ch.mutable.RUnlock() return state }
[ "func", "(", "ch", "*", "Channel", ")", "State", "(", ")", "ChannelState", "{", "ch", ".", "mutable", ".", "RLock", "(", ")", "\n", "state", ":=", "ch", ".", "mutable", ".", "state", "\n", "ch", ".", "mutable", ".", "RUnlock", "(", ")", "\n", "re...
// State returns the current channel state.
[ "State", "returns", "the", "current", "channel", "state", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/channel.go#L780-L786
test
uber/tchannel-go
typed/reader.go
NewReader
func NewReader(reader io.Reader) *Reader { r := readerPool.Get().(*Reader) r.reader = reader r.err = nil return r }
go
func NewReader(reader io.Reader) *Reader { r := readerPool.Get().(*Reader) r.reader = reader r.err = nil return r }
[ "func", "NewReader", "(", "reader", "io", ".", "Reader", ")", "*", "Reader", "{", "r", ":=", "readerPool", ".", "Get", "(", ")", ".", "(", "*", "Reader", ")", "\n", "r", ".", "reader", "=", "reader", "\n", "r", ".", "err", "=", "nil", "\n", "re...
// NewReader returns a reader that reads typed values from the reader.
[ "NewReader", "returns", "a", "reader", "that", "reads", "typed", "values", "from", "the", "reader", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/reader.go#L45-L50
test
uber/tchannel-go
typed/reader.go
ReadUint16
func (r *Reader) ReadUint16() uint16 { if r.err != nil { return 0 } buf := r.buf[:2] var readN int readN, r.err = io.ReadFull(r.reader, buf) if readN < 2 { return 0 } return binary.BigEndian.Uint16(buf) }
go
func (r *Reader) ReadUint16() uint16 { if r.err != nil { return 0 } buf := r.buf[:2] var readN int readN, r.err = io.ReadFull(r.reader, buf) if readN < 2 { return 0 } return binary.BigEndian.Uint16(buf) }
[ "func", "(", "r", "*", "Reader", ")", "ReadUint16", "(", ")", "uint16", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "buf", ":=", "r", ".", "buf", "[", ":", "2", "]", "\n", "var", "readN", "int", "\n", "readN"...
// ReadUint16 reads a uint16.
[ "ReadUint16", "reads", "a", "uint16", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/reader.go#L53-L66
test
uber/tchannel-go
typed/reader.go
ReadString
func (r *Reader) ReadString(n int) string { if r.err != nil { return "" } var buf []byte if n <= maxPoolStringLen { buf = r.buf[:n] } else { buf = make([]byte, n) } var readN int readN, r.err = io.ReadFull(r.reader, buf) if readN < n { return "" } s := string(buf) return s }
go
func (r *Reader) ReadString(n int) string { if r.err != nil { return "" } var buf []byte if n <= maxPoolStringLen { buf = r.buf[:n] } else { buf = make([]byte, n) } var readN int readN, r.err = io.ReadFull(r.reader, buf) if readN < n { return "" } s := string(buf) return s }
[ "func", "(", "r", "*", "Reader", ")", "ReadString", "(", "n", "int", ")", "string", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "\"\"", "\n", "}", "\n", "var", "buf", "[", "]", "byte", "\n", "if", "n", "<=", "maxPoolStringLen", "{", ...
// ReadString reads a string of length n.
[ "ReadString", "reads", "a", "string", "of", "length", "n", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/reader.go#L69-L89
test
uber/tchannel-go
typed/reader.go
ReadLen16String
func (r *Reader) ReadLen16String() string { len := r.ReadUint16() return r.ReadString(int(len)) }
go
func (r *Reader) ReadLen16String() string { len := r.ReadUint16() return r.ReadString(int(len)) }
[ "func", "(", "r", "*", "Reader", ")", "ReadLen16String", "(", ")", "string", "{", "len", ":=", "r", ".", "ReadUint16", "(", ")", "\n", "return", "r", ".", "ReadString", "(", "int", "(", "len", ")", ")", "\n", "}" ]
// ReadLen16String reads a uint16-length prefixed string.
[ "ReadLen16String", "reads", "a", "uint16", "-", "length", "prefixed", "string", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/reader.go#L92-L95
test
uber/tchannel-go
crossdock/behavior/trace/behavior.go
Register
func (b *Behavior) Register(ch *tchannel.Channel) { b.registerThrift(ch) b.registerJSON(ch) }
go
func (b *Behavior) Register(ch *tchannel.Channel) { b.registerThrift(ch) b.registerJSON(ch) }
[ "func", "(", "b", "*", "Behavior", ")", "Register", "(", "ch", "*", "tchannel", ".", "Channel", ")", "{", "b", ".", "registerThrift", "(", "ch", ")", "\n", "b", ".", "registerJSON", "(", "ch", ")", "\n", "}" ]
// Register function adds JSON and Thrift handlers to the server channel ch
[ "Register", "function", "adds", "JSON", "and", "Thrift", "handlers", "to", "the", "server", "channel", "ch" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/crossdock/behavior/trace/behavior.go#L60-L63
test
uber/tchannel-go
crossdock/behavior/trace/behavior.go
Run
func (b *Behavior) Run(t crossdock.T) { logParams(t) sampled, err := strconv.ParseBool(t.Param(sampledParam)) if err != nil { t.Fatalf("Malformed param %s: %s", sampledParam, err) } baggage := randomBaggage() level1 := &Request{ ServerRole: RoleS1, } server1 := t.Param(server1NameParam) level2 := &Downst...
go
func (b *Behavior) Run(t crossdock.T) { logParams(t) sampled, err := strconv.ParseBool(t.Param(sampledParam)) if err != nil { t.Fatalf("Malformed param %s: %s", sampledParam, err) } baggage := randomBaggage() level1 := &Request{ ServerRole: RoleS1, } server1 := t.Param(server1NameParam) level2 := &Downst...
[ "func", "(", "b", "*", "Behavior", ")", "Run", "(", "t", "crossdock", ".", "T", ")", "{", "logParams", "(", "t", ")", "\n", "sampled", ",", "err", ":=", "strconv", ".", "ParseBool", "(", "t", ".", "Param", "(", "sampledParam", ")", ")", "\n", "if...
// Run executes the trace behavior
[ "Run", "executes", "the", "trace", "behavior" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/crossdock/behavior/trace/behavior.go#L66-L119
test
uber/tchannel-go
relay_timer_pool.go
Get
func (tp *relayTimerPool) Get() *relayTimer { timer, ok := tp.pool.Get().(*relayTimer) if ok { timer.released = false return timer } rt := &relayTimer{ pool: tp, } // Go timers are started by default. However, we need to separate creating // the timer and starting the timer for use in the relay code paths...
go
func (tp *relayTimerPool) Get() *relayTimer { timer, ok := tp.pool.Get().(*relayTimer) if ok { timer.released = false return timer } rt := &relayTimer{ pool: tp, } // Go timers are started by default. However, we need to separate creating // the timer and starting the timer for use in the relay code paths...
[ "func", "(", "tp", "*", "relayTimerPool", ")", "Get", "(", ")", "*", "relayTimer", "{", "timer", ",", "ok", ":=", "tp", ".", "pool", ".", "Get", "(", ")", ".", "(", "*", "relayTimer", ")", "\n", "if", "ok", "{", "timer", ".", "released", "=", "...
// Get returns a relay timer that has not started. Timers must be started explicitly // using the Start function.
[ "Get", "returns", "a", "relay", "timer", "that", "has", "not", "started", ".", "Timers", "must", "be", "started", "explicitly", "using", "the", "Start", "function", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/relay_timer_pool.go#L66-L85
test
uber/tchannel-go
relay_timer_pool.go
Put
func (tp *relayTimerPool) Put(rt *relayTimer) { if tp.verify { // If we are trying to verify correct pool behavior, then we don't release // the timer, and instead ensure no methods are called after being released. return } tp.pool.Put(rt) }
go
func (tp *relayTimerPool) Put(rt *relayTimer) { if tp.verify { // If we are trying to verify correct pool behavior, then we don't release // the timer, and instead ensure no methods are called after being released. return } tp.pool.Put(rt) }
[ "func", "(", "tp", "*", "relayTimerPool", ")", "Put", "(", "rt", "*", "relayTimer", ")", "{", "if", "tp", ".", "verify", "{", "return", "\n", "}", "\n", "tp", ".", "pool", ".", "Put", "(", "rt", ")", "\n", "}" ]
// Put returns a relayTimer back to the pool.
[ "Put", "returns", "a", "relayTimer", "back", "to", "the", "pool", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/relay_timer_pool.go#L88-L95
test
uber/tchannel-go
relay_timer_pool.go
Start
func (rt *relayTimer) Start(d time.Duration, items *relayItems, id uint32, isOriginator bool) { rt.verifyNotReleased() if rt.active { panic("Tried to start an already-active timer") } rt.active = true rt.items = items rt.id = id rt.isOriginator = isOriginator if wasActive := rt.timer.Reset(d); wasActive { ...
go
func (rt *relayTimer) Start(d time.Duration, items *relayItems, id uint32, isOriginator bool) { rt.verifyNotReleased() if rt.active { panic("Tried to start an already-active timer") } rt.active = true rt.items = items rt.id = id rt.isOriginator = isOriginator if wasActive := rt.timer.Reset(d); wasActive { ...
[ "func", "(", "rt", "*", "relayTimer", ")", "Start", "(", "d", "time", ".", "Duration", ",", "items", "*", "relayItems", ",", "id", "uint32", ",", "isOriginator", "bool", ")", "{", "rt", ".", "verifyNotReleased", "(", ")", "\n", "if", "rt", ".", "acti...
// Start starts a timer with the given duration for the specified ID.
[ "Start", "starts", "a", "timer", "with", "the", "given", "duration", "for", "the", "specified", "ID", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/relay_timer_pool.go#L98-L112
test
uber/tchannel-go
relay_timer_pool.go
Release
func (rt *relayTimer) Release() { rt.verifyNotReleased() if rt.active { panic("only stopped or completed timers can be released") } rt.released = true rt.pool.Put(rt) }
go
func (rt *relayTimer) Release() { rt.verifyNotReleased() if rt.active { panic("only stopped or completed timers can be released") } rt.released = true rt.pool.Put(rt) }
[ "func", "(", "rt", "*", "relayTimer", ")", "Release", "(", ")", "{", "rt", ".", "verifyNotReleased", "(", ")", "\n", "if", "rt", ".", "active", "{", "panic", "(", "\"only stopped or completed timers can be released\"", ")", "\n", "}", "\n", "rt", ".", "rel...
// Release releases a timer back to the timer pool. The timer MUST have run or be // stopped before Release is called.
[ "Release", "releases", "a", "timer", "back", "to", "the", "timer", "pool", ".", "The", "timer", "MUST", "have", "run", "or", "be", "stopped", "before", "Release", "is", "called", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/relay_timer_pool.go#L137-L144
test
uber/tchannel-go
logger.go
NewLogger
func NewLogger(writer io.Writer, fields ...LogField) Logger { return &writerLogger{writer, fields} }
go
func NewLogger(writer io.Writer, fields ...LogField) Logger { return &writerLogger{writer, fields} }
[ "func", "NewLogger", "(", "writer", "io", ".", "Writer", ",", "fields", "...", "LogField", ")", "Logger", "{", "return", "&", "writerLogger", "{", "writer", ",", "fields", "}", "\n", "}" ]
// NewLogger returns a Logger that writes to the given writer.
[ "NewLogger", "returns", "a", "Logger", "that", "writes", "to", "the", "given", "writer", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/logger.go#L119-L121
test
uber/tchannel-go
benchmark/tcp_frame_relay.go
NewTCPFrameRelay
func NewTCPFrameRelay(dests []string, modifier func(bool, *tchannel.Frame) *tchannel.Frame) (Relay, error) { var err error r := &tcpFrameRelay{modifier: modifier} r.tcpRelay, err = newTCPRelay(dests, r.handleConnFrameRelay) if err != nil { return nil, err } return r, nil }
go
func NewTCPFrameRelay(dests []string, modifier func(bool, *tchannel.Frame) *tchannel.Frame) (Relay, error) { var err error r := &tcpFrameRelay{modifier: modifier} r.tcpRelay, err = newTCPRelay(dests, r.handleConnFrameRelay) if err != nil { return nil, err } return r, nil }
[ "func", "NewTCPFrameRelay", "(", "dests", "[", "]", "string", ",", "modifier", "func", "(", "bool", ",", "*", "tchannel", ".", "Frame", ")", "*", "tchannel", ".", "Frame", ")", "(", "Relay", ",", "error", ")", "{", "var", "err", "error", "\n", "r", ...
// NewTCPFrameRelay relays frames from one connection to another. It reads // and writes frames using the TChannel frame functions.
[ "NewTCPFrameRelay", "relays", "frames", "from", "one", "connection", "to", "another", ".", "It", "reads", "and", "writes", "frames", "using", "the", "TChannel", "frame", "functions", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/benchmark/tcp_frame_relay.go#L36-L46
test
uber/tchannel-go
stats/tally.go
tallyTags
func (kt knownTags) tallyTags() map[string]string { tallyTags := make(map[string]string, 5) if kt.dest != "" { tallyTags["dest"] = kt.dest } if kt.source != "" { tallyTags["source"] = kt.source } if kt.procedure != "" { tallyTags["procedure"] = kt.procedure } if kt.retryCount != "" { tallyTags["retry-c...
go
func (kt knownTags) tallyTags() map[string]string { tallyTags := make(map[string]string, 5) if kt.dest != "" { tallyTags["dest"] = kt.dest } if kt.source != "" { tallyTags["source"] = kt.source } if kt.procedure != "" { tallyTags["procedure"] = kt.procedure } if kt.retryCount != "" { tallyTags["retry-c...
[ "func", "(", "kt", "knownTags", ")", "tallyTags", "(", ")", "map", "[", "string", "]", "string", "{", "tallyTags", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "5", ")", "\n", "if", "kt", ".", "dest", "!=", "\"\"", "{", "tallyTags",...
// Create a sub-scope for this set of known tags.
[ "Create", "a", "sub", "-", "scope", "for", "this", "set", "of", "known", "tags", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/stats/tally.go#L117-L134
test
uber/tchannel-go
subchannel.go
Isolated
func Isolated(s *SubChannel) { s.Lock() s.peers = s.topChannel.peers.newSibling() s.peers.SetStrategy(newLeastPendingCalculator()) s.Unlock() }
go
func Isolated(s *SubChannel) { s.Lock() s.peers = s.topChannel.peers.newSibling() s.peers.SetStrategy(newLeastPendingCalculator()) s.Unlock() }
[ "func", "Isolated", "(", "s", "*", "SubChannel", ")", "{", "s", ".", "Lock", "(", ")", "\n", "s", ".", "peers", "=", "s", ".", "topChannel", ".", "peers", ".", "newSibling", "(", ")", "\n", "s", ".", "peers", ".", "SetStrategy", "(", "newLeastPendi...
// Isolated is a SubChannelOption that creates an isolated subchannel.
[ "Isolated", "is", "a", "SubChannelOption", "that", "creates", "an", "isolated", "subchannel", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L35-L40
test
uber/tchannel-go
subchannel.go
Isolated
func (c *SubChannel) Isolated() bool { c.RLock() defer c.RUnlock() return c.topChannel.Peers() != c.peers }
go
func (c *SubChannel) Isolated() bool { c.RLock() defer c.RUnlock() return c.topChannel.Peers() != c.peers }
[ "func", "(", "c", "*", "SubChannel", ")", "Isolated", "(", ")", "bool", "{", "c", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "RUnlock", "(", ")", "\n", "return", "c", ".", "topChannel", ".", "Peers", "(", ")", "!=", "c", ".", "peers", "\n...
// Isolated returns whether this subchannel is an isolated subchannel.
[ "Isolated", "returns", "whether", "this", "subchannel", "is", "an", "isolated", "subchannel", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L100-L104
test
uber/tchannel-go
subchannel.go
Register
func (c *SubChannel) Register(h Handler, methodName string) { handlers, ok := c.handler.(*handlerMap) if !ok { panic(fmt.Sprintf( "handler for SubChannel(%v) was changed to disallow method registration", c.ServiceName(), )) } handlers.register(h, methodName) }
go
func (c *SubChannel) Register(h Handler, methodName string) { handlers, ok := c.handler.(*handlerMap) if !ok { panic(fmt.Sprintf( "handler for SubChannel(%v) was changed to disallow method registration", c.ServiceName(), )) } handlers.register(h, methodName) }
[ "func", "(", "c", "*", "SubChannel", ")", "Register", "(", "h", "Handler", ",", "methodName", "string", ")", "{", "handlers", ",", "ok", ":=", "c", ".", "handler", ".", "(", "*", "handlerMap", ")", "\n", "if", "!", "ok", "{", "panic", "(", "fmt", ...
// Register registers a handler on the subchannel for the given method. // // This function panics if the Handler for the SubChannel was overwritten with // SetHandler.
[ "Register", "registers", "a", "handler", "on", "the", "subchannel", "for", "the", "given", "method", ".", "This", "function", "panics", "if", "the", "Handler", "for", "the", "SubChannel", "was", "overwritten", "with", "SetHandler", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L110-L119
test
uber/tchannel-go
subchannel.go
GetHandlers
func (c *SubChannel) GetHandlers() map[string]Handler { handlers, ok := c.handler.(*handlerMap) if !ok { panic(fmt.Sprintf( "handler for SubChannel(%v) was changed to disallow method registration", c.ServiceName(), )) } handlers.RLock() handlersMap := make(map[string]Handler, len(handlers.handlers)) fo...
go
func (c *SubChannel) GetHandlers() map[string]Handler { handlers, ok := c.handler.(*handlerMap) if !ok { panic(fmt.Sprintf( "handler for SubChannel(%v) was changed to disallow method registration", c.ServiceName(), )) } handlers.RLock() handlersMap := make(map[string]Handler, len(handlers.handlers)) fo...
[ "func", "(", "c", "*", "SubChannel", ")", "GetHandlers", "(", ")", "map", "[", "string", "]", "Handler", "{", "handlers", ",", "ok", ":=", "c", ".", "handler", ".", "(", "*", "handlerMap", ")", "\n", "if", "!", "ok", "{", "panic", "(", "fmt", "."...
// GetHandlers returns all handlers registered on this subchannel by method name. // // This function panics if the Handler for the SubChannel was overwritten with // SetHandler.
[ "GetHandlers", "returns", "all", "handlers", "registered", "on", "this", "subchannel", "by", "method", "name", ".", "This", "function", "panics", "if", "the", "Handler", "for", "the", "SubChannel", "was", "overwritten", "with", "SetHandler", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L125-L141
test
uber/tchannel-go
subchannel.go
StatsTags
func (c *SubChannel) StatsTags() map[string]string { tags := c.topChannel.StatsTags() tags["subchannel"] = c.serviceName return tags }
go
func (c *SubChannel) StatsTags() map[string]string { tags := c.topChannel.StatsTags() tags["subchannel"] = c.serviceName return tags }
[ "func", "(", "c", "*", "SubChannel", ")", "StatsTags", "(", ")", "map", "[", "string", "]", "string", "{", "tags", ":=", "c", ".", "topChannel", ".", "StatsTags", "(", ")", "\n", "tags", "[", "\"subchannel\"", "]", "=", "c", ".", "serviceName", "\n",...
// StatsTags returns the stats tags for this subchannel.
[ "StatsTags", "returns", "the", "stats", "tags", "for", "this", "subchannel", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L164-L168
test
uber/tchannel-go
subchannel.go
registerNewSubChannel
func (subChMap *subChannelMap) registerNewSubChannel(serviceName string, ch *Channel) (_ *SubChannel, added bool) { subChMap.Lock() defer subChMap.Unlock() if subChMap.subchannels == nil { subChMap.subchannels = make(map[string]*SubChannel) } if sc, ok := subChMap.subchannels[serviceName]; ok { return sc, fa...
go
func (subChMap *subChannelMap) registerNewSubChannel(serviceName string, ch *Channel) (_ *SubChannel, added bool) { subChMap.Lock() defer subChMap.Unlock() if subChMap.subchannels == nil { subChMap.subchannels = make(map[string]*SubChannel) } if sc, ok := subChMap.subchannels[serviceName]; ok { return sc, fa...
[ "func", "(", "subChMap", "*", "subChannelMap", ")", "registerNewSubChannel", "(", "serviceName", "string", ",", "ch", "*", "Channel", ")", "(", "_", "*", "SubChannel", ",", "added", "bool", ")", "{", "subChMap", ".", "Lock", "(", ")", "\n", "defer", "sub...
// Register a new subchannel for the given serviceName
[ "Register", "a", "new", "subchannel", "for", "the", "given", "serviceName" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L176-L191
test
uber/tchannel-go
subchannel.go
get
func (subChMap *subChannelMap) get(serviceName string) (*SubChannel, bool) { subChMap.RLock() sc, ok := subChMap.subchannels[serviceName] subChMap.RUnlock() return sc, ok }
go
func (subChMap *subChannelMap) get(serviceName string) (*SubChannel, bool) { subChMap.RLock() sc, ok := subChMap.subchannels[serviceName] subChMap.RUnlock() return sc, ok }
[ "func", "(", "subChMap", "*", "subChannelMap", ")", "get", "(", "serviceName", "string", ")", "(", "*", "SubChannel", ",", "bool", ")", "{", "subChMap", ".", "RLock", "(", ")", "\n", "sc", ",", "ok", ":=", "subChMap", ".", "subchannels", "[", "serviceN...
// Get subchannel if, we have one
[ "Get", "subchannel", "if", "we", "have", "one" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L194-L199
test
uber/tchannel-go
subchannel.go
getOrAdd
func (subChMap *subChannelMap) getOrAdd(serviceName string, ch *Channel) (_ *SubChannel, added bool) { if sc, ok := subChMap.get(serviceName); ok { return sc, false } return subChMap.registerNewSubChannel(serviceName, ch) }
go
func (subChMap *subChannelMap) getOrAdd(serviceName string, ch *Channel) (_ *SubChannel, added bool) { if sc, ok := subChMap.get(serviceName); ok { return sc, false } return subChMap.registerNewSubChannel(serviceName, ch) }
[ "func", "(", "subChMap", "*", "subChannelMap", ")", "getOrAdd", "(", "serviceName", "string", ",", "ch", "*", "Channel", ")", "(", "_", "*", "SubChannel", ",", "added", "bool", ")", "{", "if", "sc", ",", "ok", ":=", "subChMap", ".", "get", "(", "serv...
// GetOrAdd a subchannel for the given serviceName on the map
[ "GetOrAdd", "a", "subchannel", "for", "the", "given", "serviceName", "on", "the", "map" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/subchannel.go#L202-L208
test
uber/tchannel-go
hyperbahn/discover.go
Discover
func (c *Client) Discover(serviceName string) ([]string, error) { ctx, cancel := thrift.NewContext(time.Second) defer cancel() result, err := c.hyperbahnClient.Discover(ctx, &hyperbahn.DiscoveryQuery{ServiceName: serviceName}) if err != nil { return nil, err } var hostPorts []string for _, peer := range resu...
go
func (c *Client) Discover(serviceName string) ([]string, error) { ctx, cancel := thrift.NewContext(time.Second) defer cancel() result, err := c.hyperbahnClient.Discover(ctx, &hyperbahn.DiscoveryQuery{ServiceName: serviceName}) if err != nil { return nil, err } var hostPorts []string for _, peer := range resu...
[ "func", "(", "c", "*", "Client", ")", "Discover", "(", "serviceName", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "thrift", ".", "NewContext", "(", "time", ".", "Second", ")", "\n", "defer", "cancel", ...
// Discover queries Hyperbahn for a list of peers that are currently // advertised with the specified service name.
[ "Discover", "queries", "Hyperbahn", "for", "a", "list", "of", "peers", "that", "are", "currently", "advertised", "with", "the", "specified", "service", "name", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/hyperbahn/discover.go#L32-L47
test
uber/tchannel-go
crossdock/client/client.go
Start
func (c *Client) Start() error { if err := c.listen(); err != nil { return err } go func() { http.Serve(c.listener, c.mux) }() return nil }
go
func (c *Client) Start() error { if err := c.listen(); err != nil { return err } go func() { http.Serve(c.listener, c.mux) }() return nil }
[ "func", "(", "c", "*", "Client", ")", "Start", "(", ")", "error", "{", "if", "err", ":=", "c", ".", "listen", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "go", "func", "(", ")", "{", "http", ".", "Serve", "(", ...
// Start begins a Crossdock client in the background.
[ "Start", "begins", "a", "Crossdock", "client", "in", "the", "background", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/crossdock/client/client.go#L43-L51
test
uber/tchannel-go
crossdock/client/client.go
listen
func (c *Client) listen() error { c.setDefaultPort(&c.ClientHostPort, ":"+common.DefaultClientPortHTTP) c.setDefaultPort(&c.ServerPort, common.DefaultServerPort) c.mux = http.NewServeMux() // Using default mux creates problem in unit tests c.mux.Handle("/", crossdock.Handler(c.Behaviors, true)) listener, err := ...
go
func (c *Client) listen() error { c.setDefaultPort(&c.ClientHostPort, ":"+common.DefaultClientPortHTTP) c.setDefaultPort(&c.ServerPort, common.DefaultServerPort) c.mux = http.NewServeMux() // Using default mux creates problem in unit tests c.mux.Handle("/", crossdock.Handler(c.Behaviors, true)) listener, err := ...
[ "func", "(", "c", "*", "Client", ")", "listen", "(", ")", "error", "{", "c", ".", "setDefaultPort", "(", "&", "c", ".", "ClientHostPort", ",", "\":\"", "+", "common", ".", "DefaultClientPortHTTP", ")", "\n", "c", ".", "setDefaultPort", "(", "&", "c", ...
// Listen initializes the server
[ "Listen", "initializes", "the", "server" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/crossdock/client/client.go#L54-L68
test
uber/tchannel-go
http/request.go
WriteRequest
func WriteRequest(call tchannel.ArgWritable, req *http.Request) error { // TODO(prashant): Allow creating write buffers that let you grow the buffer underneath. wb := typed.NewWriteBufferWithSize(10000) wb.WriteLen8String(req.Method) writeVarintString(wb, req.URL.String()) writeHeaders(wb, req.Header) arg2Writer...
go
func WriteRequest(call tchannel.ArgWritable, req *http.Request) error { // TODO(prashant): Allow creating write buffers that let you grow the buffer underneath. wb := typed.NewWriteBufferWithSize(10000) wb.WriteLen8String(req.Method) writeVarintString(wb, req.URL.String()) writeHeaders(wb, req.Header) arg2Writer...
[ "func", "WriteRequest", "(", "call", "tchannel", ".", "ArgWritable", ",", "req", "*", "http", ".", "Request", ")", "error", "{", "wb", ":=", "typed", ".", "NewWriteBufferWithSize", "(", "10000", ")", "\n", "wb", ".", "WriteLen8String", "(", "req", ".", "...
// WriteRequest writes a http.Request to the given writers.
[ "WriteRequest", "writes", "a", "http", ".", "Request", "to", "the", "given", "writers", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/http/request.go#L32-L61
test
uber/tchannel-go
http/request.go
ReadRequest
func ReadRequest(call tchannel.ArgReadable) (*http.Request, error) { var arg2 []byte if err := tchannel.NewArgReader(call.Arg2Reader()).Read(&arg2); err != nil { return nil, err } rb := typed.NewReadBuffer(arg2) method := rb.ReadLen8String() url := readVarintString(rb) r, err := http.NewRequest(method, url, n...
go
func ReadRequest(call tchannel.ArgReadable) (*http.Request, error) { var arg2 []byte if err := tchannel.NewArgReader(call.Arg2Reader()).Read(&arg2); err != nil { return nil, err } rb := typed.NewReadBuffer(arg2) method := rb.ReadLen8String() url := readVarintString(rb) r, err := http.NewRequest(method, url, n...
[ "func", "ReadRequest", "(", "call", "tchannel", ".", "ArgReadable", ")", "(", "*", "http", ".", "Request", ",", "error", ")", "{", "var", "arg2", "[", "]", "byte", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "call", ".", "Arg2Reader"...
// ReadRequest reads a http.Request from the given readers.
[ "ReadRequest", "reads", "a", "http", ".", "Request", "from", "the", "given", "readers", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/http/request.go#L64-L85
test
uber/tchannel-go
typed/buffer.go
NewReadBufferWithSize
func NewReadBufferWithSize(size int) *ReadBuffer { return &ReadBuffer{buffer: make([]byte, size), remaining: nil} }
go
func NewReadBufferWithSize(size int) *ReadBuffer { return &ReadBuffer{buffer: make([]byte, size), remaining: nil} }
[ "func", "NewReadBufferWithSize", "(", "size", "int", ")", "*", "ReadBuffer", "{", "return", "&", "ReadBuffer", "{", "buffer", ":", "make", "(", "[", "]", "byte", ",", "size", ")", ",", "remaining", ":", "nil", "}", "\n", "}" ]
// NewReadBufferWithSize returns a ReadBuffer with a given capacity
[ "NewReadBufferWithSize", "returns", "a", "ReadBuffer", "with", "a", "given", "capacity" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L56-L58
test
uber/tchannel-go
typed/buffer.go
ReadByte
func (r *ReadBuffer) ReadByte() (byte, error) { if r.err != nil { return 0, r.err } if len(r.remaining) < 1 { r.err = ErrEOF return 0, r.err } b := r.remaining[0] r.remaining = r.remaining[1:] return b, nil }
go
func (r *ReadBuffer) ReadByte() (byte, error) { if r.err != nil { return 0, r.err } if len(r.remaining) < 1 { r.err = ErrEOF return 0, r.err } b := r.remaining[0] r.remaining = r.remaining[1:] return b, nil }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadByte", "(", ")", "(", "byte", ",", "error", ")", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "0", ",", "r", ".", "err", "\n", "}", "\n", "if", "len", "(", "r", ".", "remaining", ")", ...
// ReadByte returns the next byte from the buffer.
[ "ReadByte", "returns", "the", "next", "byte", "from", "the", "buffer", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L67-L80
test
uber/tchannel-go
typed/buffer.go
ReadBytes
func (r *ReadBuffer) ReadBytes(n int) []byte { if r.err != nil { return nil } if len(r.remaining) < n { r.err = ErrEOF return nil } b := r.remaining[0:n] r.remaining = r.remaining[n:] return b }
go
func (r *ReadBuffer) ReadBytes(n int) []byte { if r.err != nil { return nil } if len(r.remaining) < n { r.err = ErrEOF return nil } b := r.remaining[0:n] r.remaining = r.remaining[n:] return b }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadBytes", "(", "n", "int", ")", "[", "]", "byte", "{", "if", "r", ".", "err", "!=", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "len", "(", "r", ".", "remaining", ")", "<", "n", "{", "r", ...
// ReadBytes returns the next n bytes from the buffer
[ "ReadBytes", "returns", "the", "next", "n", "bytes", "from", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L83-L96
test
uber/tchannel-go
typed/buffer.go
ReadString
func (r *ReadBuffer) ReadString(n int) string { if b := r.ReadBytes(n); b != nil { // TODO(mmihic): This creates a copy, which sucks return string(b) } return "" }
go
func (r *ReadBuffer) ReadString(n int) string { if b := r.ReadBytes(n); b != nil { // TODO(mmihic): This creates a copy, which sucks return string(b) } return "" }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadString", "(", "n", "int", ")", "string", "{", "if", "b", ":=", "r", ".", "ReadBytes", "(", "n", ")", ";", "b", "!=", "nil", "{", "return", "string", "(", "b", ")", "\n", "}", "\n", "return", "\"\""...
// ReadString returns a string of size n from the buffer
[ "ReadString", "returns", "a", "string", "of", "size", "n", "from", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L99-L106
test
uber/tchannel-go
typed/buffer.go
ReadUint16
func (r *ReadBuffer) ReadUint16() uint16 { if b := r.ReadBytes(2); b != nil { return binary.BigEndian.Uint16(b) } return 0 }
go
func (r *ReadBuffer) ReadUint16() uint16 { if b := r.ReadBytes(2); b != nil { return binary.BigEndian.Uint16(b) } return 0 }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadUint16", "(", ")", "uint16", "{", "if", "b", ":=", "r", ".", "ReadBytes", "(", "2", ")", ";", "b", "!=", "nil", "{", "return", "binary", ".", "BigEndian", ".", "Uint16", "(", "b", ")", "\n", "}", "...
// ReadUint16 returns the next value in the buffer as a uint16
[ "ReadUint16", "returns", "the", "next", "value", "in", "the", "buffer", "as", "a", "uint16" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L109-L115
test
uber/tchannel-go
typed/buffer.go
ReadUint32
func (r *ReadBuffer) ReadUint32() uint32 { if b := r.ReadBytes(4); b != nil { return binary.BigEndian.Uint32(b) } return 0 }
go
func (r *ReadBuffer) ReadUint32() uint32 { if b := r.ReadBytes(4); b != nil { return binary.BigEndian.Uint32(b) } return 0 }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadUint32", "(", ")", "uint32", "{", "if", "b", ":=", "r", ".", "ReadBytes", "(", "4", ")", ";", "b", "!=", "nil", "{", "return", "binary", ".", "BigEndian", ".", "Uint32", "(", "b", ")", "\n", "}", "...
// ReadUint32 returns the next value in the buffer as a uint32
[ "ReadUint32", "returns", "the", "next", "value", "in", "the", "buffer", "as", "a", "uint32" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L118-L124
test
uber/tchannel-go
typed/buffer.go
ReadUint64
func (r *ReadBuffer) ReadUint64() uint64 { if b := r.ReadBytes(8); b != nil { return binary.BigEndian.Uint64(b) } return 0 }
go
func (r *ReadBuffer) ReadUint64() uint64 { if b := r.ReadBytes(8); b != nil { return binary.BigEndian.Uint64(b) } return 0 }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadUint64", "(", ")", "uint64", "{", "if", "b", ":=", "r", ".", "ReadBytes", "(", "8", ")", ";", "b", "!=", "nil", "{", "return", "binary", ".", "BigEndian", ".", "Uint64", "(", "b", ")", "\n", "}", "...
// ReadUint64 returns the next value in the buffer as a uint64
[ "ReadUint64", "returns", "the", "next", "value", "in", "the", "buffer", "as", "a", "uint64" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L127-L133
test
uber/tchannel-go
typed/buffer.go
ReadUvarint
func (r *ReadBuffer) ReadUvarint() uint64 { v, _ := binary.ReadUvarint(r) return v }
go
func (r *ReadBuffer) ReadUvarint() uint64 { v, _ := binary.ReadUvarint(r) return v }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadUvarint", "(", ")", "uint64", "{", "v", ",", "_", ":=", "binary", ".", "ReadUvarint", "(", "r", ")", "\n", "return", "v", "\n", "}" ]
// ReadUvarint reads an unsigned varint from the buffer.
[ "ReadUvarint", "reads", "an", "unsigned", "varint", "from", "the", "buffer", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L136-L139
test
uber/tchannel-go
typed/buffer.go
ReadLen8String
func (r *ReadBuffer) ReadLen8String() string { n := r.ReadSingleByte() return r.ReadString(int(n)) }
go
func (r *ReadBuffer) ReadLen8String() string { n := r.ReadSingleByte() return r.ReadString(int(n)) }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadLen8String", "(", ")", "string", "{", "n", ":=", "r", ".", "ReadSingleByte", "(", ")", "\n", "return", "r", ".", "ReadString", "(", "int", "(", "n", ")", ")", "\n", "}" ]
// ReadLen8String reads an 8-bit length preceded string value
[ "ReadLen8String", "reads", "an", "8", "-", "bit", "length", "preceded", "string", "value" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L142-L145
test
uber/tchannel-go
typed/buffer.go
ReadLen16String
func (r *ReadBuffer) ReadLen16String() string { n := r.ReadUint16() return r.ReadString(int(n)) }
go
func (r *ReadBuffer) ReadLen16String() string { n := r.ReadUint16() return r.ReadString(int(n)) }
[ "func", "(", "r", "*", "ReadBuffer", ")", "ReadLen16String", "(", ")", "string", "{", "n", ":=", "r", ".", "ReadUint16", "(", ")", "\n", "return", "r", ".", "ReadString", "(", "int", "(", "n", ")", ")", "\n", "}" ]
// ReadLen16String reads a 16-bit length preceded string value
[ "ReadLen16String", "reads", "a", "16", "-", "bit", "length", "preceded", "string", "value" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L148-L151
test
uber/tchannel-go
typed/buffer.go
FillFrom
func (r *ReadBuffer) FillFrom(ior io.Reader, n int) (int, error) { if len(r.buffer) < n { return 0, ErrEOF } r.err = nil r.remaining = r.buffer[:n] return io.ReadFull(ior, r.remaining) }
go
func (r *ReadBuffer) FillFrom(ior io.Reader, n int) (int, error) { if len(r.buffer) < n { return 0, ErrEOF } r.err = nil r.remaining = r.buffer[:n] return io.ReadFull(ior, r.remaining) }
[ "func", "(", "r", "*", "ReadBuffer", ")", "FillFrom", "(", "ior", "io", ".", "Reader", ",", "n", "int", ")", "(", "int", ",", "error", ")", "{", "if", "len", "(", "r", ".", "buffer", ")", "<", "n", "{", "return", "0", ",", "ErrEOF", "\n", "}"...
// FillFrom fills the buffer from a reader
[ "FillFrom", "fills", "the", "buffer", "from", "a", "reader" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L159-L167
test
uber/tchannel-go
typed/buffer.go
Wrap
func (r *ReadBuffer) Wrap(b []byte) { r.buffer = b r.remaining = b r.err = nil }
go
func (r *ReadBuffer) Wrap(b []byte) { r.buffer = b r.remaining = b r.err = nil }
[ "func", "(", "r", "*", "ReadBuffer", ")", "Wrap", "(", "b", "[", "]", "byte", ")", "{", "r", ".", "buffer", "=", "b", "\n", "r", ".", "remaining", "=", "b", "\n", "r", ".", "err", "=", "nil", "\n", "}" ]
// Wrap initializes the buffer to read from the given byte slice
[ "Wrap", "initializes", "the", "buffer", "to", "read", "from", "the", "given", "byte", "slice" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L170-L174
test
uber/tchannel-go
typed/buffer.go
WriteSingleByte
func (w *WriteBuffer) WriteSingleByte(n byte) { if w.err != nil { return } if len(w.remaining) == 0 { w.setErr(ErrBufferFull) return } w.remaining[0] = n w.remaining = w.remaining[1:] }
go
func (w *WriteBuffer) WriteSingleByte(n byte) { if w.err != nil { return } if len(w.remaining) == 0 { w.setErr(ErrBufferFull) return } w.remaining[0] = n w.remaining = w.remaining[1:] }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteSingleByte", "(", "n", "byte", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "w", ".", "remaining", ")", "==", "0", "{", "w", ".", "setErr", "(",...
// WriteSingleByte writes a single byte to the buffer
[ "WriteSingleByte", "writes", "a", "single", "byte", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L198-L210
test
uber/tchannel-go
typed/buffer.go
WriteBytes
func (w *WriteBuffer) WriteBytes(in []byte) { if b := w.reserve(len(in)); b != nil { copy(b, in) } }
go
func (w *WriteBuffer) WriteBytes(in []byte) { if b := w.reserve(len(in)); b != nil { copy(b, in) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteBytes", "(", "in", "[", "]", "byte", ")", "{", "if", "b", ":=", "w", ".", "reserve", "(", "len", "(", "in", ")", ")", ";", "b", "!=", "nil", "{", "copy", "(", "b", ",", "in", ")", "\n", "}", ...
// WriteBytes writes a slice of bytes to the buffer
[ "WriteBytes", "writes", "a", "slice", "of", "bytes", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L213-L217
test
uber/tchannel-go
typed/buffer.go
WriteUint16
func (w *WriteBuffer) WriteUint16(n uint16) { if b := w.reserve(2); b != nil { binary.BigEndian.PutUint16(b, n) } }
go
func (w *WriteBuffer) WriteUint16(n uint16) { if b := w.reserve(2); b != nil { binary.BigEndian.PutUint16(b, n) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteUint16", "(", "n", "uint16", ")", "{", "if", "b", ":=", "w", ".", "reserve", "(", "2", ")", ";", "b", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint16", "(", "b", ",", "n", ")", "\n"...
// WriteUint16 writes a big endian encoded uint16 value to the buffer
[ "WriteUint16", "writes", "a", "big", "endian", "encoded", "uint16", "value", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L220-L224
test
uber/tchannel-go
typed/buffer.go
WriteUint32
func (w *WriteBuffer) WriteUint32(n uint32) { if b := w.reserve(4); b != nil { binary.BigEndian.PutUint32(b, n) } }
go
func (w *WriteBuffer) WriteUint32(n uint32) { if b := w.reserve(4); b != nil { binary.BigEndian.PutUint32(b, n) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteUint32", "(", "n", "uint32", ")", "{", "if", "b", ":=", "w", ".", "reserve", "(", "4", ")", ";", "b", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint32", "(", "b", ",", "n", ")", "\n"...
// WriteUint32 writes a big endian uint32 value to the buffer
[ "WriteUint32", "writes", "a", "big", "endian", "uint32", "value", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L227-L231
test
uber/tchannel-go
typed/buffer.go
WriteUint64
func (w *WriteBuffer) WriteUint64(n uint64) { if b := w.reserve(8); b != nil { binary.BigEndian.PutUint64(b, n) } }
go
func (w *WriteBuffer) WriteUint64(n uint64) { if b := w.reserve(8); b != nil { binary.BigEndian.PutUint64(b, n) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteUint64", "(", "n", "uint64", ")", "{", "if", "b", ":=", "w", ".", "reserve", "(", "8", ")", ";", "b", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint64", "(", "b", ",", "n", ")", "\n"...
// WriteUint64 writes a big endian uint64 to the buffer
[ "WriteUint64", "writes", "a", "big", "endian", "uint64", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L234-L238
test
uber/tchannel-go
typed/buffer.go
WriteUvarint
func (w *WriteBuffer) WriteUvarint(n uint64) { // A uvarint could be up to 10 bytes long. buf := make([]byte, 10) varBytes := binary.PutUvarint(buf, n) if b := w.reserve(varBytes); b != nil { copy(b, buf[0:varBytes]) } }
go
func (w *WriteBuffer) WriteUvarint(n uint64) { // A uvarint could be up to 10 bytes long. buf := make([]byte, 10) varBytes := binary.PutUvarint(buf, n) if b := w.reserve(varBytes); b != nil { copy(b, buf[0:varBytes]) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteUvarint", "(", "n", "uint64", ")", "{", "buf", ":=", "make", "(", "[", "]", "byte", ",", "10", ")", "\n", "varBytes", ":=", "binary", ".", "PutUvarint", "(", "buf", ",", "n", ")", "\n", "if", "b", ...
// WriteUvarint writes an unsigned varint to the buffer
[ "WriteUvarint", "writes", "an", "unsigned", "varint", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L241-L248
test
uber/tchannel-go
typed/buffer.go
WriteString
func (w *WriteBuffer) WriteString(s string) { // NB(mmihic): Don't just call WriteBytes; that will make a double copy // of the string due to the cast if b := w.reserve(len(s)); b != nil { copy(b, s) } }
go
func (w *WriteBuffer) WriteString(s string) { // NB(mmihic): Don't just call WriteBytes; that will make a double copy // of the string due to the cast if b := w.reserve(len(s)); b != nil { copy(b, s) } }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteString", "(", "s", "string", ")", "{", "if", "b", ":=", "w", ".", "reserve", "(", "len", "(", "s", ")", ")", ";", "b", "!=", "nil", "{", "copy", "(", "b", ",", "s", ")", "\n", "}", "\n", "}" ...
// WriteString writes a string to the buffer
[ "WriteString", "writes", "a", "string", "to", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L251-L257
test
uber/tchannel-go
typed/buffer.go
WriteLen8String
func (w *WriteBuffer) WriteLen8String(s string) { if int(byte(len(s))) != len(s) { w.setErr(errStringTooLong) } w.WriteSingleByte(byte(len(s))) w.WriteString(s) }
go
func (w *WriteBuffer) WriteLen8String(s string) { if int(byte(len(s))) != len(s) { w.setErr(errStringTooLong) } w.WriteSingleByte(byte(len(s))) w.WriteString(s) }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteLen8String", "(", "s", "string", ")", "{", "if", "int", "(", "byte", "(", "len", "(", "s", ")", ")", ")", "!=", "len", "(", "s", ")", "{", "w", ".", "setErr", "(", "errStringTooLong", ")", "\n", ...
// WriteLen8String writes an 8-bit length preceded string
[ "WriteLen8String", "writes", "an", "8", "-", "bit", "length", "preceded", "string" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L260-L267
test
uber/tchannel-go
typed/buffer.go
WriteLen16String
func (w *WriteBuffer) WriteLen16String(s string) { if int(uint16(len(s))) != len(s) { w.setErr(errStringTooLong) } w.WriteUint16(uint16(len(s))) w.WriteString(s) }
go
func (w *WriteBuffer) WriteLen16String(s string) { if int(uint16(len(s))) != len(s) { w.setErr(errStringTooLong) } w.WriteUint16(uint16(len(s))) w.WriteString(s) }
[ "func", "(", "w", "*", "WriteBuffer", ")", "WriteLen16String", "(", "s", "string", ")", "{", "if", "int", "(", "uint16", "(", "len", "(", "s", ")", ")", ")", "!=", "len", "(", "s", ")", "{", "w", ".", "setErr", "(", "errStringTooLong", ")", "\n",...
// WriteLen16String writes a 16-bit length preceded string
[ "WriteLen16String", "writes", "a", "16", "-", "bit", "length", "preceded", "string" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L270-L277
test
uber/tchannel-go
typed/buffer.go
DeferByte
func (w *WriteBuffer) DeferByte() ByteRef { if len(w.remaining) == 0 { w.setErr(ErrBufferFull) return ByteRef(nil) } // Always zero out references, since the caller expects the default to be 0. w.remaining[0] = 0 bufRef := ByteRef(w.remaining[0:]) w.remaining = w.remaining[1:] return bufRef }
go
func (w *WriteBuffer) DeferByte() ByteRef { if len(w.remaining) == 0 { w.setErr(ErrBufferFull) return ByteRef(nil) } // Always zero out references, since the caller expects the default to be 0. w.remaining[0] = 0 bufRef := ByteRef(w.remaining[0:]) w.remaining = w.remaining[1:] return bufRef }
[ "func", "(", "w", "*", "WriteBuffer", ")", "DeferByte", "(", ")", "ByteRef", "{", "if", "len", "(", "w", ".", "remaining", ")", "==", "0", "{", "w", ".", "setErr", "(", "ErrBufferFull", ")", "\n", "return", "ByteRef", "(", "nil", ")", "\n", "}", ...
// DeferByte reserves space in the buffer for a single byte, and returns a // reference that can be used to update that byte later
[ "DeferByte", "reserves", "space", "in", "the", "buffer", "for", "a", "single", "byte", "and", "returns", "a", "reference", "that", "can", "be", "used", "to", "update", "that", "byte", "later" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L281-L292
test
uber/tchannel-go
typed/buffer.go
DeferBytes
func (w *WriteBuffer) DeferBytes(n int) BytesRef { return BytesRef(w.deferred(n)) }
go
func (w *WriteBuffer) DeferBytes(n int) BytesRef { return BytesRef(w.deferred(n)) }
[ "func", "(", "w", "*", "WriteBuffer", ")", "DeferBytes", "(", "n", "int", ")", "BytesRef", "{", "return", "BytesRef", "(", "w", ".", "deferred", "(", "n", ")", ")", "\n", "}" ]
// DeferBytes reserves space in the buffer for a fixed sequence of bytes, and // returns a reference that can be used to update those bytes
[ "DeferBytes", "reserves", "space", "in", "the", "buffer", "for", "a", "fixed", "sequence", "of", "bytes", "and", "returns", "a", "reference", "that", "can", "be", "used", "to", "update", "those", "bytes" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L314-L316
test
uber/tchannel-go
typed/buffer.go
FlushTo
func (w *WriteBuffer) FlushTo(iow io.Writer) (int, error) { dirty := w.buffer[0:w.BytesWritten()] return iow.Write(dirty) }
go
func (w *WriteBuffer) FlushTo(iow io.Writer) (int, error) { dirty := w.buffer[0:w.BytesWritten()] return iow.Write(dirty) }
[ "func", "(", "w", "*", "WriteBuffer", ")", "FlushTo", "(", "iow", "io", ".", "Writer", ")", "(", "int", ",", "error", ")", "{", "dirty", ":=", "w", ".", "buffer", "[", "0", ":", "w", ".", "BytesWritten", "(", ")", "]", "\n", "return", "iow", "....
// FlushTo flushes the written buffer to the given writer
[ "FlushTo", "flushes", "the", "written", "buffer", "to", "the", "given", "writer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L347-L350
test
uber/tchannel-go
typed/buffer.go
Reset
func (w *WriteBuffer) Reset() { w.remaining = w.buffer w.err = nil }
go
func (w *WriteBuffer) Reset() { w.remaining = w.buffer w.err = nil }
[ "func", "(", "w", "*", "WriteBuffer", ")", "Reset", "(", ")", "{", "w", ".", "remaining", "=", "w", ".", "buffer", "\n", "w", ".", "err", "=", "nil", "\n", "}" ]
// Reset resets the buffer to an empty state, ready for writing
[ "Reset", "resets", "the", "buffer", "to", "an", "empty", "state", "ready", "for", "writing" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L356-L359
test
uber/tchannel-go
typed/buffer.go
Wrap
func (w *WriteBuffer) Wrap(b []byte) { w.buffer = b w.remaining = b }
go
func (w *WriteBuffer) Wrap(b []byte) { w.buffer = b w.remaining = b }
[ "func", "(", "w", "*", "WriteBuffer", ")", "Wrap", "(", "b", "[", "]", "byte", ")", "{", "w", ".", "buffer", "=", "b", "\n", "w", ".", "remaining", "=", "b", "\n", "}" ]
// Wrap initializes the buffer to wrap the given byte slice
[ "Wrap", "initializes", "the", "buffer", "to", "wrap", "the", "given", "byte", "slice" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L374-L377
test
uber/tchannel-go
typed/buffer.go
Update
func (ref Uint16Ref) Update(n uint16) { if ref != nil { binary.BigEndian.PutUint16(ref, n) } }
go
func (ref Uint16Ref) Update(n uint16) { if ref != nil { binary.BigEndian.PutUint16(ref, n) } }
[ "func", "(", "ref", "Uint16Ref", ")", "Update", "(", "n", "uint16", ")", "{", "if", "ref", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint16", "(", "ref", ",", "n", ")", "\n", "}", "\n", "}" ]
// Update updates the uint16 in the buffer
[ "Update", "updates", "the", "uint16", "in", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L393-L397
test
uber/tchannel-go
typed/buffer.go
Update
func (ref Uint32Ref) Update(n uint32) { if ref != nil { binary.BigEndian.PutUint32(ref, n) } }
go
func (ref Uint32Ref) Update(n uint32) { if ref != nil { binary.BigEndian.PutUint32(ref, n) } }
[ "func", "(", "ref", "Uint32Ref", ")", "Update", "(", "n", "uint32", ")", "{", "if", "ref", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint32", "(", "ref", ",", "n", ")", "\n", "}", "\n", "}" ]
// Update updates the uint32 in the buffer
[ "Update", "updates", "the", "uint32", "in", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L403-L407
test
uber/tchannel-go
typed/buffer.go
Update
func (ref Uint64Ref) Update(n uint64) { if ref != nil { binary.BigEndian.PutUint64(ref, n) } }
go
func (ref Uint64Ref) Update(n uint64) { if ref != nil { binary.BigEndian.PutUint64(ref, n) } }
[ "func", "(", "ref", "Uint64Ref", ")", "Update", "(", "n", "uint64", ")", "{", "if", "ref", "!=", "nil", "{", "binary", ".", "BigEndian", ".", "PutUint64", "(", "ref", ",", "n", ")", "\n", "}", "\n", "}" ]
// Update updates the uint64 in the buffer
[ "Update", "updates", "the", "uint64", "in", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L413-L417
test
uber/tchannel-go
typed/buffer.go
Update
func (ref BytesRef) Update(b []byte) { if ref != nil { copy(ref, b) } }
go
func (ref BytesRef) Update(b []byte) { if ref != nil { copy(ref, b) } }
[ "func", "(", "ref", "BytesRef", ")", "Update", "(", "b", "[", "]", "byte", ")", "{", "if", "ref", "!=", "nil", "{", "copy", "(", "ref", ",", "b", ")", "\n", "}", "\n", "}" ]
// Update updates the bytes in the buffer
[ "Update", "updates", "the", "bytes", "in", "the", "buffer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L423-L427
test
uber/tchannel-go
typed/buffer.go
UpdateString
func (ref BytesRef) UpdateString(s string) { if ref != nil { copy(ref, s) } }
go
func (ref BytesRef) UpdateString(s string) { if ref != nil { copy(ref, s) } }
[ "func", "(", "ref", "BytesRef", ")", "UpdateString", "(", "s", "string", ")", "{", "if", "ref", "!=", "nil", "{", "copy", "(", "ref", ",", "s", ")", "\n", "}", "\n", "}" ]
// UpdateString updates the bytes in the buffer from a string
[ "UpdateString", "updates", "the", "bytes", "in", "the", "buffer", "from", "a", "string" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/typed/buffer.go#L430-L434
test
uber/tchannel-go
fragmenting_reader.go
ArgReader
func (r *fragmentingReader) ArgReader(last bool) (ArgReader, error) { if err := r.BeginArgument(last); err != nil { return nil, err } return r, nil }
go
func (r *fragmentingReader) ArgReader(last bool) (ArgReader, error) { if err := r.BeginArgument(last); err != nil { return nil, err } return r, nil }
[ "func", "(", "r", "*", "fragmentingReader", ")", "ArgReader", "(", "last", "bool", ")", "(", "ArgReader", ",", "error", ")", "{", "if", "err", ":=", "r", ".", "BeginArgument", "(", "last", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "e...
// The ArgReader will handle fragmentation as needed. Once the argument has // been read, the ArgReader must be closed.
[ "The", "ArgReader", "will", "handle", "fragmentation", "as", "needed", ".", "Once", "the", "argument", "has", "been", "read", "the", "ArgReader", "must", "be", "closed", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_reader.go#L105-L110
test
uber/tchannel-go
fragmenting_writer.go
finish
func (f *writableFragment) finish(hasMoreFragments bool) { f.checksumRef.Update(f.checksum.Sum()) if hasMoreFragments { f.flagsRef.Update(hasMoreFragmentsFlag) } else { f.checksum.Release() } }
go
func (f *writableFragment) finish(hasMoreFragments bool) { f.checksumRef.Update(f.checksum.Sum()) if hasMoreFragments { f.flagsRef.Update(hasMoreFragmentsFlag) } else { f.checksum.Release() } }
[ "func", "(", "f", "*", "writableFragment", ")", "finish", "(", "hasMoreFragments", "bool", ")", "{", "f", ".", "checksumRef", ".", "Update", "(", "f", ".", "checksum", ".", "Sum", "(", ")", ")", "\n", "if", "hasMoreFragments", "{", "f", ".", "flagsRef"...
// finish finishes the fragment, updating the final checksum and fragment flags
[ "finish", "finishes", "the", "fragment", "updating", "the", "final", "checksum", "and", "fragment", "flags" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L53-L60
test
uber/tchannel-go
fragmenting_writer.go
newWritableChunk
func newWritableChunk(checksum Checksum, contents *typed.WriteBuffer) *writableChunk { return &writableChunk{ size: 0, sizeRef: contents.DeferUint16(), checksum: checksum, contents: contents, } }
go
func newWritableChunk(checksum Checksum, contents *typed.WriteBuffer) *writableChunk { return &writableChunk{ size: 0, sizeRef: contents.DeferUint16(), checksum: checksum, contents: contents, } }
[ "func", "newWritableChunk", "(", "checksum", "Checksum", ",", "contents", "*", "typed", ".", "WriteBuffer", ")", "*", "writableChunk", "{", "return", "&", "writableChunk", "{", "size", ":", "0", ",", "sizeRef", ":", "contents", ".", "DeferUint16", "(", ")", ...
// newWritableChunk creates a new writable chunk around a checksum and a buffer to hold data
[ "newWritableChunk", "creates", "a", "new", "writable", "chunk", "around", "a", "checksum", "and", "a", "buffer", "to", "hold", "data" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L72-L79
test
uber/tchannel-go
fragmenting_writer.go
writeAsFits
func (c *writableChunk) writeAsFits(b []byte) int { if len(b) > c.contents.BytesRemaining() { b = b[:c.contents.BytesRemaining()] } c.checksum.Add(b) c.contents.WriteBytes(b) written := len(b) c.size += uint16(written) return written }
go
func (c *writableChunk) writeAsFits(b []byte) int { if len(b) > c.contents.BytesRemaining() { b = b[:c.contents.BytesRemaining()] } c.checksum.Add(b) c.contents.WriteBytes(b) written := len(b) c.size += uint16(written) return written }
[ "func", "(", "c", "*", "writableChunk", ")", "writeAsFits", "(", "b", "[", "]", "byte", ")", "int", "{", "if", "len", "(", "b", ")", ">", "c", ".", "contents", ".", "BytesRemaining", "(", ")", "{", "b", "=", "b", "[", ":", "c", ".", "contents",...
// writeAsFits writes as many bytes from the given slice as fits into the chunk
[ "writeAsFits", "writes", "as", "many", "bytes", "from", "the", "given", "slice", "as", "fits", "into", "the", "chunk" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L82-L93
test
uber/tchannel-go
fragmenting_writer.go
newFragmentingWriter
func newFragmentingWriter(logger Logger, sender fragmentSender, checksum Checksum) *fragmentingWriter { return &fragmentingWriter{ logger: logger, sender: sender, checksum: checksum, state: fragmentingWriteStart, } }
go
func newFragmentingWriter(logger Logger, sender fragmentSender, checksum Checksum) *fragmentingWriter { return &fragmentingWriter{ logger: logger, sender: sender, checksum: checksum, state: fragmentingWriteStart, } }
[ "func", "newFragmentingWriter", "(", "logger", "Logger", ",", "sender", "fragmentSender", ",", "checksum", "Checksum", ")", "*", "fragmentingWriter", "{", "return", "&", "fragmentingWriter", "{", "logger", ":", "logger", ",", "sender", ":", "sender", ",", "check...
// newFragmentingWriter creates a new fragmenting writer
[ "newFragmentingWriter", "creates", "a", "new", "fragmenting", "writer" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L141-L148
test
uber/tchannel-go
fragmenting_writer.go
ArgWriter
func (w *fragmentingWriter) ArgWriter(last bool) (ArgWriter, error) { if err := w.BeginArgument(last); err != nil { return nil, err } return w, nil }
go
func (w *fragmentingWriter) ArgWriter(last bool) (ArgWriter, error) { if err := w.BeginArgument(last); err != nil { return nil, err } return w, nil }
[ "func", "(", "w", "*", "fragmentingWriter", ")", "ArgWriter", "(", "last", "bool", ")", "(", "ArgWriter", ",", "error", ")", "{", "if", "err", ":=", "w", ".", "BeginArgument", "(", "last", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "e...
// ArgWriter returns an ArgWriter to write an argument. The ArgWriter will handle // fragmentation as needed. Once the argument is written, the ArgWriter must be closed.
[ "ArgWriter", "returns", "an", "ArgWriter", "to", "write", "an", "argument", ".", "The", "ArgWriter", "will", "handle", "fragmentation", "as", "needed", ".", "Once", "the", "argument", "is", "written", "the", "ArgWriter", "must", "be", "closed", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L152-L157
test
uber/tchannel-go
fragmenting_writer.go
BeginArgument
func (w *fragmentingWriter) BeginArgument(last bool) error { if w.err != nil { return w.err } switch { case w.state == fragmentingWriteComplete: w.err = errComplete return w.err case w.state.isWritingArgument(): w.err = errAlreadyWritingArgument return w.err } // If we don't have a fragment, request ...
go
func (w *fragmentingWriter) BeginArgument(last bool) error { if w.err != nil { return w.err } switch { case w.state == fragmentingWriteComplete: w.err = errComplete return w.err case w.state.isWritingArgument(): w.err = errAlreadyWritingArgument return w.err } // If we don't have a fragment, request ...
[ "func", "(", "w", "*", "fragmentingWriter", ")", "BeginArgument", "(", "last", "bool", ")", "error", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "w", ".", "err", "\n", "}", "\n", "switch", "{", "case", "w", ".", "state", "==", "fragment...
// BeginArgument tells the writer that the caller is starting a new argument. // Must not be called while an existing argument is in place
[ "BeginArgument", "tells", "the", "writer", "that", "the", "caller", "is", "starting", "a", "new", "argument", ".", "Must", "not", "be", "called", "while", "an", "existing", "argument", "is", "in", "place" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L161-L197
test
uber/tchannel-go
fragmenting_writer.go
Write
func (w *fragmentingWriter) Write(b []byte) (int, error) { if w.err != nil { return 0, w.err } if !w.state.isWritingArgument() { w.err = errNotWritingArgument return 0, w.err } totalWritten := 0 for { bytesWritten := w.curChunk.writeAsFits(b) totalWritten += bytesWritten if bytesWritten == len(b) { ...
go
func (w *fragmentingWriter) Write(b []byte) (int, error) { if w.err != nil { return 0, w.err } if !w.state.isWritingArgument() { w.err = errNotWritingArgument return 0, w.err } totalWritten := 0 for { bytesWritten := w.curChunk.writeAsFits(b) totalWritten += bytesWritten if bytesWritten == len(b) { ...
[ "func", "(", "w", "*", "fragmentingWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "0", ",", "w", ".", "err", "\n", "}", "\n", "if", "!", "w", "....
// Write writes argument data, breaking it into fragments as needed
[ "Write", "writes", "argument", "data", "breaking", "it", "into", "fragments", "as", "needed" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L200-L227
test
uber/tchannel-go
fragmenting_writer.go
Flush
func (w *fragmentingWriter) Flush() error { w.curChunk.finish() w.curFragment.finish(true) if w.err = w.sender.flushFragment(w.curFragment); w.err != nil { return w.err } if w.curFragment, w.err = w.sender.newFragment(false, w.checksum); w.err != nil { return w.err } w.curChunk = newWritableChunk(w.checksu...
go
func (w *fragmentingWriter) Flush() error { w.curChunk.finish() w.curFragment.finish(true) if w.err = w.sender.flushFragment(w.curFragment); w.err != nil { return w.err } if w.curFragment, w.err = w.sender.newFragment(false, w.checksum); w.err != nil { return w.err } w.curChunk = newWritableChunk(w.checksu...
[ "func", "(", "w", "*", "fragmentingWriter", ")", "Flush", "(", ")", "error", "{", "w", ".", "curChunk", ".", "finish", "(", ")", "\n", "w", ".", "curFragment", ".", "finish", "(", "true", ")", "\n", "if", "w", ".", "err", "=", "w", ".", "sender",...
// Flush flushes the current fragment, and starts a new fragment and chunk.
[ "Flush", "flushes", "the", "current", "fragment", "and", "starts", "a", "new", "fragment", "and", "chunk", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L230-L243
test
uber/tchannel-go
fragmenting_writer.go
Close
func (w *fragmentingWriter) Close() error { last := w.state == fragmentingWriteInLastArgument if w.err != nil { return w.err } if !w.state.isWritingArgument() { w.err = errNotWritingArgument return w.err } w.curChunk.finish() // There are three possibilities here: // 1. There are no more arguments // ...
go
func (w *fragmentingWriter) Close() error { last := w.state == fragmentingWriteInLastArgument if w.err != nil { return w.err } if !w.state.isWritingArgument() { w.err = errNotWritingArgument return w.err } w.curChunk.finish() // There are three possibilities here: // 1. There are no more arguments // ...
[ "func", "(", "w", "*", "fragmentingWriter", ")", "Close", "(", ")", "error", "{", "last", ":=", "w", ".", "state", "==", "fragmentingWriteInLastArgument", "\n", "if", "w", ".", "err", "!=", "nil", "{", "return", "w", ".", "err", "\n", "}", "\n", "if"...
// Close ends the current argument.
[ "Close", "ends", "the", "current", "argument", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/fragmenting_writer.go#L246-L296
test
uber/tchannel-go
outbound.go
handleCallRes
func (c *Connection) handleCallRes(frame *Frame) bool { if err := c.outbound.forwardPeerFrame(frame); err != nil { return true } return false }
go
func (c *Connection) handleCallRes(frame *Frame) bool { if err := c.outbound.forwardPeerFrame(frame); err != nil { return true } return false }
[ "func", "(", "c", "*", "Connection", ")", "handleCallRes", "(", "frame", "*", "Frame", ")", "bool", "{", "if", "err", ":=", "c", ".", "outbound", ".", "forwardPeerFrame", "(", "frame", ")", ";", "err", "!=", "nil", "{", "return", "true", "\n", "}", ...
// handleCallRes handles an incoming call req message, forwarding the // frame to the response channel waiting for it
[ "handleCallRes", "handles", "an", "incoming", "call", "req", "message", "forwarding", "the", "frame", "to", "the", "response", "channel", "waiting", "for", "it" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/outbound.go#L142-L147
test
uber/tchannel-go
outbound.go
Arg2Reader
func (response *OutboundCallResponse) Arg2Reader() (ArgReader, error) { var method []byte if err := NewArgReader(response.arg1Reader()).Read(&method); err != nil { return nil, err } return response.arg2Reader() }
go
func (response *OutboundCallResponse) Arg2Reader() (ArgReader, error) { var method []byte if err := NewArgReader(response.arg1Reader()).Read(&method); err != nil { return nil, err } return response.arg2Reader() }
[ "func", "(", "response", "*", "OutboundCallResponse", ")", "Arg2Reader", "(", ")", "(", "ArgReader", ",", "error", ")", "{", "var", "method", "[", "]", "byte", "\n", "if", "err", ":=", "NewArgReader", "(", "response", ".", "arg1Reader", "(", ")", ")", ...
// Arg2Reader returns an ArgReader to read the second argument. // The ReadCloser must be closed once the argument has been read.
[ "Arg2Reader", "returns", "an", "ArgReader", "to", "read", "the", "second", "argument", ".", "The", "ReadCloser", "must", "be", "closed", "once", "the", "argument", "has", "been", "read", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/outbound.go#L251-L258
test
uber/tchannel-go
outbound.go
handleError
func (c *Connection) handleError(frame *Frame) bool { errMsg := errorMessage{ id: frame.Header.ID, } rbuf := typed.NewReadBuffer(frame.SizedPayload()) if err := errMsg.read(rbuf); err != nil { c.log.WithFields( LogField{"remotePeer", c.remotePeerInfo}, ErrField(err), ).Warn("Unable to read error frame."...
go
func (c *Connection) handleError(frame *Frame) bool { errMsg := errorMessage{ id: frame.Header.ID, } rbuf := typed.NewReadBuffer(frame.SizedPayload()) if err := errMsg.read(rbuf); err != nil { c.log.WithFields( LogField{"remotePeer", c.remotePeerInfo}, ErrField(err), ).Warn("Unable to read error frame."...
[ "func", "(", "c", "*", "Connection", ")", "handleError", "(", "frame", "*", "Frame", ")", "bool", "{", "errMsg", ":=", "errorMessage", "{", "id", ":", "frame", ".", "Header", ".", "ID", ",", "}", "\n", "rbuf", ":=", "typed", ".", "NewReadBuffer", "("...
// handleError handles an error coming back from the peer. If the error is a // protocol level error, the entire connection will be closed. If the error is // a request specific error, it will be written to the request's response // channel and converted into a SystemError returned from the next reader or // access ca...
[ "handleError", "handles", "an", "error", "coming", "back", "from", "the", "peer", ".", "If", "the", "error", "is", "a", "protocol", "level", "error", "the", "entire", "connection", "will", "be", "closed", ".", "If", "the", "error", "is", "a", "request", ...
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/outbound.go#L272-L308
test
uber/tchannel-go
outbound.go
doneReading
func (response *OutboundCallResponse) doneReading(unexpected error) { now := response.timeNow() isSuccess := unexpected == nil && !response.ApplicationError() lastAttempt := isSuccess || !response.requestState.HasRetries(unexpected) // TODO how should this work with retries? if span := response.span; span != nil...
go
func (response *OutboundCallResponse) doneReading(unexpected error) { now := response.timeNow() isSuccess := unexpected == nil && !response.ApplicationError() lastAttempt := isSuccess || !response.requestState.HasRetries(unexpected) // TODO how should this work with retries? if span := response.span; span != nil...
[ "func", "(", "response", "*", "OutboundCallResponse", ")", "doneReading", "(", "unexpected", "error", ")", "{", "now", ":=", "response", ".", "timeNow", "(", ")", "\n", "isSuccess", ":=", "unexpected", "==", "nil", "&&", "!", "response", ".", "ApplicationErr...
// doneReading shuts down the message exchange for this call. // For outgoing calls, the last message is reading the call response.
[ "doneReading", "shuts", "down", "the", "message", "exchange", "for", "this", "call", ".", "For", "outgoing", "calls", "the", "last", "message", "is", "reading", "the", "call", "response", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/outbound.go#L320-L363
test
uber/tchannel-go
reqres.go
newFragment
func (w *reqResWriter) newFragment(initial bool, checksum Checksum) (*writableFragment, error) { if err := w.mex.checkError(); err != nil { return nil, w.failed(err) } message := w.messageForFragment(initial) // Create the frame frame := w.conn.opts.FramePool.Get() frame.Header.ID = w.mex.msgID frame.Header....
go
func (w *reqResWriter) newFragment(initial bool, checksum Checksum) (*writableFragment, error) { if err := w.mex.checkError(); err != nil { return nil, w.failed(err) } message := w.messageForFragment(initial) // Create the frame frame := w.conn.opts.FramePool.Get() frame.Header.ID = w.mex.msgID frame.Header....
[ "func", "(", "w", "*", "reqResWriter", ")", "newFragment", "(", "initial", "bool", ",", "checksum", "Checksum", ")", "(", "*", "writableFragment", ",", "error", ")", "{", "if", "err", ":=", "w", ".", "mex", ".", "checkError", "(", ")", ";", "err", "!...
// newFragment creates a new fragment for marshaling into
[ "newFragment", "creates", "a", "new", "fragment", "for", "marshaling", "into" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L111-L136
test
uber/tchannel-go
reqres.go
flushFragment
func (w *reqResWriter) flushFragment(fragment *writableFragment) error { if w.err != nil { return w.err } frame := fragment.frame.(*Frame) frame.Header.SetPayloadSize(uint16(fragment.contents.BytesWritten())) if err := w.mex.checkError(); err != nil { return w.failed(err) } select { case <-w.mex.ctx.Done(...
go
func (w *reqResWriter) flushFragment(fragment *writableFragment) error { if w.err != nil { return w.err } frame := fragment.frame.(*Frame) frame.Header.SetPayloadSize(uint16(fragment.contents.BytesWritten())) if err := w.mex.checkError(); err != nil { return w.failed(err) } select { case <-w.mex.ctx.Done(...
[ "func", "(", "w", "*", "reqResWriter", ")", "flushFragment", "(", "fragment", "*", "writableFragment", ")", "error", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "w", ".", "err", "\n", "}", "\n", "frame", ":=", "fragment", ".", "frame", "....
// flushFragment sends a fragment to the peer over the connection
[ "flushFragment", "sends", "a", "fragment", "to", "the", "peer", "over", "the", "connection" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L139-L158
test
uber/tchannel-go
reqres.go
failed
func (w *reqResWriter) failed(err error) error { w.log.Debugf("writer failed: %v existing err: %v", err, w.err) if w.err != nil { return w.err } w.mex.shutdown() w.err = err return w.err }
go
func (w *reqResWriter) failed(err error) error { w.log.Debugf("writer failed: %v existing err: %v", err, w.err) if w.err != nil { return w.err } w.mex.shutdown() w.err = err return w.err }
[ "func", "(", "w", "*", "reqResWriter", ")", "failed", "(", "err", "error", ")", "error", "{", "w", ".", "log", ".", "Debugf", "(", "\"writer failed: %v existing err: %v\"", ",", "err", ",", "w", ".", "err", ")", "\n", "if", "w", ".", "err", "!=", "ni...
// failed marks the writer as having failed
[ "failed", "marks", "the", "writer", "as", "having", "failed" ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L161-L170
test
uber/tchannel-go
reqres.go
arg1Reader
func (r *reqResReader) arg1Reader() (ArgReader, error) { return r.argReader(false /* last */, reqResReaderPreArg1, reqResReaderPreArg2) }
go
func (r *reqResReader) arg1Reader() (ArgReader, error) { return r.argReader(false /* last */, reqResReaderPreArg1, reqResReaderPreArg2) }
[ "func", "(", "r", "*", "reqResReader", ")", "arg1Reader", "(", ")", "(", "ArgReader", ",", "error", ")", "{", "return", "r", ".", "argReader", "(", "false", ",", "reqResReaderPreArg1", ",", "reqResReaderPreArg2", ")", "\n", "}" ]
// arg1Reader returns an ArgReader to read arg1.
[ "arg1Reader", "returns", "an", "ArgReader", "to", "read", "arg1", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L195-L197
test
uber/tchannel-go
reqres.go
arg2Reader
func (r *reqResReader) arg2Reader() (ArgReader, error) { return r.argReader(false /* last */, reqResReaderPreArg2, reqResReaderPreArg3) }
go
func (r *reqResReader) arg2Reader() (ArgReader, error) { return r.argReader(false /* last */, reqResReaderPreArg2, reqResReaderPreArg3) }
[ "func", "(", "r", "*", "reqResReader", ")", "arg2Reader", "(", ")", "(", "ArgReader", ",", "error", ")", "{", "return", "r", ".", "argReader", "(", "false", ",", "reqResReaderPreArg2", ",", "reqResReaderPreArg3", ")", "\n", "}" ]
// arg2Reader returns an ArgReader to read arg2.
[ "arg2Reader", "returns", "an", "ArgReader", "to", "read", "arg2", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L200-L202
test
uber/tchannel-go
reqres.go
arg3Reader
func (r *reqResReader) arg3Reader() (ArgReader, error) { return r.argReader(true /* last */, reqResReaderPreArg3, reqResReaderComplete) }
go
func (r *reqResReader) arg3Reader() (ArgReader, error) { return r.argReader(true /* last */, reqResReaderPreArg3, reqResReaderComplete) }
[ "func", "(", "r", "*", "reqResReader", ")", "arg3Reader", "(", ")", "(", "ArgReader", ",", "error", ")", "{", "return", "r", ".", "argReader", "(", "true", ",", "reqResReaderPreArg3", ",", "reqResReaderComplete", ")", "\n", "}" ]
// arg3Reader returns an ArgReader to read arg3.
[ "arg3Reader", "returns", "an", "ArgReader", "to", "read", "arg3", "." ]
3c9ced6d946fe2fec6c915703a533e966c09e07a
https://github.com/uber/tchannel-go/blob/3c9ced6d946fe2fec6c915703a533e966c09e07a/reqres.go#L205-L207
test