func (fh *fixedHosts) Get(call relay.CallFrame, _ relay.Conn) (relay.Peer, error) { peers := fh.hosts[string(call.Service())] if len(peers) == 0 { return relay.Peer{}, nil } pickI := int(fh.pickI.Inc()-1) % len(peers) return relay.Peer{HostPort: peers[pickI]}, nil }
func (mt *mockTable) Get(call relay.CallFrame, conn relay.Conn) (relay.Peer, error) { serviceName := string(call.Service()) sc := mt.ch.GetSubChannel(serviceName, tchannel.Isolated) peer, err := sc.Peers().Get(nil) if err != nil { return relay.Peer{}, err } return relay.Peer{ HostPort: peer.HostPort(), }, nil }
// Begin starts collecting metrics for an RPC. func (m *MockStats) Begin(f relay.CallFrame) relay.CallStats { return m.Add(string(f.Caller()), string(f.Service()), string(f.Method())).MockCallStats }