예제 #1
0
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
}
예제 #2
0
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
}
예제 #3
0
파일: fakes.go 프로젝트: uber/tchannel-go
// 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
}