overflow_discovery/rpc/discovery_service.go

66 lines
1.8 KiB
Go
Raw Normal View History

2017-10-27 06:01:09 +00:00
package rpc
import (
"log"
)
type DiscoveryService struct {
}
type StartRequestParam struct {
Name string
Count int
}
type StartResponseParam struct {
Result int
}
2017-11-03 12:25:38 +00:00
// func (ds *DiscoveryService) Start(req *StartRequestParam) (*StartResponseParam, error) {
// log.Printf("DiscoveryService.Start param: Name[%s] Count[%d]", req.Name, req.Count)
// res := &StartResponseParam{}
// res.Result = 10 + req.Count
// return res, nil
// }
// func (ds *DiscoveryService) Discovery(name string, req *StartRequestParam) error {
// log.Printf("DiscoveryService.Discovery param: Name[%s] req[%v]", name, req)
// return nil
// }
// func (ds *DiscoveryService) Discovery1(count int, name string, req *StartRequestParam) error {
// log.Printf("DiscoveryService.Discovery param: Count[%d] Name[%s] req[%v]", count, name, req)
// return nil
// }
func (ds *DiscoveryService) Discovery2(count int, name string, req *StartRequestParam) (*StartResponseParam, error) {
log.Printf("DiscoveryService.Discovery2 param: count[%d] name[%s] req.Name[%s] req.Count[%d]", count, name, req.Name, req.Count)
res := &StartResponseParam{}
res.Result = 10 + req.Count
return res, nil
}
func (ds *DiscoveryService) Discovery3(names []string, req *StartRequestParam) (*StartResponseParam, error) {
log.Printf("DiscoveryService.Discovery3 param: names[%v] req.Name[%s] req.Count[%d]", names, req.Name, req.Count)
2017-11-02 06:43:42 +00:00
res := &StartResponseParam{}
2017-10-27 06:01:09 +00:00
2017-11-02 02:10:04 +00:00
res.Result = 10 + req.Count
2017-10-27 06:01:09 +00:00
2017-11-02 06:43:42 +00:00
return res, nil
}
2017-11-03 12:25:38 +00:00
func (ds *DiscoveryService) Discovery4(names map[string]string, req *StartRequestParam) (*StartResponseParam, error) {
log.Printf("DiscoveryService.Discovery4 param: names[%v] req.Name[%s] req.Count[%d]", names, req.Name, req.Count)
res := &StartResponseParam{}
res.Result = 10 + req.Count
2017-11-02 06:43:42 +00:00
2017-11-03 12:25:38 +00:00
return res, nil
2017-10-27 06:01:09 +00:00
}