Ejemplo n.º 1
0
// New prepares an implementation of the KeyValue service for
// registration.
//
// 	handler := KeyValueHandler{}
// 	dispatcher.Register(keyvalueserver.New(handler))
func New(impl Interface, opts ...thrift.RegisterOption) []transport.Registrant {
	h := handler{impl}
	service := thrift.Service{
		Name: "KeyValue",
		Methods: map[string]thrift.UnaryHandler{
			"getValue": thrift.UnaryHandlerFunc(h.GetValue),
			"setValue": thrift.UnaryHandlerFunc(h.SetValue),
		},
		OnewayMethods: map[string]thrift.OnewayHandler{},
	}
	return thrift.BuildRegistrants(service, opts...)
}
Ejemplo n.º 2
0
// New prepares an implementation of the SecondService service for
// registration.
//
// 	handler := SecondServiceHandler{}
// 	dispatcher.Register(secondserviceserver.New(handler))
func New(impl Interface, opts ...thrift.RegisterOption) []transport.Registrant {
	h := handler{impl}
	service := thrift.Service{
		Name: "SecondService",
		Methods: map[string]thrift.UnaryHandler{
			"blahBlah":         thrift.UnaryHandlerFunc(h.BlahBlah),
			"secondtestString": thrift.UnaryHandlerFunc(h.SecondtestString),
		},
		OnewayMethods: map[string]thrift.OnewayHandler{},
	}
	return thrift.BuildRegistrants(service, opts...)
}
Ejemplo n.º 3
0
// New prepares an implementation of the Hello service for
// registration.
//
// 	handler := HelloHandler{}
// 	dispatcher.Register(helloserver.New(handler))
func New(impl Interface, opts ...thrift.RegisterOption) []transport.Registrant {
	h := handler{impl}
	service := thrift.Service{
		Name: "Hello",
		Methods: map[string]thrift.UnaryHandler{
			"echo": thrift.UnaryHandlerFunc(h.Echo),
		},
		OnewayMethods: map[string]thrift.OnewayHandler{},
	}
	return thrift.BuildRegistrants(service, opts...)
}
Ejemplo n.º 4
0
// New prepares an implementation of the ThriftTest service for
// registration.
//
// 	handler := ThriftTestHandler{}
// 	dispatcher.Register(thrifttestserver.New(handler))
func New(impl Interface, opts ...thrift.RegisterOption) []transport.Registrant {
	h := handler{impl}
	service := thrift.Service{
		Name: "ThriftTest",
		Methods: map[string]thrift.UnaryHandler{
			"testBinary":         thrift.UnaryHandlerFunc(h.TestBinary),
			"testByte":           thrift.UnaryHandlerFunc(h.TestByte),
			"testDouble":         thrift.UnaryHandlerFunc(h.TestDouble),
			"testEnum":           thrift.UnaryHandlerFunc(h.TestEnum),
			"testException":      thrift.UnaryHandlerFunc(h.TestException),
			"testI32":            thrift.UnaryHandlerFunc(h.TestI32),
			"testI64":            thrift.UnaryHandlerFunc(h.TestI64),
			"testInsanity":       thrift.UnaryHandlerFunc(h.TestInsanity),
			"testList":           thrift.UnaryHandlerFunc(h.TestList),
			"testMap":            thrift.UnaryHandlerFunc(h.TestMap),
			"testMapMap":         thrift.UnaryHandlerFunc(h.TestMapMap),
			"testMulti":          thrift.UnaryHandlerFunc(h.TestMulti),
			"testMultiException": thrift.UnaryHandlerFunc(h.TestMultiException),
			"testNest":           thrift.UnaryHandlerFunc(h.TestNest),

			"testSet":       thrift.UnaryHandlerFunc(h.TestSet),
			"testString":    thrift.UnaryHandlerFunc(h.TestString),
			"testStringMap": thrift.UnaryHandlerFunc(h.TestStringMap),
			"testStruct":    thrift.UnaryHandlerFunc(h.TestStruct),
			"testTypedef":   thrift.UnaryHandlerFunc(h.TestTypedef),
			"testVoid":      thrift.UnaryHandlerFunc(h.TestVoid),
		},
		OnewayMethods: map[string]thrift.OnewayHandler{

			"testOneway": thrift.OnewayHandlerFunc(h.TestOneway),
		},
	}
	return thrift.BuildRegistrants(service, opts...)
}