diff --git a/client/go/main.go b/client/go/main.go index ca2d662f8e0253164345b6d5083303a275dc30b7..53f741a4ef363e465702480084722c3682b65e6b 100644 --- a/client/go/main.go +++ b/client/go/main.go @@ -21,7 +21,6 @@ import ( "fmt" "golang.org/x/net/context" - "google.golang.org/grpc" "github.com/dgraph-io/dgraph/query/pb" @@ -30,18 +29,10 @@ import ( var glog = x.Log("client") var port = flag.String("port", "9090", "Port to communicate with server") +var query = flag.String("query", "", "Query sent to the server") func main() { - // TODO(pawan) - Remove hardcoded query. Give helper methods to user for building query. - var q0 = `{ - me(_xid_: m.0f4vbz) { - type.object.name.en - film.actor.film { - type.object.name.en - } - } -}` - + flag.Parse() // TODO(pawan): Pick address for server from config conn, err := grpc.Dial("127.0.0.1:"+*port, grpc.WithInsecure()) if err != nil { @@ -51,7 +42,7 @@ func main() { c := pb.NewDGraphClient(conn) - r, err := c.GetGraphResponse(context.Background(), &pb.GraphRequest{Query: q0}) + r, err := c.GetResponse(context.Background(), &pb.GraphRequest{Query: *query}) if err != nil { x.Err(glog, err).Fatal("Error in getting response from server") } diff --git a/server/main.go b/server/main.go index 8a0df9b9e253263b9b5583113fa8732e159c45bb..39f710e6daff7d41ce3465e0caf4b9fa2ad10e69 100644 --- a/server/main.go +++ b/server/main.go @@ -50,7 +50,7 @@ var postingDir = flag.String("postings", "", "Directory to store posting lists") var uidDir = flag.String("uids", "", "XID UID posting lists directory") var mutationDir = flag.String("mutations", "", "Directory to store mutations") var port = flag.String("port", "8080", "Port to run server on.") -var clientPort = flag.String("port", "9090", "Port used to communicate with client on tcp") +var clientPort = flag.String("clientPort", "9090", "Port used to communicate with client on tcp") var numcpu = flag.Int("numCpu", runtime.NumCPU(), "Number of cores to be used by the process") var instanceIdx = flag.Uint64("instanceIdx", 0, @@ -256,7 +256,10 @@ func runServerForClient(address string) error { s := grpc.NewServer() pb.RegisterDGraphServer(s, &server{}) - s.Serve(ln) + if err = s.Serve(ln); err != nil { + glog.Fatalf("While serving gRpc requests", err) + } + return nil } func main() {