rpc_network_crawler_go/data_server.go
jackdaw@loafle.com 85efc8ea7a of_rpc => grpc
2017-04-13 16:12:21 +09:00

26 lines
445 B
Go

package main
import (
"golang.org/x/net/context"
pb "loafle.com/overflow/crawler_go/grpc"
)
type DataServer struct {
}
func (s *DataServer) Get(c context.Context, in *pb.Input) (*pb.Output, error) {
output := &pb.Output{}
if c, ok := g_crawlers[in.Name.String()]; ok {
rd, err := c.Get(in.Id)
if err != nil {
// process error
}
output.Data = rd
} else {
output.Data = []byte("Not Assign Crawler")
}
return output, nil
}