Пример #1
0
func SetupTrpc(b *testing.B, f thrift.TProtocolFactory) (*TRpcServer, func() *gen.HFileServiceClient) {
	s, err := NewTRpcServer("localhost:0", gen.NewHFileServiceProcessor(compressed), f)

	if err != nil {
		b.Fatal(err)
	} else if err = s.Listen(); err != nil {
		b.Fatal(err)
	}

	go func() {
		if err := s.Serve(); err != nil {
			b.Fatal(err)
		}
	}()

	getClient := func() *gen.HFileServiceClient {
		conn, err := s.GetClientTransport()
		if err != nil {
			b.Fatal(err)
		}
		return gen.NewHFileServiceClientFactory(conn, f)
	}
	return s, getClient
}
Пример #2
0
func NewHttpRpcHandler(cs *hfile.CollectionSet) *HttpRpcHandler {
	impl := gen.NewHFileServiceProcessor(&ThriftRpcImpl{cs})
	return &HttpRpcHandler{impl}
}
Пример #3
0
func WrapProcessor(cs *hfile.CollectionSet, stats *report.Recorder) thrift.TProcessor {
	return thriftrpc.AddLogging(gen.NewHFileServiceProcessor(&ThriftRpcImpl{cs}), stats, Settings.debug)
}